Revert "net-misc/openssh: Security cleanup"
authorThomas Deutschmann <whissi@gentoo.org>
Sat, 6 Oct 2018 22:31:32 +0000 (00:31 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Sat, 6 Oct 2018 22:31:32 +0000 (00:31 +0200)
This reverts commit 5091fd8f2b5a7cb0d3e970df404446d3aef8f3c7.

<net-misc/openssh-7.6 is still needed for dev-python/twisted.

Bug: https://bugs.gentoo.org/661258
Bug: https://bugs.gentoo.org/664264
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
net-misc/openssh/Manifest
net-misc/openssh/metadata.xml
net-misc/openssh/openssh-7.5_p1-r4.ebuild [new file with mode: 0644]

index 86994d17c7deb688de832f8224ec9a38afe63c47..73d61beed4aa1e2cf87f13b61f54507be205438b 100644 (file)
@@ -1,3 +1,7 @@
+DIST openssh-7.4_p1-sctp.patch.xz 8220 BLAKE2B 2d571cacaab342b7950b42ec826bd896edf78780e9ee73fcd441cbc9764eb59e408e295062862db986918824d10498383bf34ae7c93df0da2c056eaec4d2c031 SHA512 0c199e3b26949482125aeaa88216b2458292589e3eac8908d9134d13a1cae891094fcb0f752ed3009b3126cc72277b460205f39140c251792eb1b545271c3bd4
+DIST openssh-7.5p1+x509-10.2.diff.gz 467040 BLAKE2B 4048b0f016bf7d43276f88117fc266d1a450d298563bfc6ce705ec2829b8f9d91af5c5232941d55004b5aea2d3e0fb682a9d4acd9510c9761ba7ede2f2f0e37f SHA512 ec760d38771749d09afc8d720120ea2aa065c1c7983898b45dba74a4411f7e61e7705da226864e1e8e62e2261eecc3a4ab654b528c71512a07798824d9fb1a9a
+DIST openssh-7.5p1-hpnssh14v12.tar.xz 23068 BLAKE2B 15702338877e50c2143b33b93bfc87d0aa0fa55915db1f0cab9c22e55f8aa0c6eeb5a56f438d849544d1650bdc574384b851292d621b79f673b78bc37617aa0b SHA512 45c42090a212b9ce898fbaa8284ddf0f0d17236af13c4a780e00bf265b0c7a4286027e90a7ce9ad70066309db722709dd2f0a7914f57e5364ffbaf7c4859cdf9
+DIST openssh-7.5p1.tar.gz 1510857 BLAKE2B 505764a210018136456c0f5dd40ad9f1383551c3ae037593d4296305df189e0a6f1383adc89b1970d58b8dcfff391878b7a29b848cc244a99705a164bec5d734 SHA512 58c542e8a110fb4316a68db94abb663fa1c810becd0638d45281df8aeca62c1f705090437a80e788e6c29121769b72a505feced537d3118c933fde01b5285c81
 DIST openssh-7.7p1-hpnssh14v15-gentoo2.patch.xz 22060 BLAKE2B 9ee654f689d4b90bd0fe4f71d57b4a8d9d957012be3a23ff2baa6c45ae99e2f1e4daf5de24479a6a3eb761ee6847deb3c6c3021d4cbabc9089f605d8d7270efc SHA512 856d28ac89c14d01c40c7d7e93cfaebd74b091188b5b469550eb62aa5445177aec1a5f47c1e2f7173013712e98e5f9f5e46bbb3dbd4ec7c5ee8256ef45cda0f8
 DIST openssh-7.7p1-patches-1.2.tar.xz 17584 BLAKE2B 192ec01906c911197abec4606cdf136cf26ac4ab4c405267cd98bafaea409d9d596b2b985eaeda6a1425d587d63b6f403b988f280aff989357586bf232d27712 SHA512 e646ec3674b5ef38abe823406d33c8a47c5f63fa962c41386709a7ad7115d968b70fbcf7a8f3efc67a3e80e0194e8e22a01c2342c830f99970fe02532cdee51b
 DIST openssh-7.7p1-sctp-1.1.patch.xz 7548 BLAKE2B 3b960c2377351955007005de560c2a3e8d0d059a0435e5beda14c63e444dad8b4357edaccd1cfe446c6268514f152b2bcfa7fa3612f1ae1324a31fecb0e85ac5 SHA512 093605865262a2b972db8c92990a49ed6178ed4567fb2626518c826c8472553d9be99a9e6052a6f5e545d81867b4118e9fd8a2c0c26a2739f1720b0f13282cba
@@ -8,3 +12,4 @@ DIST openssh-7.8p1-sctp-1.1.patch.xz 7548 BLAKE2B d74010028f097812f554f9e788aa5e
 DIST openssh-7.8p1.tar.gz 1548026 BLAKE2B 938428408596d24d497f245e3662a0cff3d462645683bf75cd29a0ea56fa6c280e7fa866bedf0928dd5bc4085b82d5a4ce74b7eea0b45b86f879b69f74db1642 SHA512 8e5b0c8682a9243e4e8b7c374ec989dccd1a752eb6f84e593b67141e8b23dcc8b9a7322b1f7525d18e2ce8830a767d0d9793f997486339db201a57986b910705
 DIST openssh-7_8_P1-hpn-AES-CTR-14.16.diff 29231 BLAKE2B e25877c5e22f674e6db5a0bc107e5daa2509fe762fb14ce7bb2ce9a115e8177a93340c1d19247b6c2c854b7e1f9ae9af9fd932e5fa9c0a6b2ba438cd11a42991 SHA512 1867fb94c29a51294a71a3ec6a299757565a7cda5696118b0b346ed9c78f2c81bb1b888cff5e3418776b2fa277a8f070c5eb9327bb005453e2ffd72d35cdafa7
 DIST openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 43356 BLAKE2B 776fa140d64a16c339b46a7c773258d2f4fe44e48b16abccad1a8757a51cb6362722fc5f42c39159af12849f5c88cf574de64815085c97157e16653f18d4909b SHA512 53f2752b7aa02719c8dfe0fe0ef16e874101ba2ba87924aa1122cd445ece218ca09c22abaa3377307f25d459579bc28d3854e2402c71b794db65d58cdd1ebc08
+DIST openssh-lpk-7.5p1-0.3.14.patch.xz 17040 BLAKE2B 5b2204316dd244bb8dd11db50d5bc3a194e2cc4b64964a2d3df68bbe54c53588f15fc5176dbc3811e929573fa3e41cf91f412aa2513bb9a4b6ed02c2523c1e24 SHA512 9ce5d7e5d831c972f0f866b686bf93a048a03979ab38627973f5491eeeaa45f9faab0520b3a7ed90a13a67213fdc9cd4cf11e423acad441ea91b71037c8b435b
index ab669d3e59aff555db627c7db741430d96b97256..29134fc060dbcfb7c7a15f62ae25dc9f50805234 100644 (file)
@@ -26,8 +26,10 @@ ssh-keygen and sftp-server. OpenSSH supports SSH protocol versions 1.3, 1.5, and
   <use>
     <flag name="bindist">Disable EC/RC5 algorithms in OpenSSL for patent reasons.</flag>
     <flag name="hpn">Enable high performance ssh</flag>
+    <flag name="ldap">Add support for storing SSH public keys in LDAP</flag>
     <flag name="ldns">Use LDNS for DNSSEC/SSHFP validation.</flag>
     <flag name="livecd">Enable root password logins for live-cd environment.</flag>
+    <flag name="ssh1">Support the legacy/weak SSH1 protocol</flag>
     <flag name="ssl">Enable additional crypto algorithms via OpenSSL</flag>
     <flag name="X509">Adds support for X.509 certificate authentication</flag>
   </use>
diff --git a/net-misc/openssh/openssh-7.5_p1-r4.ebuild b/net-misc/openssh/openssh-7.5_p1-r4.ebuild
new file mode 100644 (file)
index 0000000..cbe425c
--- /dev/null
@@ -0,0 +1,334 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils user flag-o-matic multilib autotools pam systemd
+
+# Make it more portable between straight releases
+# and _p? releases.
+PARCH=${P/_}
+
+HPN_PATCH="${PARCH}-hpnssh14v12.tar.xz"
+SCTP_PATCH="${PN}-7.4_p1-sctp.patch.xz"
+LDAP_PATCH="${PN}-lpk-7.5p1-0.3.14.patch.xz"
+X509_VER="10.2" X509_PATCH="${PN}-${PV/_}+x509-${X509_VER}.diff.gz"
+
+DESCRIPTION="Port of OpenBSD's free SSH release"
+HOMEPAGE="http://www.openssh.org/"
+SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
+       ${SCTP_PATCH:+mirror://gentoo/${SCTP_PATCH}}
+       ${HPN_PATCH:+hpn? ( mirror://gentoo/${HPN_PATCH} )}
+       ${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
+       ${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
+       "
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+# Probably want to drop ssl defaulting to on in a future version.
+IUSE="abi_mips_n32 audit bindist debug ${HPN_PATCH:++}hpn kerberos kernel_linux ldap ldns libedit libressl livecd pam +pie sctp selinux skey ssh1 +ssl static test X X509"
+REQUIRED_USE="ldns? ( ssl )
+       pie? ( !static )
+       ssh1? ( ssl )
+       static? ( !kerberos !pam )
+       X509? ( !ldap !sctp ssl )
+       test? ( ssl )"
+
+LIB_DEPEND="
+       audit? ( sys-process/audit[static-libs(+)] )
+       ldns? (
+               net-libs/ldns[static-libs(+)]
+               !bindist? ( net-libs/ldns[ecdsa,ssl(+)] )
+               bindist? ( net-libs/ldns[-ecdsa,ssl(+)] )
+       )
+       libedit? ( dev-libs/libedit:=[static-libs(+)] )
+       sctp? ( net-misc/lksctp-tools[static-libs(+)] )
+       selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
+       skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
+       ssl? (
+               !libressl? (
+                       >=dev-libs/openssl-1.0.1:0=[bindist=]
+                       dev-libs/openssl:0=[static-libs(+)]
+               )
+               libressl? ( dev-libs/libressl:0=[static-libs(+)] )
+       )
+       >=sys-libs/zlib-1.2.3:=[static-libs(+)]"
+RDEPEND="
+       !static? ( ${LIB_DEPEND//\[static-libs(+)]} )
+       pam? ( virtual/pam )
+       kerberos? ( virtual/krb5 )
+       ldap? ( net-nds/openldap )"
+DEPEND="${RDEPEND}
+       static? ( ${LIB_DEPEND} )
+       virtual/pkgconfig
+       virtual/os-headers
+       sys-devel/autoconf"
+RDEPEND="${RDEPEND}
+       pam? ( >=sys-auth/pambase-20081028 )
+       userland_GNU? ( virtual/shadow )
+       X? ( x11-apps/xauth )"
+
+S=${WORKDIR}/${PARCH}
+
+pkg_pretend() {
+       # this sucks, but i'd rather have people unable to `emerge -u openssh`
+       # than not be able to log in to their server any more
+       maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; }
+       local fail="
+               $(use X509 && maybe_fail X509 X509_PATCH)
+               $(use ldap && maybe_fail ldap LDAP_PATCH)
+               $(use hpn && maybe_fail hpn HPN_PATCH)
+       "
+       fail=$(echo ${fail})
+       if [[ -n ${fail} ]] ; then
+               eerror "Sorry, but this version does not yet support features"
+               eerror "that you requested:      ${fail}"
+               eerror "Please mask ${PF} for now and check back later:"
+               eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
+               die "booooo"
+       fi
+
+       # Make sure people who are using tcp wrappers are notified of its removal. #531156
+       if grep -qs '^ *sshd *:' "${EROOT}"/etc/hosts.{allow,deny} ; then
+               ewarn "Sorry, but openssh no longer supports tcp-wrappers, and it seems like"
+               ewarn "you're trying to use it.  Update your ${EROOT}etc/hosts.{allow,deny} please."
+       fi
+}
+
+save_version() {
+       # version.h patch conflict avoidence
+       mv version.h version.h.$1
+       cp -f version.h.pristine version.h
+}
+
+src_prepare() {
+       sed -i \
+               -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:" \
+               pathnames.h || die
+       # keep this as we need it to avoid the conflict between LPK and HPN changing
+       # this file.
+       cp version.h version.h.pristine
+
+       # don't break .ssh/authorized_keys2 for fun
+       sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
+
+       if use X509 ; then
+               if use hpn ; then
+                       pushd "${WORKDIR}"/${HPN_PATCH%.*.*} >/dev/null
+                       epatch "${FILESDIR}"/${P}-hpn-x509-${X509_VER}-glue.patch
+                       popd >/dev/null
+               fi
+               save_version X509
+               epatch "${WORKDIR}"/${X509_PATCH%.*}
+       fi
+
+       if use ldap ; then
+               epatch "${WORKDIR}"/${LDAP_PATCH%.*}
+               save_version LPK
+       fi
+
+       epatch "${FILESDIR}"/${PN}-7.5_p1-GSSAPI-dns.patch #165444 integrated into gsskex
+       epatch "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch
+       epatch "${FILESDIR}"/${PN}-7.5_p1-disable-conch-interop-tests.patch
+       epatch "${FILESDIR}"/${PN}-7.5_p1-cross-cache.patch
+       epatch "${FILESDIR}"/${PN}-7.5_p1-CVE-2017-15906.patch
+       use X509 || epatch "${FILESDIR}"/${PN}-7.5_p1-s390-seccomp.patch # already included in X509 patch set, #644252
+       use X509 || epatch "${WORKDIR}"/${SCTP_PATCH%.*}
+       use X509 || epatch "${FILESDIR}"/${PN}-7.5_p1-x32-typo.patch
+       use abi_mips_n32 && epatch "${FILESDIR}"/${PN}-7.3-mips-seccomp-n32.patch
+
+       if use hpn ; then
+               EPATCH_FORCE="yes" EPATCH_SUFFIX="patch" \
+                       EPATCH_MULTI_MSG="Applying HPN patchset ..." \
+                       epatch "${WORKDIR}"/${HPN_PATCH%.*.*}
+               save_version HPN
+       fi
+
+       tc-export PKG_CONFIG
+       local sed_args=(
+               -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
+               # Disable PATH reset, trust what portage gives us #254615
+               -e 's:^PATH=/:#PATH=/:'
+               # Disable fortify flags ... our gcc does this for us
+               -e 's:-D_FORTIFY_SOURCE=2::'
+       )
+       # The -ftrapv flag ICEs on hppa #505182
+       use hppa && sed_args+=(
+               -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
+               -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
+       )
+       # _XOPEN_SOURCE causes header conflicts on Solaris
+       [[ ${CHOST} == *-solaris* ]] && sed_args+=(
+               -e 's/-D_XOPEN_SOURCE//'
+       )
+       sed -i "${sed_args[@]}" configure{.ac,} || die
+
+       epatch_user #473004
+
+       # Now we can build a sane merged version.h
+       (
+               sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
+               macros=()
+               for p in HPN LPK X509; do [[ -e version.h.${p} ]] && macros+=( SSH_${p} ) ; done
+               printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros[*]}"
+       ) > version.h
+
+       eautoreconf
+}
+
+src_configure() {
+       addwrite /dev/ptmx
+
+       use debug && append-cppflags -DSANDBOX_SECCOMP_FILTER_DEBUG
+       use static && append-ldflags -static
+
+       local myconf=(
+               --with-ldflags="${LDFLAGS}"
+               --disable-strip
+               --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run
+               --sysconfdir="${EPREFIX}"/etc/ssh
+               --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc
+               --datadir="${EPREFIX}"/usr/share/openssh
+               --with-privsep-path="${EPREFIX}"/var/empty
+               --with-privsep-user=sshd
+               $(use_with audit audit linux)
+               $(use_with kerberos kerberos5 "${EPREFIX}"/usr)
+               # We apply the ldap patch conditionally, so can't pass --without-ldap
+               # unconditionally else we get unknown flag warnings.
+               $(use ldap && use_with ldap)
+               $(use_with ldns)
+               $(use_with libedit)
+               $(use_with pam)
+               $(use_with pie)
+               $(use X509 || use_with sctp)
+               $(use_with selinux)
+               $(use_with skey)
+               $(use_with ssh1)
+               $(use_with ssl openssl)
+               $(use_with ssl md5-passwords)
+               $(use_with ssl ssl-engine)
+       )
+
+       # The seccomp sandbox is broken on x32, so use the older method for now. #553748
+       use amd64 && [[ ${ABI} == "x32" ]] && myconf+=( --with-sandbox=rlimit )
+
+       econf "${myconf[@]}"
+}
+
+src_install() {
+       emake install-nokeys DESTDIR="${D}"
+       fperms 600 /etc/ssh/sshd_config
+       dobin contrib/ssh-copy-id
+       newinitd "${FILESDIR}"/sshd.rc6.4 sshd
+       newconfd "${FILESDIR}"/sshd.confd sshd
+
+       newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+       if use pam ; then
+               sed -i \
+                       -e "/^#UsePAM /s:.*:UsePAM yes:" \
+                       -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+                       -e "/^#PrintMotd /s:.*:PrintMotd no:" \
+                       -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+                       "${ED}"/etc/ssh/sshd_config || die
+       fi
+
+       # Gentoo tweaks to default config files
+       cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
+
+       # Allow client to pass locale environment variables #367017
+       AcceptEnv LANG LC_*
+       EOF
+       cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
+
+       # Send locale environment variables #367017
+       SendEnv LANG LC_*
+       EOF
+
+       if use livecd ; then
+               sed -i \
+                       -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \
+                       "${ED}"/etc/ssh/sshd_config || die
+       fi
+
+       if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
+               insinto /etc/openldap/schema/
+               newins openssh-lpk_openldap.schema openssh-lpk.schema
+       fi
+
+       doman contrib/ssh-copy-id.1
+       dodoc CREDITS OVERVIEW README* TODO sshd_config
+       use X509 || dodoc ChangeLog
+
+       diropts -m 0700
+       dodir /etc/skel/.ssh
+
+       systemd_dounit "${FILESDIR}"/sshd.{service,socket}
+       systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
+}
+
+src_test() {
+       local t skipped=() failed=() passed=()
+       local tests=( interop-tests compat-tests )
+
+       local shell=$(egetshell "${UID}")
+       if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
+               elog "Running the full OpenSSH testsuite requires a usable shell for the 'portage'"
+               elog "user, so we will run a subset only."
+               skipped+=( tests )
+       else
+               tests+=( tests )
+       fi
+
+       # It will also attempt to write to the homedir .ssh.
+       local sshhome=${T}/homedir
+       mkdir -p "${sshhome}"/.ssh
+       for t in "${tests[@]}" ; do
+               # Some tests read from stdin ...
+               HOMEDIR="${sshhome}" HOME="${sshhome}" \
+               emake -k -j1 ${t} </dev/null \
+                       && passed+=( "${t}" ) \
+                       || failed+=( "${t}" )
+       done
+
+       einfo "Passed tests: ${passed[*]}"
+       [[ ${#skipped[@]} -gt 0 ]] && ewarn "Skipped tests: ${skipped[*]}"
+       [[ ${#failed[@]}  -gt 0 ]] && die "Some tests failed: ${failed[*]}"
+}
+
+pkg_preinst() {
+       enewgroup sshd 22
+       enewuser sshd 22 -1 /var/empty sshd
+}
+
+pkg_postinst() {
+       if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
+               elog "Starting with openssh-5.8p1, the server will default to a newer key"
+               elog "algorithm (ECDSA).  You are encouraged to manually update your stored"
+               elog "keys list as servers update theirs.  See ssh-keyscan(1) for more info."
+       fi
+       if has_version "<${CATEGORY}/${PN}-6.9_p1" ; then
+               elog "Starting with openssh-6.9p1, ssh1 support is disabled by default."
+       fi
+       if has_version "<${CATEGORY}/${PN}-7.0_p1" ; then
+               elog "Starting with openssh-6.7, support for USE=tcpd has been dropped by upstream."
+               elog "Make sure to update any configs that you might have.  Note that xinetd might"
+               elog "be an alternative for you as it supports USE=tcpd."
+       fi
+       if has_version "<${CATEGORY}/${PN}-7.1_p1" ; then #557388 #555518
+               elog "Starting with openssh-7.0, support for ssh-dss keys were disabled due to their"
+               elog "weak sizes.  If you rely on these key types, you can re-enable the key types by"
+               elog "adding to your sshd_config or ~/.ssh/config files:"
+               elog "  PubkeyAcceptedKeyTypes=+ssh-dss"
+               elog "You should however generate new keys using rsa or ed25519."
+
+               elog "Starting with openssh-7.0, the default for PermitRootLogin changed from 'yes'"
+               elog "to 'prohibit-password'.  That means password auth for root users no longer works"
+               elog "out of the box.  If you need this, please update your sshd_config explicitly."
+       fi
+       if ! use ssl && has_version "${CATEGORY}/${PN}[ssl]" ; then
+               elog "Be aware that by disabling openssl support in openssh, the server and clients"
+               elog "no longer support dss/rsa/ecdsa keys.  You will need to generate ed25519 keys"
+               elog "and update all clients/servers that utilize them."
+       fi
+}