net-misc/openssh: Fix X.509 support
authorThomas Deutschmann <whissi@gentoo.org>
Wed, 11 Apr 2018 23:53:46 +0000 (01:53 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Wed, 11 Apr 2018 23:53:59 +0000 (01:53 +0200)
The X.509 part in sshd only accepts specific PACKAGE VERSION values or will
reject a X.509 ssh client. Because we cannot fix all X.509 sshd servers
we patched the exposed PACKAGE VERSION to pass the "requirement".

Package-Manager: Portage-2.3.28, Repoman-2.3.9

net-misc/openssh/openssh-7.7_p1-r1.ebuild [moved from net-misc/openssh/openssh-7.7_p1.ebuild with 96% similarity]

similarity index 96%
rename from net-misc/openssh/openssh-7.7_p1.ebuild
rename to net-misc/openssh/openssh-7.7_p1-r1.ebuild
index ba76b889200d55cfad039f07e3b8f00d7425a7a4..cfcfc30327fc3c503d57c3e64efd09e0df45a5cc 100644 (file)
@@ -20,7 +20,7 @@ X509_VER="11.3.1" X509_PATCH="${PARCH}-x509-${X509_VER}.patch.xz"
 DESCRIPTION="Port of OpenBSD's free SSH release"
 HOMEPAGE="https://www.openssh.com/"
 SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
-       ${SCTP_PATCH:+https://dev.gentoo.org/~whissi/dist/openssh/${SCTP_PATCH}}
+       ${SCTP_PATCH:+sctp? ( https://dev.gentoo.org/~whissi/dist/openssh/${SCTP_PATCH} )}
        ${HPN_PATCH:+hpn? ( https://dev.gentoo.org/~whissi/dist/openssh/${HPN_PATCH} )}
        ${LDAP_PATCH:+ldap? ( https://dev.gentoo.org/~whissi/dist/openssh/${LDAP_PATCH} )}
        ${X509_PATCH:+X509? ( https://dev.gentoo.org/~whissi/dist/openssh/${X509_PATCH} )}
@@ -115,6 +115,14 @@ src_prepare() {
        if use X509 ; then
                eapply "${WORKDIR}"/${X509_PATCH%.*}
 
+               # We need to patch package version or any X.509 sshd will reject our ssh client
+               # with "userauth_pubkey: could not parse key: string is too large [preauth]"
+               # error
+               einfo "Patching package version for X.509 patch set ..."
+               sed -i \
+                       -e "s/^AC_INIT(\[OpenSSH\], \[Portable\]/AC_INIT([OpenSSH], [${X509_VER}]/" \
+                       "${S}"/configure.ac || die "Failed to patch package version for X.509 patch"
+
                einfo "Patching version.h to expose X.509 patch set ..."
                sed -i \
                        -e "/^#define SSH_PORTABLE.*/a #define SSH_X509               \"-PKIXSSH-${X509_VER}\"" \
@@ -209,6 +217,8 @@ src_prepare() {
                        "${S}"/version.h || die "Failed to patch SSH_RELEASE (version.h)"
        fi
 
+       eapply_user #473004
+
        tc-export PKG_CONFIG
        local sed_args=(
                -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
@@ -229,8 +239,6 @@ src_prepare() {
        )
        sed -i "${sed_args[@]}" configure{.ac,} || die
 
-       eapply_user #473004
-
        eautoreconf
 }