Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp38028rwe; Tue, 18 Apr 2023 17:07:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZRxXczeY+p/0pm2IYU9bszUZAO+gjLrC89iAbtSy2BkM264wG0Byn6/AG7XfUQoYtnWtRk X-Received: by 2002:a17:903:1c5:b0:19e:ecaf:c4b4 with SMTP id e5-20020a17090301c500b0019eecafc4b4mr4640121plh.4.1681862874712; Tue, 18 Apr 2023 17:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681862874; cv=none; d=google.com; s=arc-20160816; b=DmdCLD+4v+wEGpMA9LiRwZKHAplItuGAlxj0DUIj6QUDK+d6NeBiqUbA2pgZN9rFmY n817/w4GE1StuCwGcE/vfoRpIXawDp0APY+phOHykbLDHtvluxsOWRfaiqc55k8ualcu EYC9GJttDnXCTQ8JXCy71PPTwZaHXcFhpZrDBahrnffM/r/TGpU+3jbEyNXa3Dtl9/t9 wKEaibyiumR1oC/QJonq3TZp6YHavOCLrXnHKzWOkdP4eYD31qct3vKgNN4Mn2EIqm4I dp6UfnUVn8+IQRA8fsIBSkiBmeO/+R958SB5KQT1m1KJzrMIbaDn8EGHHlNiNhAgtQux RJ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=Mf2HAOM5KmRtIP/VLefkHfomNEDVrpzZoJiwtt2EBFU=; b=IYGBEXL2bnuUd69nzD6keHsBG0aeZZnbfHrx/3wQTmloaxVTHq/uDKv2uAGFixjtkn 1LIXGUDo61KKdYWiYQKa/GCYQ5IJnKctOn8XP8s0P1OuzV6vw1ZzYwdWqYe/xfXWLSYW DiT3rK5ark1HwrHwonJLTCOYnotdBkwrAma2u90TncU5OhxlL9+7k6UlQ0SOLk+FuLHt I/Ug38prv588B8EN0or/B0iMUJhiwfhLiN96NDV2e28MePcvSKq8/V5dGcQs+vSnt3OP HA7W1hiIoTrSINr2NgXFGN6SkVMVQIbPforTo58/cVjBa9TO98qhbvqIOueh6SA9OhFv I2WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=IZnLhVWh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=VTrFPFS5; 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 ji5-20020a170903324500b001a5089fe47fsi14217314plb.326.2023.04.18.17.07.10; Tue, 18 Apr 2023 17:07:54 -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=IZnLhVWh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=VTrFPFS5; 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 S229879AbjDRX55 (ORCPT + 99 others); Tue, 18 Apr 2023 19:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjDRX55 (ORCPT ); Tue, 18 Apr 2023 19:57:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC446449F for ; Tue, 18 Apr 2023 16:57:55 -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 961CC1FD77; Tue, 18 Apr 2023 23:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681862274; 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; bh=Mf2HAOM5KmRtIP/VLefkHfomNEDVrpzZoJiwtt2EBFU=; b=IZnLhVWhoZzK/MO/l4BFyuP/Rd9TF3CXOMVdUSibkW66WKs9bB3hKZPbadn86BCAqjn31D uL+tjZXzXirZzwVu3BII4Mv2cfvGTtYOJhVeA2UkVgezlY/juO94nlSy74gRhrESuB6/9a pe29JOqRqcairxKQOrOvm4MCUq9eizY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681862274; 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; bh=Mf2HAOM5KmRtIP/VLefkHfomNEDVrpzZoJiwtt2EBFU=; b=VTrFPFS5y9WpYR4GXgAWkRmpgAxly7J78fZnlZGZIBl23LRRKKFGi/3GELCkITkPrQKEit wtGi7rIsGIj60hAw== 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 F200613413; Tue, 18 Apr 2023 23:57:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id BonMJ4AuP2SjbwAAMHmgww (envelope-from ); Tue, 18 Apr 2023 23:57:52 +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 , Bruce Fields Subject: [nfs-utils PATCH v2] mountd: don't advertise krb5 for v4root when not configured. Date: Wed, 19 Apr 2023 09:57:49 +1000 Message-id: <168186226971.24821.9774040849376889413@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 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. [ 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 So avoid advertising krb5 security options when krb5.keytab cannot be found. Note that testing for /etc/krb5.keytab is what we already do in a couple of systemd unit file to determine if krb5 is enabled. Link: https://lore.kernel.org/linux-nfs/20170104190327.v3wbpcbqtfa5jy7d@codem= onkey.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(-) diff --git a/support/export/v4root.c b/support/export/v4root.c index fbb0ad5f5b81..03805dcb4e6d 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) !=3D 0) + continue; =20 i =3D secinfo_addflavor(flav, pseudo); new =3D &pseudo->e_secinfo[i]; diff --git a/support/include/pseudoflavors.h b/support/include/pseudoflavors.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_NOSUBTREE= CHECK) =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