public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: =carnil@debian.org, linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH RFC 1/4] gssd: remove the limit-to-legacy-enctypes option
Date: Fri, 13 Feb 2026 17:40:09 -0500	[thread overview]
Message-ID: <20260213224012.2608126-2-smayhew@redhat.com> (raw)
In-Reply-To: <20260213224012.2608126-1-smayhew@redhat.com>

This option allowed the admin to restrict the client to using single-DES
encryption types, which were deprecated by RFC 6649 in July 2012.
Support for single-DES encryption types was removed from the MIT KRB5
library in May 2019, and from kernel's RPCSEC_GSS KRB5 mechanism in June
2023.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 nfs.conf               |  1 -
 systemd/nfs.conf.man   |  2 +-
 utils/gssd/gssd.c      | 13 +------------
 utils/gssd/gssd.man    | 30 +++++-------------------------
 utils/gssd/krb5_util.c | 38 ++++++++++++++++----------------------
 utils/gssd/krb5_util.h |  1 -
 6 files changed, 23 insertions(+), 62 deletions(-)

diff --git a/nfs.conf b/nfs.conf
index 3cca68c3..222447dd 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -22,7 +22,6 @@
 # use-machine-creds=1
 # use-gss-proxy=0
 # avoid-dns=1
-# limit-to-legacy-enctypes=0
 # allowed-enctypes=aes256-cts-hmac-sha384-192,aes128-cts-hmac-sha256-128,camellia256-cts-cmac,camellia128-cts-cmac,aes256-cts-hmac-sha1-96,aes128-cts-hmac-sha1-96
 # context-timeout=0
 # rpc-timeout=5
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index ecdc4fc9..80c4f34e 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -266,7 +266,7 @@ Recognized values:
 .BR use-machine-creds ,
 .BR use-gss-proxy ,
 .BR avoid-dns ,
-.BR limit-to-legacy-enctypes ,
+.BR allowed-enctypes ,
 .BR context-timeout ,
 .BR rpc-timeout ,
 .BR keytab-file ,
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 01ce7d18..8a894b2e 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -1034,10 +1034,6 @@ read_gss_conf(void)
 	root_uses_machine_creds = conf_get_bool("gssd", "use-machine-creds",
 						root_uses_machine_creds);
 	avoid_dns = conf_get_bool("gssd", "avoid-dns", avoid_dns);
-#ifdef HAVE_SET_ALLOWABLE_ENCTYPES
-	limit_to_legacy_enctypes = conf_get_bool("gssd", "limit-to-legacy-enctypes",
-						 limit_to_legacy_enctypes);
-#endif
 	context_timeout = conf_get_num("gssd", "context-timeout", context_timeout);
 	rpc_timeout = conf_get_num("gssd", "rpc-timeout", rpc_timeout);
 	upcall_timeout = conf_get_num("gssd", "upcall-timeout", upcall_timeout);
@@ -1084,7 +1080,7 @@ main(int argc, char *argv[])
 	verbosity = conf_get_num("gssd", "verbosity", verbosity);
 	rpc_verbosity = conf_get_num("gssd", "rpc-verbosity", rpc_verbosity);
 
-	while ((opt = getopt(argc, argv, "HDfvrlmnMp:k:d:t:T:R:U:C")) != -1) {
+	while ((opt = getopt(argc, argv, "HDfvrmnMp:k:d:t:T:R:U:C")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
@@ -1123,13 +1119,6 @@ main(int argc, char *argv[])
 			case 'R':
 				preferred_realm = strdup(optarg);
 				break;
-			case 'l':
-#ifdef HAVE_SET_ALLOWABLE_ENCTYPES
-				limit_to_legacy_enctypes = 1;
-#else 
-				errx(1, "Encryption type limits not supported by Kerberos libraries.");
-#endif
-				break;
 			case 'D':
 				avoid_dns = false;
 				break;
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
index f81b24cd..57ad30cf 100644
--- a/utils/gssd/gssd.man
+++ b/utils/gssd/gssd.man
@@ -165,23 +165,15 @@ no keytab), NFSv4 operations that require machine credentials will fail.
 A realm administrator can choose to add keys encoded in a number of different
 encryption types to the local system's keytab.
 For instance, a host/ principal might have keys for the
-.BR aes256-cts-hmac-sha1-96 ,
-.BR aes128-cts-hmac-sha1-96 ,
-.BR des3-cbc-sha1 ", and"
-.BR arcfour-hmac " encryption types."
+.BR aes256-cts-hmac-sha384-192 ,
+.BR aes128-cts-hmac-sha256-128 ,
+.BR aes256-cts-hmac-sha1-96 ", and"
+.BR aes128-cts-hmac-sha1-96 " encryption types."
 This permits
 .B rpc.gssd
 to choose an appropriate encryption type that the target NFS server
 supports.
-.P
-These encryption types are stronger than legacy single-DES encryption types.
-To interoperate in environments where servers support
-only weak encryption types,
-you can restrict your client to use only single-DES encryption types
-by specifying the
-.B -l
-option when starting
-.BR rpc.gssd .
+
 .SH OPTIONS
 .TP
 .B \-D
@@ -225,14 +217,6 @@ to obtain machine credentials.
 The default value is
 .IR /etc/krb5.keytab .
 .TP
-.B -l
-When specified, restricts
-.B rpc.gssd
-to sessions to weak encryption types such as
-.BR des-cbc-crc .
-This option is available only when the local system's Kerberos library
-supports settable encryption types.
-.TP
 .BI "-p " path
 Tells
 .B rpc.gssd
@@ -342,10 +326,6 @@ is equivalent to providing the
 .B -D
 flag.
 .TP
-.B limit-to-legacy-enctypes
-Equivalent to
-.BR -l .
-.TP
 .B allowed-enctypes
 Allows you to restrict
 .B rpc.gssd
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 137cffda..9c1016b3 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -155,7 +155,6 @@ static struct gssd_k5_kt_princ *gssd_k5_kt_princ_list = NULL;
 static pthread_mutex_t ple_lock = PTHREAD_MUTEX_INITIALIZER;
 
 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
-int limit_to_legacy_enctypes = 0;
 krb5_enctype *allowed_enctypes = NULL;
 int num_allowed_enctypes = 0;
 #endif
@@ -1661,10 +1660,6 @@ int
 limit_krb5_enctypes(struct rpc_gss_sec *sec)
 {
 	u_int maj_stat, min_stat;
-	krb5_enctype enctypes[] = { ENCTYPE_DES_CBC_CRC,
-				    ENCTYPE_DES_CBC_MD5,
-				    ENCTYPE_DES_CBC_MD4 };
-	int num_enctypes = sizeof(enctypes) / sizeof(enctypes[0]);
 	extern int num_krb5_enctypes;
 	extern krb5_enctype *krb5_enctypes;
 	extern int num_allowed_enctypes;
@@ -1679,26 +1674,25 @@ limit_krb5_enctypes(struct rpc_gss_sec *sec)
 			return -1;
 	}
 
-	/*
-	 * If we failed for any reason to produce global
-	 * list of supported enctypes, use local default here.
-	 */
-	if (krb5_enctypes == NULL || limit_to_legacy_enctypes ||
-			allowed_enctypes) {
-		if (allowed_enctypes) {
-			printerr(2, "%s: using allowed enctypes from config\n",
-				 __func__);
-			num_set_enctypes = num_allowed_enctypes;
-			set_enctypes = allowed_enctypes;
-		} else {
-			printerr(2, "%s: using legacy enctypes\n", __func__);
-			num_set_enctypes = num_enctypes;
-			set_enctypes = enctypes;
-		}
-	} else {
+	if (allowed_enctypes) {
+		printerr(2, "%s: using allowed enctypes from config\n",
+			 __func__);
+		num_set_enctypes = num_allowed_enctypes;
+		set_enctypes = allowed_enctypes;
+	} else if (krb5_enctypes) {
 		printerr(2, "%s: using enctypes from the kernel\n", __func__);
 		num_set_enctypes = num_krb5_enctypes;
 		set_enctypes = krb5_enctypes;
+	} else {
+		/*
+		 * If we didn't get a list of enctypes from the kernel, that
+		 * would mean it did a v0 upcall which is for older gssd's.
+		 * That would indicate a serious problem, so we shouldn't
+		 * continue.
+		 */
+		printerr(0, "%s: no enctypes received from the kernel, and "
+			 "allowed-enctypes not set in the config\n", __func__);
+		return -1;
 	}
 
 	maj_stat = gss_set_allowable_enctypes(&min_stat, sec->cred,
diff --git a/utils/gssd/krb5_util.h b/utils/gssd/krb5_util.h
index 40ad3233..af5f30be 100644
--- a/utils/gssd/krb5_util.h
+++ b/utils/gssd/krb5_util.h
@@ -25,7 +25,6 @@ int gssd_acquire_user_cred(gss_cred_id_t *gss_cred);
 int gssd_k5_remove_bad_service_cred(char *srvname);
 
 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
-extern int limit_to_legacy_enctypes;
 int limit_krb5_enctypes(struct rpc_gss_sec *sec);
 int get_allowed_enctypes(void);
 #endif
-- 
2.52.0


  reply	other threads:[~2026-02-13 22:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 22:40 [nfs-utils PATCH RFC 0/4] Rework the handling of encryption types in rpc.gssd Scott Mayhew
2026-02-13 22:40 ` Scott Mayhew [this message]
2026-02-13 22:40 ` [nfs-utils PATCH RFC 2/4] gssd: add enctypes_list_to_string() Scott Mayhew
2026-02-13 22:40 ` [nfs-utils PATCH RFC 3/4] gssd: get the permitted enctypes from the krb5 library on startup Scott Mayhew
2026-02-13 22:40 ` [nfs-utils PATCH RFC 4/4] gssd: add a helper to determine the set of encryption types to pass to limit_krb5_enctypes() Scott Mayhew
2026-02-28 17:14 ` [nfs-utils PATCH RFC 0/4] Rework the handling of encryption types in rpc.gssd Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260213224012.2608126-2-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc==carnil@debian.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox