Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1504977iob; Fri, 29 Apr 2022 06:52:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv/LCMN1HhyEIqBm+vB70QOuOaXRtPwAvBrJIk2g05Diw3PMO+jGT/evRkG0JRsKiNf5z0 X-Received: by 2002:a17:90b:4f45:b0:1d9:91df:ad2f with SMTP id pj5-20020a17090b4f4500b001d991dfad2fmr4165016pjb.4.1651240368929; Fri, 29 Apr 2022 06:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651240368; cv=none; d=google.com; s=arc-20160816; b=sdncOMoDQFfkRpE+fFFtgXbBRN2FUrurwHaNiyjGAkKIjRywWfhxrGHyhkbOSV5E2R CY86/OyQLCWYc0z607+idVDF5I/ibrZ3ZxOaqHitUkjxNwcWSXg8Gj/N4LHjL+vwybf4 SQvvnpbrCaGO4MrZWzGlBZrAMmTSiTyT8N+SEy8iEqLptnOm73DWuejGgO/MoMBBHrZ8 z9lwyqG890858u846R29DsIAm5d9bjPNJScIQH/m99rdM6ZouP1kTOhPitEPBhUHPOVJ iIQ/QIXxPMSp2mYOoj8mXFiT5syutMivE6LeKfCRydjkFmrRYgVnM84E3by0A/Gl9JBx l5uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=mEw62v1kuJQHmlRrCyVjGQtqwhVWqTxtmaom/79rnco=; b=0l6u2Rq+5nKBUKAChzKzmbB0KuRT5e8h0mbqRzVwYch7tAydS8Pfr+B6ozBYx/KPre AFkHp7L34ot2vnzsTgAFK3HDjUjZaB7xhKum7se006v5oFa2a/QdaSZgS4jzkqP+OXdU d9SPI4PNmXjpAPFBhP2kcgtFPVgPBNEgs2x9QeY1EUvJI7kGv5Jt39iAg4GWddW3vXEN HtvODPXKnY62DL0e44DBSFy5s1RIyHgb3tMaHKkxSX0x1syliR5YRTu+sdqpjcXDsUaE gs3+Ln80mUZmfuvY9RSa1Oqt1yMq59V1i0HrJ7XrQL8eQ1RRzlxDN0k3rvm1hPkFDSjx jlhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="x0L/HqCw"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="/1iJkvcS"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a170902ea0300b00156a03969e8si8086662plg.307.2022.04.29.06.52.17; Fri, 29 Apr 2022 06:52:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="x0L/HqCw"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="/1iJkvcS"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350797AbiD2G3A (ORCPT + 99 others); Fri, 29 Apr 2022 02:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiD2G3A (ORCPT ); Fri, 29 Apr 2022 02:29:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8428C2FFEB; Thu, 28 Apr 2022 23:25:42 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D483E1F891; Fri, 29 Apr 2022 06:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651213540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mEw62v1kuJQHmlRrCyVjGQtqwhVWqTxtmaom/79rnco=; b=x0L/HqCw7Unnw352nykpZUI0RufEfg7p6tti/IVUnAHk1WiKawp/ZPd4Gs4EYSgkGmtSW+ Tkg1rEPv2HSA+mMrJGa9cTiQxtgUDDkrRGOMyNJf6mPdkVHjPsimAmrWXEW3lJjEHkji+T /uSmmrqRyYGdVI8nc2RQ4zJ67J8K110= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651213540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mEw62v1kuJQHmlRrCyVjGQtqwhVWqTxtmaom/79rnco=; b=/1iJkvcS+vjQLEvIiuZZqcO9XLwmKyKmapOwwGqhBVZ+bsDuQ854eOrIwSM4qdkMsN3PX6 1Duj/jqrS6/I8WCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9BAA013446; Fri, 29 Apr 2022 06:25:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id f6ByJOSEa2KbLAAAMHmgww (envelope-from ); Fri, 29 Apr 2022 06:25:40 +0000 Message-ID: <32eb95ad-ceb7-4138-63d9-f6108f0f6393@suse.de> Date: Fri, 29 Apr 2022 08:25:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH RFC 4/5] net/tls: Add support for PF_TLSH (a TLS handshake listener) Content-Language: en-US To: Chuck Lever III , Boris Pismenny Cc: Alexander Krizhanovsky , Simo Sorce , linux-fsdevel , "linux-cifs@vger.kernel.org" , Linux NFS Mailing List , "linux-nvme@lists.infradead.org" , "netdev@vger.kernel.org" , Jakub Kicinski References: <165030051838.5073.8699008789153780301.stgit@oracle-102.nfsv4.dev> <165030059051.5073.16723746870370826608.stgit@oracle-102.nfsv4.dev> <068945db-f29e-8586-0487-bb5be68c7ba8@gmail.com> <33F93223-519B-47E9-8578-B18DCB8F1F8E@oracle.com> From: Hannes Reinecke In-Reply-To: <33F93223-519B-47E9-8578-B18DCB8F1F8E@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 4/28/22 17:24, Chuck Lever III wrote: > > >> On Apr 28, 2022, at 4:49 AM, Boris Pismenny wrote: >> >> On 18/04/2022 19:49, Chuck Lever wrote: >>> In-kernel TLS consumers need a way to perform a TLS handshake. In >>> the absence of a handshake implementation in the kernel itself, a >>> mechanism to perform the handshake in user space, using an existing >>> TLS handshake library, is necessary. >>> >>> I've designed a way to pass a connected kernel socket endpoint to >>> user space using the traditional listen/accept mechanism. accept(2) >>> gives us a well-understood way to materialize a socket endpoint as a >>> normal file descriptor in a specific user space process. Like any >>> open socket descriptor, the accepted FD can then be passed to a >>> library such as openSSL to perform a TLS handshake. >>> >>> This prototype currently handles only initiating client-side TLS >>> handshakes. Server-side handshakes and key renegotiation are left >>> to do. >>> >>> Security Considerations >>> ~~~~~~~~ ~~~~~~~~~~~~~~ >>> >>> This prototype is net-namespace aware. >>> >>> The kernel has no mechanism to attest that the listening user space >>> agent is trustworthy. >>> >>> Currently the prototype does not handle multiple listeners that >>> overlap -- multiple listeners in the same net namespace that have >>> overlapping bind addresses. >>> >> >> Thanks for posting this. As we discussed offline, I think this approach >> is more manageable compared to a full in-kernel TLS handshake. A while >> ago, I've hacked around TLS to implement the data-path for NVMe-TLS and >> the data-path is indeed very simple provided an infrastructure such as >> this one. >> >> Making this more generic is desirable, and this obviously requires >> supporting multiple listeners for multiple protocols (TLS, DTLS, QUIC, >> PSP, etc.), which suggests that it will reside somewhere outside of net/tls. >> Moreover, there is a need to support (TLS) control messages here too. >> These will occasionally require going back to the userspace daemon >> during kernel packet processing. A few examples are handling: TLS rekey, >> TLS close_notify, and TLS keepalives. I'm not saying that we need to >> support everything from day-1, but there needs to be a way to support these. > > I agree that control messages need to be handled as well. For the > moment, the prototype simply breaks the connection when a control > message is encountered, and a new session is negotiated. That of > course is not the desired long-term solution. > > If we believe that control messages are going to be distinct for > each transport security layer, then perhaps we cannot make the > handshake mechanism generic -- it will have to be specific to > each security layer. Just a thought. > > >> A related kernel interface is the XFRM netlink where the kernel asks a >> userspace daemon to perform an IKE handshake for establishing IPsec SAs. >> This works well when the handshake runs on a different socket, perhaps >> that interface can be extended to do handshakes on a given socket that >> lives in the kernel without actually passing the fd to userespace. If we >> avoid instantiating a full socket fd in userspace, then the need for an >> accept(2) interface is reduced, right? > > Certainly piping the handshake messages up to user space instead > of handing off a socket is possible. The TLS libraries would need > to tolerate this, and GnuTLS (at least) appears OK with performing > a handshake on an AF_TLSH socket. > Yeah, and I guess that'll be the hard part. We would need to design an entirely data path for gnutls when going down that path. The beauty of the fd-passing idea is that gnutls (and openssl for that matter) will 'just work' (tm), without us have to do larger surgery there. Just for reference, I've raised an issue with gnutls to accept long identifiers in TLS 1.3 (issue #1323), which is required for NVMe-over-TLS support. That one is lingering for over two months now. And that's a relatively simple change; I don't want to imagine how long it'd take to try to push in a larger redesign... Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer