Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp35703rwe; Tue, 18 Apr 2023 17:05:47 -0700 (PDT) X-Google-Smtp-Source: AKy350bLR+M5uzX/6VmeV1bouzFrWRjSLVDmRUPaqrUNm/Gxj7aJLadNaWkkKqa1iUN6q8Tf9B3O X-Received: by 2002:a17:903:3293:b0:1a2:58f1:5e1d with SMTP id jh19-20020a170903329300b001a258f15e1dmr3144103plb.36.1681862747297; Tue, 18 Apr 2023 17:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681862747; cv=none; d=google.com; s=arc-20160816; b=DEyk/4CQ1ZFWUf9BfPbjnZSE01uLY3+lJ+Yil2P1+yIaEpxFn6omPCESiOJYt0UvbT vLwZ42NnEvKC5+Kw6aDNbMyOBIARAlgik5Rx399QoG8EVQk4O4WI+MLJCkIZiss2u0JJ ASq+BNmkeLmLb1XKkgArsmNY6nhQoR0fgeh6gkA1qw+yWMkHN4zyzzAxzSPgzHQ1POYy DokmBhVSS9yrzczGrn/XPhIG7uneg88pGneF/Bx6XpTPwUFJkPpEW1NNSU1AdEjEyqYr y+pMtGN2W9N+r2yKv0DYu3yQGcR1q9BXx0MTdOoNA5bsY11ko4MnnTJrxLvmdp84EWG7 uhPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=0LbajA3vKXZ221CAVqqdef1AaReTmxB/P0kUvZqTCLA=; b=Y15UZxKl1PMkkOasZfu5f8u7S5aRg69sXFCCZb80CecSyelZchRVmGxqXu5HUIB+aP 1S3o7yYWlHRTi6kDaaA007SET4vhZUlOKUCdtpoiUDdbDgrUd2qp5bL/jKowJOVWSpPt f3F7+P/mGRNyIEHjmju1pzwaNxoKGyp+/U2R2HWeusfuD6R7NotTsCn7wtj1fRNBJK9y 1WM/3VXqm2vLD/aTCjio/pf3Q14WcMbVCtSuepzFR3x4IJ4nn7k42sp7LmtAeljnncAt 9EN5KjBER0BLD/dbT5eR30+FYpo5P9cXbsCvxcQhSCBXsmo6ovLj4VRiSf/uiVR+lrOC pk+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GW+Speys; dkim=neutral (no key) header.i=@suse.de header.b=+rZSzuDA; 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 l8-20020a170903120800b001a64e7b7026si16295427plh.438.2023.04.18.17.05.18; Tue, 18 Apr 2023 17:05:47 -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=GW+Speys; dkim=neutral (no key) header.i=@suse.de header.b=+rZSzuDA; 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 S231393AbjDRXyf (ORCPT + 99 others); Tue, 18 Apr 2023 19:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjDRXye (ORCPT ); Tue, 18 Apr 2023 19:54:34 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C007EC2 for ; Tue, 18 Apr 2023 16:54:28 -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-out1.suse.de (Postfix) with ESMTPS id 5E811219FC; Tue, 18 Apr 2023 23:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681862066; 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=0LbajA3vKXZ221CAVqqdef1AaReTmxB/P0kUvZqTCLA=; b=GW+Speys85/inA1Tt3S5SZMGHUtWjYcrcC4JDlLavm5m4kEkirUUskIx3UANz4ICYuyOS8 MopyZBDS69V8ZBh5Q27HUwXxHfEsZ9gEGMcuJIOQ5Xx3yWiEdzoiLzYr8nq457iPU6pWR7 tlOcKzmW2vR6CCII3xDWnaho58+6cC0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681862066; 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=0LbajA3vKXZ221CAVqqdef1AaReTmxB/P0kUvZqTCLA=; b=+rZSzuDAumG4RRbZY1NXWg+K+ne92dEZT9X7TF2Eold2RztFnxtvfHRhmY6qdhq4vl83fg Rfu8LUQ+SG1fnZDA== 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 99D16139CC; Tue, 18 Apr 2023 23:54:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HepeFLAtP2QobgAAMHmgww (envelope-from ); Tue, 18 Apr 2023 23:54:24 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Steve Dickson" Cc: "Petr Vorel" , "linux-nfs" , "Dave Jones" , bfields@redhat.com Subject: Re: [PATCH nfs-utils] mountd: don't advertise krb5 for v4root when not configured. In-reply-to: <168169080542.24821.1095959058130927513@noble.neil.brown.name> References: <168169080542.24821.1095959058130927513@noble.neil.brown.name> Date: Wed, 19 Apr 2023 09:54:21 +1000 Message-id: <168186206158.24821.3625716286887021869@noble.neil.brown.name> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Mon, 17 Apr 2023, NeilBrown wrote: > If /etc/krb5.keytab does not exist, then krb5 cannot work, so > advertising it as an option for v4root is pointless. > Since linux commit 676e4ebd5f2c ("NFSD: SECINFO doesn't handle > unsupported pseudoflavors correctly") this can result in an unhelpful > warning if the krb5 code is not built, or built as a module which is not > installed. >=20 > [ 161.668635] NFS: SECINFO: security flavor 390003 is not supported > [ 161.668655] NFS: SECINFO: security flavor 390004 is not supported > [ 161.668670] NFS: SECINFO: security flavor 390005 is not supported >=20 > So avoid advertising krb5 security options when krb5.keytab cannot be > found. >=20 > Link: https://lore.kernel.org/linux-nfs/20170104190327.v3wbpcbqtfa5jy7d@cod= emonkey.org.uk/ > Signed-off-by: NeilBrown > --- > support/export/v4root.c | 2 ++ > support/include/pseudoflavors.h | 1 + > support/nfs/exports.c | 14 +++++++------- > 3 files changed, 10 insertions(+), 7 deletions(-) >=20 > diff --git a/support/export/v4root.c b/support/export/v4root.c > index fbb0ad5f5b81..3e049582d7c1 100644 > --- a/support/export/v4root.c > +++ b/support/export/v4root.c > @@ -66,6 +66,8 @@ set_pseudofs_security(struct exportent *pseudo) > =20 > if (!flav->fnum) > continue; > + if (flav->need_krb5 && !access("/etc/krb5.keytab", F_OK)) > + continue; This is "obviously" wrong - thanks to Petr for testing more thoroughly than I did (hint: you need to "rmmod nfsd" or reboot between tests, as the messages are only reported once). access() returns 0 on success, negative on failure. It doesn't return bool like the above suggests. I will repost with a fixed version. NeilBrown > =20 > i =3D secinfo_addflavor(flav, pseudo); > new =3D &pseudo->e_secinfo[i]; > diff --git a/support/include/pseudoflavors.h b/support/include/pseudoflavor= s.h > index deb052b130e6..1f16f3f796f3 100644 > --- a/support/include/pseudoflavors.h > +++ b/support/include/pseudoflavors.h > @@ -8,6 +8,7 @@ > struct flav_info { > char *flavour; > int fnum; > + int need_krb5; > }; > =20 > extern struct flav_info flav_map[]; > diff --git a/support/nfs/exports.c b/support/nfs/exports.c > index 2c8f0752ad9d..010dfe423d6f 100644 > --- a/support/nfs/exports.c > +++ b/support/nfs/exports.c > @@ -36,13 +36,13 @@ > (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES|NFSEXP_NOSUBTR= EECHECK) > =20 > struct flav_info flav_map[] =3D { > - { "krb5", RPC_AUTH_GSS_KRB5 }, > - { "krb5i", RPC_AUTH_GSS_KRB5I }, > - { "krb5p", RPC_AUTH_GSS_KRB5P }, > - { "unix", AUTH_UNIX }, > - { "sys", AUTH_SYS }, > - { "null", AUTH_NULL }, > - { "none", AUTH_NONE }, > + { "krb5", RPC_AUTH_GSS_KRB5, 1}, > + { "krb5i", RPC_AUTH_GSS_KRB5I, 1}, > + { "krb5p", RPC_AUTH_GSS_KRB5P, 1}, > + { "unix", AUTH_UNIX, 0}, > + { "sys", AUTH_SYS, 0}, > + { "null", AUTH_NULL, 0}, > + { "none", AUTH_NONE, 0}, > }; > =20 > const int flav_map_size =3D sizeof(flav_map)/sizeof(flav_map[0]); > --=20 > 2.40.0 >=20 >=20