app-admin/sudo: Security bump to version 1.8.31
authorLars Wendler <polynomial-c@gentoo.org>
Fri, 31 Jan 2020 13:54:44 +0000 (14:54 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Fri, 31 Jan 2020 14:00:04 +0000 (15:00 +0100)
Bug: https://bugs.gentoo.org/707574
Package-Manager: Portage-2.3.86, Repoman-2.3.20
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
app-admin/sudo/Manifest
app-admin/sudo/sudo-1.8.31.ebuild [new file with mode: 0644]

index 388b5fb561c903b62bf111c940f03462f2de36f7..6cf5fd993dd00df67451d352af8e8188381eb7bb 100644 (file)
@@ -1,3 +1,4 @@
 DIST sudo-1.8.28p1.tar.gz 3310254 BLAKE2B a1810af7a42d05cce49bb9d0acf6f3731a5193e9e9c3b458691379131eb86d36995854d11c09525e8d999ed1da7e99cf170634667c5a444aa522b8f23db7d1aa SHA512 bda3de34c15fbb68fc29759542295560ccc1562b419d03709cea51613937e9b92ba689c79c3ef4858aeea90d3d1a4dc0148225b11b22cf82395ae1bad8cb1734
 DIST sudo-1.8.29.tar.gz 3338260 BLAKE2B 7ba29d155bfb1d7ba20e32ade2e8ee3919e70400b6c235e313052b247b48406b9a051e71daa7e47fdb0a9fd0889f4c05b8a1a170c027503b90081e8cec81660e SHA512 ea780922b2afb47df4df4b533fb355fd916cb18a6bfd13c7ca36a25b03ef585d805648c6fa85692bea363b1f83664ac3bc622f99bcd149b3a86f70522eb4d340
 DIST sudo-1.8.30.tar.gz 3349455 BLAKE2B 5e0aaa41f42c18cd0de473add3665adf797cd37eacfb4abfc9472814ea679c1e88e28e95e13a73eb7d9648174609d80a2d4eccf3bdf87a44186df07aeba60eee SHA512 d44831feabd92d736614239e0e0f086829d84b213c98524fffb4b926a96715b1156538a7ab5e0b6e0db8be67a6e24a1642b3648105b076d23b58c39d0dd947af
+DIST sudo-1.8.31.tar.gz 3350674 BLAKE2B de5a968732fdd58933b4c513d13c43a08cb50075a00c3e0d338c9892570a416a2b3a8f19940c0893715f4eeab991e804831a87ef656ffd91e7f1ba047c119261 SHA512 b9e408a322938c7a712458e9012d8a5f648fba5b23a5057cf5d8372c7f931262595f1575c32c32b9cb1a04af670ff4611e7df48d197e5c4cc038d6b65439a28a
diff --git a/app-admin/sudo/sudo-1.8.31.ebuild b/app-admin/sudo/sudo-1.8.31.ebuild
new file mode 100644 (file)
index 0000000..944dd7d
--- /dev/null
@@ -0,0 +1,263 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit pam multilib libtool tmpfiles
+
+MY_P="${P/_/}"
+MY_P="${MY_P/beta/b}"
+
+DESCRIPTION="Allows users or groups to run commands as other users"
+HOMEPAGE="https://www.sudo.ws/"
+if [[ ${PV} == "9999" ]] ; then
+       inherit mercurial
+       EHG_REPO_URI="https://www.sudo.ws/repos/sudo"
+else
+       uri_prefix=
+       case ${P} in
+               *_beta*|*_rc*) uri_prefix=beta/ ;;
+       esac
+
+       SRC_URI="https://www.sudo.ws/sudo/dist/${uri_prefix}${MY_P}.tar.gz
+               ftp://ftp.sudo.ws/pub/sudo/${uri_prefix}${MY_P}.tar.gz"
+       if [[ ${PV} != *_beta* ]] && [[ ${PV} != *_rc* ]] ; then
+               KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-solaris"
+       fi
+fi
+
+# Basic license is ISC-style as-is, some files are released under
+# 3-clause BSD license
+LICENSE="ISC BSD"
+SLOT="0"
+IUSE="gcrypt ldap libressl nls offensive pam sasl +secure-path selinux +sendmail skey sssd system-digest"
+
+DEPEND="
+       sys-libs/zlib:=
+       ldap? (
+               >=net-nds/openldap-2.1.30-r1
+               sasl? (
+                       dev-libs/cyrus-sasl
+                       net-nds/openldap[sasl]
+               )
+       )
+       pam? ( sys-libs/pam )
+       sasl? ( dev-libs/cyrus-sasl )
+       skey? ( >=sys-auth/skey-1.1.5-r1 )
+       sssd? ( sys-auth/sssd[sudo] )
+       system-digest? (
+               gcrypt? ( dev-libs/libgcrypt:= )
+               !gcrypt? (
+                       !libressl? ( dev-libs/openssl:0= )
+                       libressl? ( dev-libs/libressl:0= )
+               )
+       )
+"
+RDEPEND="
+       ${DEPEND}
+       >=app-misc/editor-wrapper-3
+       virtual/editor
+       ldap? ( dev-lang/perl )
+       pam? ( sys-auth/pambase )
+       selinux? ( sec-policy/selinux-sudo )
+       sendmail? ( virtual/mta )
+"
+BDEPEND="
+       sys-devel/bison
+"
+
+S="${WORKDIR}/${MY_P}"
+
+REQUIRED_USE="
+       pam? ( !skey )
+       skey? ( !pam )
+"
+
+MAKEOPTS+=" SAMPLES="
+
+src_prepare() {
+       default
+       elibtoolize
+}
+
+set_secure_path() {
+       # FIXME: secure_path is a compile time setting. using PATH or
+       # ROOTPATH is not perfect, env-update may invalidate this, but until it
+       # is available as a sudoers setting this will have to do.
+       einfo "Setting secure_path ..."
+
+       # first extract the default ROOTPATH from build env
+       SECURE_PATH=$(unset ROOTPATH; . "${EPREFIX}"/etc/profile.env;
+               echo "${ROOTPATH}")
+               case "${SECURE_PATH}" in
+                       */usr/sbin*) ;;
+                       *) SECURE_PATH=$(unset PATH;
+                               . "${EPREFIX}"/etc/profile.env; echo "${PATH}")
+                               ;;
+               esac
+       if [[ -z ${SECURE_PATH} ]] ; then
+               ewarn " Failed to detect SECURE_PATH, please report this"
+       fi
+
+       # then remove duplicate path entries
+       cleanpath() {
+               local newpath thisp IFS=:
+               for thisp in $1 ; do
+                       if [[ :${newpath}: != *:${thisp}:* ]] ; then
+                               newpath+=:${thisp}
+                       else
+                               einfo "   Duplicate entry ${thisp} removed..."
+                       fi
+               done
+               SECURE_PATH=${newpath#:}
+       }
+       cleanpath /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin${SECURE_PATH:+:${SECURE_PATH}}
+
+       # finally, strip gcc paths #136027
+       rmpath() {
+               local e newpath thisp IFS=:
+               for thisp in ${SECURE_PATH} ; do
+                       for e ; do [[ ${thisp} == ${e} ]] && continue 2 ; done
+                       newpath+=:${thisp}
+               done
+               SECURE_PATH=${newpath#:}
+       }
+       rmpath '*/gcc-bin/*' '*/gnat-gcc-bin/*' '*/gnat-gcc/*'
+
+       einfo "... done"
+}
+
+src_configure() {
+       local SECURE_PATH
+       set_secure_path
+
+       # audit: somebody got to explain me how I can test this before I
+       # enable it.. - Diego
+       # plugindir: autoconf code is crappy and does not delay evaluation
+       # until `make` time, so we have to use a full path here rather than
+       # basing off other values.
+       myeconfargs=(
+               --enable-zlib=system
+               --enable-tmpfiles.d="${EPREFIX}"/usr/lib/tmpfiles.d
+               --with-editor="${EPREFIX}"/usr/libexec/editor
+               --with-env-editor
+               --with-plugindir="${EPREFIX}"/usr/$(get_libdir)/sudo
+               --with-rundir="${EPREFIX}"/run/sudo
+               $(use_with secure-path secure-path "${SECURE_PATH}")
+               --with-vardir="${EPREFIX}"/var/db/sudo
+               --without-linux-audit
+               --without-opie
+               $(use_enable gcrypt)
+               $(use_enable nls)
+               $(use_enable sasl)
+               $(use_with offensive insults)
+               $(use_with offensive all-insults)
+               $(use_with ldap ldap_conf_file /etc/ldap.conf.sudo)
+               $(use_with ldap)
+               $(use_with pam)
+               $(use_with skey)
+               $(use_with sssd)
+               $(use_with selinux)
+               $(use_with sendmail)
+       )
+
+       if use system-digest && ! use gcrypt; then
+               myeconfargs+=("--enable-openssl")
+       else
+               myeconfargs+=("--disable-openssl")
+       fi
+
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       if use ldap ; then
+               dodoc README.LDAP
+
+               cat <<-EOF > "${T}"/ldap.conf.sudo
+               # See ldap.conf(5) and README.LDAP for details
+               # This file should only be readable by root
+
+               # supported directives: host, port, ssl, ldap_version
+               # uri, binddn, bindpw, sudoers_base, sudoers_debug
+               # tls_{checkpeer,cacertfile,cacertdir,randfile,ciphers,cert,key}
+               EOF
+
+               if use sasl ; then
+                       cat <<-EOF >> "${T}"/ldap.conf.sudo
+
+                       # SASL directives: use_sasl, sasl_mech, sasl_auth_id
+                       # sasl_secprops, rootuse_sasl, rootsasl_auth_id, krb5_ccname
+                       EOF
+               fi
+
+               insinto /etc
+               doins "${T}"/ldap.conf.sudo
+               fperms 0440 /etc/ldap.conf.sudo
+
+               insinto /etc/openldap/schema
+               newins doc/schema.OpenLDAP sudo.schema
+       fi
+
+       pamd_mimic system-auth sudo auth account session
+
+       keepdir /var/db/sudo/lectured
+       fperms 0700 /var/db/sudo/lectured
+       fperms 0711 /var/db/sudo #652958
+
+       # Don't install into /run as that is a tmpfs most of the time
+       # (bug #504854)
+       rm -rf "${ED}"/run
+
+       find "${ED}" -type f -name "*.la" -delete || die #697812
+}
+
+pkg_postinst() {
+       tmpfiles_process sudo.conf
+
+       #652958
+       local sudo_db="${EROOT}/var/db/sudo"
+       if [[ "$(stat -c %a "${sudo_db}")" -ne 711 ]] ; then
+               chmod 711 "${sudo_db}" || die
+       fi
+
+       if use ldap ; then
+               ewarn
+               ewarn "sudo uses the /etc/ldap.conf.sudo file for ldap configuration."
+               ewarn
+               if grep -qs '^[[:space:]]*sudoers:' "${ROOT}"/etc/nsswitch.conf ; then
+                       ewarn "In 1.7 series, LDAP is no more consulted, unless explicitly"
+                       ewarn "configured in /etc/nsswitch.conf."
+                       ewarn
+                       ewarn "To make use of LDAP, add this line to your /etc/nsswitch.conf:"
+                       ewarn "  sudoers: ldap files"
+                       ewarn
+               fi
+       fi
+       if use prefix ; then
+               ewarn
+               ewarn "To use sudo, you need to change file ownership and permissions"
+               ewarn "with root privileges, as follows:"
+               ewarn
+               ewarn "  # chown root:root ${EPREFIX}/usr/bin/sudo"
+               ewarn "  # chown root:root ${EPREFIX}/usr/lib/sudo/sudoers.so"
+               ewarn "  # chown root:root ${EPREFIX}/etc/sudoers"
+               ewarn "  # chown root:root ${EPREFIX}/etc/sudoers.d"
+               ewarn "  # chown root:root ${EPREFIX}/var/db/sudo"
+               ewarn "  # chmod 4111 ${EPREFIX}/usr/bin/sudo"
+               ewarn
+       fi
+
+       elog "To use the -A (askpass) option, you need to install a compatible"
+       elog "password program from the following list. Starred packages will"
+       elog "automatically register for the use with sudo (but will not force"
+       elog "the -A option):"
+       elog ""
+       elog " [*] net-misc/ssh-askpass-fullscreen"
+       elog "     net-misc/x11-ssh-askpass"
+       elog ""
+       elog "You can override the choice by setting the SUDO_ASKPASS environmnent"
+       elog "variable to the program you want to use."
+}