Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp617576iob; Thu, 28 Apr 2022 08:43:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiMsQoCAqjyx1EL3AE0r72F9Roj7d9+VpWMT7UpqlL1Dnn73CmpKofGlft8FTUBP+ouREy X-Received: by 2002:a05:651c:626:b0:24f:195a:3590 with SMTP id k38-20020a05651c062600b0024f195a3590mr10068943lje.390.1651160619711; Thu, 28 Apr 2022 08:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651160619; cv=none; d=google.com; s=arc-20160816; b=bICbo7ZPzYj87BvId0hqSl39V6/v2/iWXf1B4wmkLLSvxQA612e2KkFLys4rM64R9G 49+6diDeJZWlwZ2i9HUb70uCmEXyIEt2Tg+R+9Q/TgNqmY5f/TXhKYrB75AYFWcS8usm miC7g09Ph0VNr2Bde9H5++aWrb9j/0cGY06Jyuk+M92N1FYDNw5GYaWAF4ExfnUUGT9Q SnN0oVJdNRCGsAfQufNWAU1RGuZf45mFXprCIY1GZ9QMAqapijp2F5DCWGVekTaoetGe 6sBQ/JmiPUdYIGYYGsnLwiMEtplLtDI2B0iMVNwQEt6rBACkeo2TuB/RtnjqEDkMZCtI Mgvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=RZeU/He+6khomoWAT8bo7Pq7shtJeaFymOMgng/v7Ac=; b=oEvxPWlj7nX3zf9mqjR5FIyw4QVVrms33z1SdCdusNLaU7YIYqeTJwddWnVOaRI/Go KEJBYTnDw558Eh2TElbLjV8+P47Z1UUoPoFVaEvoT8FGCggd7QDAI/+N/emm/36YfpLb k5cAPapzc+GS87W9JgdGmjIRDnUon62rLb3HpgOWFSWYSMce5fr9jUmiA4stx01saqgS jj1iuW3wzHhrDmhslOy9H0IDZg/ee34hygDiHvVAVgXswWUlJt/jdLX2+DqSz4uxZrKy Ap8q1XGs3gsST3RdtCt0bV/es00BVbErt9OB7iBpUy/sMi4PJYBSQmiZgtj+nxw3Q+ZW 6VLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eP5MFgGj; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a05651c050b00b0024f0c808b0asi5207713ljp.594.2022.04.28.08.42.58; Thu, 28 Apr 2022 08:43:39 -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=@redhat.com header.s=mimecast20190719 header.b=eP5MFgGj; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346867AbiD1NPs (ORCPT + 99 others); Thu, 28 Apr 2022 09:15:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344315AbiD1NPs (ORCPT ); Thu, 28 Apr 2022 09:15:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F3F591E3D5 for ; Thu, 28 Apr 2022 06:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651151545; h=from:from:reply-to:subject:subject: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=RZeU/He+6khomoWAT8bo7Pq7shtJeaFymOMgng/v7Ac=; b=eP5MFgGjWhox5OorwqNKWtMHzNaI2OTk4r+FW5zCd36fJpTaLA8tdzGIsT3mXx46Nz5dah VGR5StAJsrnlq2x+NwrawHsejSODx/5gi76V2jSPF97frMywt9Z8hMfomnYC2ZFdQmHAip 99J5XQq0uITKjeKF4wPlGxdzPtxjUK8= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-13-2KcMrbPPNpq2uinswfU3Tg-1; Thu, 28 Apr 2022 09:12:23 -0400 X-MC-Unique: 2KcMrbPPNpq2uinswfU3Tg-1 Received: by mail-qk1-f197.google.com with SMTP id q5-20020a05620a0d8500b004738c1b48beso3164650qkl.7 for ; Thu, 28 Apr 2022 06:12:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:organization:user-agent:mime-version :content-transfer-encoding; bh=RZeU/He+6khomoWAT8bo7Pq7shtJeaFymOMgng/v7Ac=; b=LLxatFA/fJ6JEJTsnDBlnRnwwNyO0dwvCCBMv8ZTvLJnNoy4ZrEKK4IF43JuLBtpJA 85QrWfNrpy8UEc4PBpMVlBL6z4G7vpHWrfMRHCUh3F4ouV+bN69XSEPMg84+4dXuk9mR 36VTO5UNfcXqFNtGFcOw+8Cl3w02kM6Y0Cz5Q1Zy1j/jg2f7CtoqLWYrTL3pxEW/7T8W WMsqeJwkK9Hyg7cpsVXXLr1A3yw1N/pReJGn9ERRRblliFgYxbkNwG7dFCMXdNqVF9aZ fTux0HEwBuCpmISvUzA9M+ZaGFcduu9DWuPi56dwDYNaIypHke0/X4VwFDHDdbpstKJO b9XQ== X-Gm-Message-State: AOAM532CttpdgF/Ri/WOmUXPzDB8BDB3mbFmgs9HhiPbk5+9UCTXf8iI SQW8uXbu6ueG5Y8dGCzNTqzPDYhVYK8tBdsLTV+j5FJ4GDVudvot5BICjZlQeS1B/QESM3CsWBc fKN4qTrRCDxuiR31GAvTe X-Received: by 2002:a37:9f14:0:b0:69f:9b05:cc81 with SMTP id i20-20020a379f14000000b0069f9b05cc81mr3834549qke.697.1651151543184; Thu, 28 Apr 2022 06:12:23 -0700 (PDT) X-Received: by 2002:a37:9f14:0:b0:69f:9b05:cc81 with SMTP id i20-20020a379f14000000b0069f9b05cc81mr3834518qke.697.1651151542901; Thu, 28 Apr 2022 06:12:22 -0700 (PDT) Received: from m8.users.ipa.redhat.com (cpe-158-222-141-151.nyc.res.rr.com. [158.222.141.151]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a0d5500b0069c59fae1a5sm9282786qkl.96.2022.04.28.06.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 06:12:22 -0700 (PDT) Message-ID: <089628513e1cadc0d711874d9ed2e70bb689e3f1.camel@redhat.com> Subject: Re: [PATCH RFC 4/5] net/tls: Add support for PF_TLSH (a TLS handshake listener) From: Simo Sorce To: Boris Pismenny , Chuck Lever Cc: ak@tempesta-tech.com, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nvme@lists.infradead.org, netdev@vger.kernel.org, Jakub Kicinski Date: Thu, 28 Apr 2022 09:12:20 -0400 In-Reply-To: <068945db-f29e-8586-0487-bb5be68c7ba8@gmail.com> References: <165030051838.5073.8699008789153780301.stgit@oracle-102.nfsv4.dev> <165030059051.5073.16723746870370826608.stgit@oracle-102.nfsv4.dev> <068945db-f29e-8586-0487-bb5be68c7ba8@gmail.com> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-3.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Thu, 2022-04-28 at 11:49 +0300, 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. > > 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? JFYI: For in kernel NFSD hadnshakes we also use the gssproxy unix socket in the kernel, which allows GSSAPI handshakes to be relayed from the kernel to a user space listening daemon. The infrastructure is technically already available and could be reasonably simply extended to do TLS negotiations as well. Not saying it is the best interface, but it is already available, and already used by NFS code. Simo. -- Simo Sorce RHEL Crypto Team Red Hat, Inc