From nobody Sun Mar 06 00:57:55 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 004611A0FBA8; Sun, 6 Mar 2022 00:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KB39H6Y5Vz3Kdc; Sun, 6 Mar 2022 00:57:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646528275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jea2Agrwy3Tm8k9844JVi0UWj/AqpktBNmOcAISK72o=; b=QdNQe+n1gCoC6tzPVDGJu8vNqAgMSWc3IwBoq0MIWKpISIEMjMC+AL6QrBP+NY/nxfJb9Q pwnOQGxG2uSTX0+ncrwQZ84n/mFCq/QEkswxfy3ofngvD6AOZ7BZPAby5lEnaFBG6GXg9p yDC2IWOkZL4m8BToN2Dl2SQksr+lzfXpMZ6lxrwabm0M50xr33bxTlsE9/sSxN+8Cz0hmw oBil2x1LCdHaWLgNezgNyspUP1Hy2QtDDt3M3egoiYQ+jpEgLJECerbPhH1g/SRZ9Iizgn ixdhmNmbDC/jSltI8J/loUq8q980IePdqU8OrfZI5aezW1XW05I/A2pmr1XF6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC3BD23E5; Sun, 6 Mar 2022 00:57:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2260vtVj020245; Sun, 6 Mar 2022 00:57:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2260vtJu020244; Sun, 6 Mar 2022 00:57:55 GMT (envelope-from git) Date: Sun, 6 Mar 2022 00:57:55 GMT Message-Id: <202203060057.2260vtJu020244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 73104d583850 - main - ssh: generate SK config file using private cbor and fido2 libs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73104d583850f7447ae1fe70c59a42e69d9d407c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646528275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jea2Agrwy3Tm8k9844JVi0UWj/AqpktBNmOcAISK72o=; b=MeavZm8Y2IBR1ck0NhEk2yyD8IrRPJ6D6Q5VjI1iYoQiVjXQ61WWAx0uzcQz3ZMQEmv3GU AjJEkIKMSq/y5PSJxdTzH7WVWgqeZOdrq6f8n1XgNN1Y4O5N66tQw1AjERKsx95D0xi7fK rhghU3B7zmyuxf60TfPOlL8a0midOGcez478AoNddQNF4O6TCmdU+nVFLyGqt80+JmeYuB jHivY5YzEUYX2EJLv9gCwzxpFgTxHgEIqPZ1iZYcxUOo4NCsuKIcbB9Z+v8rjJkdtCTwy6 arR4RS4P9sL+pUQEXd0rb2O8izB1EvkEkn+XLrgRUA2uNXRjXUWf9MvnHIBC8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646528275; a=rsa-sha256; cv=none; b=uKSfvWCkRfYV7gORRPHERVNXFxWDxb8at+ffOsbUU7J1kEFSmXzA6rzu2qW4G00btbQHH1 SWlA+nAzA/FNhro/TP55Be/L3vepeee2f4guoVps+ng3pXKutxkVKt+QfmMCuh6F6P8rwb VPb/sq/67I4yE2roSoS2dMSEhWTelyc7g0TH3u1/+RAISd7r31wWwGGA6hWNyc41+D+Gk1 sRFzTxUQSaugSQoswwxrdi33uD0WSUxgRGOlPimReKbAUFpL0zmYH3adS4NdoA1wDcN8TI txNGiShLf5ixBIx8rDTbs1dWgEAt7JPzTLLhNfit94gD08wpBvN3PliMffn+Ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=73104d583850f7447ae1fe70c59a42e69d9d407c commit 73104d583850f7447ae1fe70c59a42e69d9d407c Author: Ed Maste AuthorDate: 2022-03-01 21:39:16 +0000 Commit: Ed Maste CommitDate: 2022-03-06 00:57:22 +0000 ssh: generate SK config file using private cbor and fido2 libs Specify -lprivatecbor and -lprivatefido2 in OpenSSH's configure.ac, and pass -I paths to libcbor and libfido2's contrib src location. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34440 --- crypto/openssh/configure.ac | 6 +++--- crypto/openssh/freebsd-configure.sh | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/crypto/openssh/configure.ac b/crypto/openssh/configure.ac index 428f3ff55a87..28a64d8f07db 100644 --- a/crypto/openssh/configure.ac +++ b/crypto/openssh/configure.ac @@ -3263,16 +3263,16 @@ if test "x$enable_sk" = "xyes" -a "x$enable_sk_internal" = "xyes" ; then LIBFIDO2=`$PKGCONFIG --libs libfido2` CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libfido2`" else - LIBFIDO2="-lfido2 -lcbor" + LIBFIDO2="-lprivatefido2 -lprivatecbor" fi OTHERLIBS=`echo $LIBFIDO2 | sed 's/-lfido2//'` - AC_CHECK_LIB([fido2], [fido_init], + AC_CHECK_LIB([privatefido2], [fido_init], [ AC_SUBST([LIBFIDO2]) AC_DEFINE([ENABLE_SK_INTERNAL], [], [Enable for built-in U2F/FIDO support]) enable_sk="built-in" - ], [ AC_MSG_ERROR([no usable libfido2 found]) ], + ], [ AC_MSG_ERROR([no usable libprivatefido2 found]) ], [ $OTHERLIBS ] ) saved_LIBS="$LIBS" diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index 4d405a0ffacb..3cde318ade58 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -12,7 +12,6 @@ configure_args=" --with-libedit --with-ssl-engine --without-xauth - --without-security-key-builtin " set -e @@ -34,11 +33,28 @@ sh configure $configure_args --with-kerberos5=/usr mv config.log config.log.kerberos5 mv config.h config.h.kerberos5 -# Generate config.h without krb5 -sh configure $configure_args --without-kerberos5 +# Generate config.h with built-in security key support +# +# We install libcbor and libfido2 as PRIVATELIB, so the headers are not +# available for configure - add their paths via CFLAGS as a slight hack. +# configure.ac is also patched to specify -lprivatecbor and -lprivatefido2 +# rather than -lcbor and -lfido2. +export CFLAGS="-I$openssh/../../contrib/libcbor/src -I$openssh/../../contrib/libfido2/src" +sh configure $configure_args --with-security-key-builtin +unset CFLAGS +mv config.log config.log.sk-builtin +mv config.h config.h.sk-builtin + +# Generate config.h without krb5 or SK support +sh configure $configure_args --without-kerberos5 --without-security-key-builtin # Extract the difference echo '/* $Free''BSD$ */' > krb5_config.h diff -u config.h.kerberos5 config.h | sed -n '/^-#define/s/^-//p' | grep -Ff /dev/stdin config.h.kerberos5 >> krb5_config.h + +# Extract the difference - SK +diff -u config.h.sk-builtin config.h | + sed -n '/^-#define/s/^-//p' | + grep -Ff /dev/stdin config.h.sk-builtin > sk_config.h