Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3331304rwe; Sun, 16 Apr 2023 17:40:45 -0700 (PDT) X-Google-Smtp-Source: AKy350bHqAMLf1fihjEJwFFdVyLrUV+Ryd7IC/Pe6q4FQkDYi5KbNnZcWcx9ofVfZQCX7hN4DxlT X-Received: by 2002:a05:6a20:b555:b0:e7:568e:e31 with SMTP id ev21-20020a056a20b55500b000e7568e0e31mr12194309pzb.34.1681692045542; Sun, 16 Apr 2023 17:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681692045; cv=none; d=google.com; s=arc-20160816; b=GA9CwGXfuZ0CEOfqlB+mygx0F/hPWlcdVLJOROSRAjQvp/nspDhFnu3uoj2xuQEYWi xxcLyTd3t3Z09rMA4JsfmfKxwaI7uWBRnMzxhU12BSlpyPfWkTgGtvTyPX1I5DOH7J+A hxT6BSm0gg08KBLTz0QYkfTMFiRZXtydgBoFpAr7Jm+GgaZacuFlCGtW05axde+lz4Av zrjZa5tVAplBHtXDy++T60WFblBR9rwZ7JLIR4RG9azP4t8AYieefI4ifKJWkWsLUN6f nQtL/yOGL0/7v0pXTuiJVktgai6WZ6SpmH8NO64XwULPr194N0aAbtSEGApxmAQxgm9+ n1zg== 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=NbmzPpAlkufQTLDTk+D9czOx6NNKpLs+5+MMwX8guq0=; b=goR4Whar2nZpDfuwXZEuOBgsdpVJOYHW94bZ5kSDDu2Di+8RM0cxbBLOBcQcl5dbmp xIw54S2E9RaTur9+Qzvv06jVRPZpLRY0lojz7GzyOAQnB3Ewj1YBhzTaPtaUqawcaTEW SafKkwAduGCKZie9+G7uD7SncLCRDL3ZhCQXcGne5s9uCV0eTRf55pCdfjzYiogh2Tof LpbwzhyBYm2lip8zjkf3yD3useTplWFddhbY7c/9B6MQ1efHrGVFB3HqWe2PTgfTGZYU 4x3odWXwaiSD9BWCEjzvPkeNzlEjGa66xx5bozBdUScgYa4PvBOwsmp35yqkqeS5xAIb QC5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=nj9E0xMG; dkim=neutral (no key) header.i=@suse.de header.b=y+MMOT1M; 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 203-20020a6306d4000000b005193a2c7b24si10610663pgg.473.2023.04.16.17.40.26; Sun, 16 Apr 2023 17:40:45 -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=nj9E0xMG; dkim=neutral (no key) header.i=@suse.de header.b=y+MMOT1M; 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 S229498AbjDQAUO (ORCPT + 99 others); Sun, 16 Apr 2023 20:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjDQAUN (ORCPT ); Sun, 16 Apr 2023 20:20:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140EA1FEE for ; Sun, 16 Apr 2023 17:20:12 -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 685F51F390; Mon, 17 Apr 2023 00:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681690810; 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=NbmzPpAlkufQTLDTk+D9czOx6NNKpLs+5+MMwX8guq0=; b=nj9E0xMG6/rplsFlZ4l8HC2ECO+W2+N3V0DSd9xDO/HV79ZLXldE/VtG5WC4i3Y9CgGgF1 WYa6oHxl6/sZ3AzLNWxex5cbdi+p0JHUTC7ihPu5bbBz37Y/7aetYiWQ0I1CWhxQKkOCmA RtDAbs8VYPOkGUvqgDwoEhijDGL7FOM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681690810; 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=NbmzPpAlkufQTLDTk+D9czOx6NNKpLs+5+MMwX8guq0=; b=y+MMOT1Mf3em7s1dIDAAT0jeeO2Z/gsdT9/NTuLrJv+qoeg7YRAsxroGih1nq7Og70UNRg z7ZF2znrLY4xmhCQ== 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 A2F7513319; Mon, 17 Apr 2023 00:20:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aeRrFriQPGRVDgAAMHmgww (envelope-from ); Mon, 17 Apr 2023 00:20:08 +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: [PATCH nfs-utils] mountd: don't advertise krb5 for v4root when not configured. Date: Mon, 17 Apr 2023 10:20:05 +1000 Message-id: <168169080542.24821.1095959058130927513@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 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. 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..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; =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