Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4890432pxv; Tue, 20 Jul 2021 13:50:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX7tJpvmhXRnI9DlyynVBOA8Fq1Ve2hi3TRZhUei4aqXN6vuNpkpVslLI5O5KJykPzra07 X-Received: by 2002:a17:906:6d0a:: with SMTP id m10mr35348697ejr.106.1626814245128; Tue, 20 Jul 2021 13:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626814245; cv=none; d=google.com; s=arc-20160816; b=Jt0olxTjb0y2jlm7fH/X31I3hUwF/+RuwiU9Gg0Yp+Xdtt6bHnKZ0CnPuu0Qg+l80S ZSX11pLzAUVwlB2dDmRsJgcZ5VfWTaTratt7P59hmuASFUJahP62I6Qbnvtedf6ZkEVB 7Y3j/jCZ1ht+hmH1zKhUjh18jLVzRugkRkpG6qzXpzl7xpHbWyG+xdnUaeR//iZv574X V/d/y8PIP9haFMWTPvqPSEo21nsPEkvh3shyHjh6uIhYWD9lO/YPbSq1OWEWibxCkPQW G1tmuiF5GKlTWpHqVyNSViE5UMhSKRGAGjW+//xI2G9IuL1zadPKBmiInNRMFxYgsUjM AxAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=10AX8/uYgF+VVMcAnoy9hmEtOYO4CmlhM+xO2pNsWH0=; b=V/+xlTeuhmAzPBlHLIzjoh+i8pAZywrR/e+bNfEOsyZYT3NZbeULeM3bANIr5gs06t 2aueqmse8CJ11LbhuO3+eiPfdDDSlguswQ4+18q6GhY50cvCOcb1rOOfDXjovQ/7kgrW z6gW9ta2CJpHhqk2irGp3vZlDCjKmkeui/k7f9z/XDlkVOVJmp7/bu/YFIbashhmOLmY x74d6/PwB+v3BCjQoEaSxo7sFHQAq4xQ1pEtDQMmH+5TVYGvmVclVbtqyTG0Sz8XCUKE EMtmShl/auv6kcYBdGHJtNW+6ucKsYl2xtSuNLQNoI2Z6VUER2nfdqzxKyFT4woMmEzx k6+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr3si25494782ejb.139.2021.07.20.13.50.19; Tue, 20 Jul 2021 13:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236630AbhGTUJE (ORCPT + 99 others); Tue, 20 Jul 2021 16:09:04 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:38157 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237286AbhGTTsx (ORCPT ); Tue, 20 Jul 2021 15:48:53 -0400 Received: from [192.168.0.113] ([178.252.67.224]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.163]) with ESMTPSA (Nemesis) id 1M6YEz-1m3SJE2PNp-0070ir; Tue, 20 Jul 2021 22:28:41 +0200 Subject: Re: [PATCH 06/11] nvme: Implement In-Band authentication To: Hannes Reinecke , Sagi Grimberg , Christoph Hellwig Cc: Keith Busch , linux-nvme@lists.infradead.org, Herbert Xu , "David S . Miller" , linux-crypto@vger.kernel.org References: <20210716110428.9727-1-hare@suse.de> <20210716110428.9727-7-hare@suse.de> From: Vladislav Bolkhovitin Message-ID: Date: Tue, 20 Jul 2021 23:28:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:PbE+rqglmpjeNnT05S+5EUIqm2w3pEbGcHIffWpSRXX9biz2QeV tyUB8AS6Qo55qo8uqL+5neAoyx0kl4F3UmzVph2ILPwNpFPn0VjNwYyIoz5/1Dt8xFXgonN 2eJvzYyQvpQ/1FVMyjYrmTAs1csH0ukTHK/n28AF12USDkhfH7DhVKWbtOxBL8UfwJoyPcS AZxLVpm0hqpr96iosFLjg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9Mgyzmns+BA=:iubR+6YagoGNIqn9YX1i2M g5kcs/ivnzTG88BCmuhVAbgXGL1XZsCdN2brkgZQ4WZGYJWivoQB4r66CkhvIZUW4QhD5uxMz hRUgUXg5cdqR9MHXse/8HSMDle+iiYrVYt7iE7jIBsEszu1O1QxO+fwXDhJLxJXDjcEyvqkgb dh6HcshaaUNE3pSBLHG6oudBeMJv0RQxfgwl9jA2vYvQddB911nURptWKOIlM4zT72/8Ncoh1 LcCmC7YPCZyVN3z22fuLe/97QJAYY6Gc80fH5X2r4hV22CPIFl1/q0oVfmfbe7t8T49tGk8J4 hhze9qKix37cXVKsdyEuzAIeLmzfPW4UdXIbiVmE0B9AVaB2Q1o9BxCgIuw+utWIjnqAB8Lln yFpbdf2IG+x4Oy8NB0uYgk59TXqaxW2icuaB4Ldas+t5fS/WYmOuwvk+eaJfS3pjY4m3lyMqP 2WyOkcund5irMV/dqpkbvWfOckEqrR1kcQtCu6a3vjhAk9dYY53MwE5oMSBTvTGiXRjY6vOlb XkoNFCP2LofC842BjZuHqO8j0WCZuj7MOCJ0fAkcH1u+FRhB1VGYoyA217CCLRmDGcX8AdEuX L3pnZpSUQvHt+iASgepTP1ESghteGyzTl7Afp2gTprRkDqe60qk2j2vov84bYho+A7MP7tG66 J2EKPpUXMF61RzTWbj2v32q5F52txiS4mUXRkjF+uLdu/VUbgzMoq2//clb4C2XKgFjMB1F8+ fKXCG8119kWQTz9ts+6gT/bZ+3yUHOmr4XUVaJH274qrsVbKaxEZ5ajwDiqeP0kEeBuZiYsTL dRrp9v0kPMzGnIEWOg7trNguI+fQ3TNTvuozpwhA3UfmlRc/DdaaXwh36fy8obUsvbuuXiw Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 7/18/21 3:21 PM, Hannes Reinecke wrote: > On 7/17/21 9:22 AM, Sagi Grimberg wrote: >>> Implement NVMe-oF In-Band authentication. This patch adds two new >>> fabric options 'dhchap_key' to specify the PSK >> >> pre-shared-key. >> >> Also, we need a sysfs knob to rotate the key that will trigger >> re-authentication or even a simple controller(s-plural) reset, so this >> should go beyond just the connection string. >> > > Yeah, re-authentication currently is not implemented. I first wanted to > get this patchset out such that we can settle on the userspace interface > (both from host and target). > I'll have to think on how we should handle authentication; one of the > really interesting cases would be when one malicious admin will _just_ > send a 'negotiate' command to the controller. As per spec the controller > will be waiting for an 'authentication receive' command to send a > 'challenge' payload back to the host. But that will never come, so as it > stands currently the controller is required to abort the connection. > Not very nice. Yes, in this case after some reasonable timeout (I would suggest 10-15 seconds) the controller expected to abort connection and clean up all allocated resources. To handle DoS possibility to make too many such "orphan" negotiations, hence consume all controller memory, some additional handling is needed. For simplicity as a first step I would suggest to have a global limit on number of currently being authenticated connections. [...] >>> +    chap->key = nvme_auth_extract_secret(ctrl->opts->dhchap_secret, >>> +                         &chap->key_len); >>> +    if (IS_ERR(chap->key)) { >>> +        ret = PTR_ERR(chap->key); >>> +        chap->key = NULL; >>> +        return ret; >>> +    } >>> + >>> +    if (key_hash == 0) >>> +        return 0; >>> + >>> +    hmac_name = nvme_auth_hmac_name(key_hash); >>> +    if (!hmac_name) { >>> +        pr_debug("Invalid key hash id %d\n", key_hash); >>> +        return -EKEYREJECTED; >>> +    } >> >> Why does the user influence the hmac used? isn't that is driven >> by the susbsystem? >> >> I don't think that the user should choose in this level. >> > > That is another weirdness of the spec. > The _secret_ will be hashed with a specific function, and that function > is stated in the transport representation. > (Cf section "DH-HMAC-CHAP Security Requirements"). > This is _not_ the hash function used by the authentication itself, which > will be selected by the protocol. > So it's not the user here, but rather the transport specification of the > key which selects the hash algorithm. Yes, good catch. It looks as a minor errata material to specify that hash function here is implementation specific. I would suggest to just hardcode SHA512 here. Users don't have to be confused by this. Vlad