Skip to contentSkip to conversation

Rework the handling of encryption types in rpc.gssd

RFC PATCH In review Scott Mayhew 2 participants 6 messages Feb 13 – Feb 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Rework the handling of encryption types in rpc.gssd

These patches address the issue described in "nfs: ls input/output error ("NFS: readdir(/) returns -5") on krb5 NFSv4 client using SHA2"
(https://bugs.debian.org/1120598).

The core issue is that when the krb5 library does a TGS request, it initially does so with referrals enabled, disregarding the enctypes list supplied by the requesting application. It still checks the resulting ticket to ensure that it's using one of the requested enctypes, but it may not the highest priority enctype from our list. See make_request_for_service(), step_referrals(), and wrong_enctype() in the krb5 code.

The problem arises if it does this when setting up the machine credential, but it doesn't do it when setting up a user's credential (which can happen in the case of constrained-delegation via gssproxy).

That can lead to the machine credential and the user credentials using different enctypes, leading to XDR decoding failures described in the above bug.

These patches aim to address that issue by making sure that the list we pass to limit_krb5_enctypes is in the same order as the default list in the krb5 library.

Scott Mayhew (4):
gssd: remove the limit-to-legacy-enctypes option
gssd: add enctypes_list_to_string()
gssd: get the permitted enctypes from the krb5 library on startup
gssd: add a helper to determine the set of encryption types to pass to
limit_krb5_enctypes()

 nfs.conf               |   1 -
 systemd/nfs.conf.man   |   2 +-
 utils/gssd/gssd.c      |  16 +--
 utils/gssd/gssd.man    |  30 +---
 utils/gssd/gssd_proc.c |  15 ++
 utils/gssd/krb5_util.c | 311 +++++++++++++++++++++++++++++++++--------
 utils/gssd/krb5_util.h |   5 +-
 7 files changed, 284 insertions(+), 96 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

RFC PATCH 1/4 gssd: remove the limit-to-legacy-enctypes option

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.

---
 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(-)
nfs.conf +0 -1
index 3cca68c3..222447dd 100644
@@ -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
systemd/nfs.conf.man +1 -1
index ecdc4fc9..80c4f34e 100644
@@ -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 ,
utils/gssd/gssd.c +1 -12
index 01ce7d18..8a894b2e 100644
@@ -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;
utils/gssd/gssd.man +5 -25
index f81b24cd..57ad30cf 100644
@@ -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
utils/gssd/krb5_util.c +16 -22
index 137cffda..9c1016b3 100644
@@ -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,
utils/gssd/krb5_util.h +0 -1
index 40ad3233..af5f30be 100644
@@ -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
Signature · 1 line
2.52.0
#2 lore raw

RFC PATCH 2/4 gssd: add enctypes_list_to_string()

In reply to Scott Mayhew

Add enctypes_list_to_string() to produce a human-friendly string that can be used in debug messages. The logic was mostly factored out of get_allowed_enctypes().

---
 utils/gssd/gssd_proc.c | 15 +++++++
 utils/gssd/krb5_util.c | 94 +++++++++++++++++++++++++++++-------------
 utils/gssd/krb5_util.h |  3 ++
 3 files changed, 83 insertions(+), 29 deletions(-)
utils/gssd/gssd_proc.c +15 -0
index 01331485..e060bee3 100644
@@ -91,6 +91,7 @@ extern TAILQ_HEAD(active_thread_list_head, upcall_thread_info) active_thread_lis
 /* Encryption types supported by the kernel rpcsec_gss code */
 int num_krb5_enctypes = 0;
 krb5_enctype *krb5_enctypes = NULL;
+char *krb5_enctypes_string = NULL;
 
 /* Args for the cleanup_handler() */
 struct cleanup_args  {
@@ -121,6 +122,8 @@ parse_enctypes(char *enctypes)
 		free(krb5_enctypes);
 		krb5_enctypes = NULL;
 		num_krb5_enctypes = 0;
+		free(krb5_enctypes_string);
+		krb5_enctypes_string = NULL;
 	}
 
 	/* count the number of commas */
@@ -156,6 +159,18 @@ parse_enctypes(char *enctypes)
 	if ((cached_types = malloc(strlen(enctypes)+1)))
 		strcpy(cached_types, enctypes);
 
+	if (num_krb5_enctypes > 0) {
+		if (enctypes_list_to_string(krb5_enctypes, num_krb5_enctypes,
+					    &krb5_enctypes_string) != 0) {
+			printerr(2, "%s: warning: enctypes_list_to_string() failed\n",
+				 __func__);
+			goto out;
+		}
+		printerr(2, "kernel supported enctypes: %s\n",
+			 krb5_enctypes_string);
+	}
+
+out:
 	return 0;
 }
 
utils/gssd/krb5_util.c +65 -29

143 lines not on this page · raw message

utils/gssd/krb5_util.h +3 -0
index af5f30be..a8e17ea2 100644
@@ -24,6 +24,9 @@ void gssd_k5_get_default_realm(char **def_realm);
 int gssd_acquire_user_cred(gss_cred_id_t *gss_cred);
 int gssd_k5_remove_bad_service_cred(char *srvname);
 
+int enctypes_list_to_string(krb5_enctype *enctypes, int num_enctypes,
+			    char **enctype_string);
+
 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
 int limit_krb5_enctypes(struct rpc_gss_sec *sec);
 int get_allowed_enctypes(void);
Signature · 1 line
2.52.0
#3 lore raw

RFC PATCH 3/4 gssd: get the permitted enctypes from the krb5 library on startup

In reply to Scott Mayhew

This will allow us to cross-reference the list of encryption types sent in the upcall from the kernel as well as the list of encryption types enabled via the allowed-enctypes option from nfs.conf with the list permitted by the krb5 library.

---
 utils/gssd/gssd.c      |  3 +++
 utils/gssd/krb5_util.c | 55 ++++++++++++++++++++++++++++++++++++++++++
 utils/gssd/krb5_util.h |  1 +
 3 files changed, 59 insertions(+)
utils/gssd/gssd.c +3 -0
index 8a894b2e..1c901991 100644
@@ -1222,6 +1222,9 @@ main(int argc, char *argv[])
 	daemon_init(fg);
 
 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
+	rc = get_krb5_library_permitted_enctypes();
+	if (rc)
+		exit(EXIT_FAILURE);
 	rc = get_allowed_enctypes();
 	if (rc)
 		exit(EXIT_FAILURE);
utils/gssd/krb5_util.c +55 -0

70 lines not on this page · raw message

utils/gssd/krb5_util.h +1 -0
index a8e17ea2..e9d08567 100644
@@ -30,6 +30,7 @@ int enctypes_list_to_string(krb5_enctype *enctypes, int num_enctypes,
 #ifdef HAVE_SET_ALLOWABLE_ENCTYPES
 int limit_krb5_enctypes(struct rpc_gss_sec *sec);
 int get_allowed_enctypes(void);
+int get_krb5_library_permitted_enctypes(void);
 #endif
 
 /*
Signature · 1 line
2.52.0
#4 lore raw

RFC PATCH 4/4 gssd: add a helper to determine the set of encryption types to pass to limit_krb5_enctypes()

In reply to Scott Mayhew

When the MIT kerberos library does a TGS request it initially does so with referrals enabled, using its default enctype list instead of the application-provided one. It still ensures that the resulting ticket is using an enctype from the application-provided list, it just might not be the highest priority enctype from the application-provided list.

That can result in the machine cred's service ticket using a different enctype than a user cred's service ticket (particularly in the case of contrained delegation with gssproxy), which will lead to XDR decoding failures in the kernel. See https://bugs.debian.org/1120598.

The best way to combat this to configure the krb5 library's permitted_enctypes list to have the same order as the kernel's gss_krb5_prepare_enctype_priority_list (which is set at build time), but not all distros do that. The second best way is to make sure our list is ordered according to the krb5 library's list, which can be accomplished via the helper function added by this patch.

The list will be the intersection of:

1. allowed_enctypes - If allowed-enctypes is defined in nfs.conf, this is processed via get_allowed_enctypes() during gssd startup.
2. krb5_enctypes - This is the list of enctypes passed in the upcall from the kernel, and is processed via handle_gssd_upcall() -> parse_enctypes().
3. lib_enctypes - Processed via get_krb5_library_permitted_enctypes() during gssd startup.

---
 utils/gssd/krb5_util.c | 172 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 143 insertions(+), 29 deletions(-)
utils/gssd/krb5_util.c +143 -29
index bc07f852..bc063a8b 100644
@@ -164,6 +164,14 @@ char *allowed_enctypes_string = NULL;
 int num_lib_enctypes = 0;
 krb5_enctype *lib_enctypes = NULL;
 char *lib_enctypes_string = NULL;
+
+/*
+ * The final set of encryption types that will be used in
+ * limit_krb5_enctypes().  See determine_enctypes() below.
+ */
+int num_set_enctypes = 0;
+krb5_enctype *set_enctypes = NULL;
+char *set_enctypes_string = NULL;
 #endif
 
 /*==========================*/
@@ -1731,6 +1739,128 @@ out:
 	return ret;
 }
 
+/*
+ * Helper to determine the final set of enctypes that will be passed to
+ * gss_set_allowable_enctypes() in limit_krb5_enctypes().
+ *
+ * It will be the intersection of:
+ *
+ * 1. allowed_enctypes - If allowed-enctypes is defined in nfs.conf, this is
+ *    processed via get_allowed_enctypes() during gssd startup.
+ * 2. krb5_enctypes - This is the list of enctypes passed in the upcall from
+ *    the kernel, and is processed via handle_gssd_upcall() -> parse_enctypes().
+ * 3. lib_enctypes - Processed via get_krb5_library_permitted_enctypes() during
+ *    gssd startup.
+ *
+ * It will be ordered according to lib_enctypes.  This is necessary because when
+ * the MIT kerberos library does a TGS request it initially does so with
+ * referrals enabled, using its default enctype list instead of the application-
+ * provided one.  It still ensures that the resulting ticket is using an enctype
+ * from the application-provided list, it just might not be the highest priority
+ * enctype from the application-provided list.
+ *
+ * That can result in the machine cred's service ticket using a different
+ * enctype than a user cred's service ticket (particularly in the case of
+ * contrained delegation with gssproxy), which will lead to XDR decoding
+ * failures in the kernel.
+ *
+ * The best way to combat this to configure the krb5 library's
+ * permitted_enctypes list to have the same order as the kernel's
+ * gss_krb5_prepare_enctype_priority_list (which is set at build time), but not
+ * all distros do that.  The second best way is to make sure our list is ordered
+ * according to the krb5 library's list, hence this helper function.
+ */
+static int
+determine_enctypes(krb5_enctype **set_enctypes, int *num_set_enctypes,
+		   char **set_enctypes_string)
+{
+	extern int num_allowed_enctypes, num_krb5_enctypes, num_lib_enctypes;
+	extern krb5_enctype *allowed_enctypes, *krb5_enctypes, *lib_enctypes;
+	extern char *allowed_enctypes_string, *krb5_enctypes_string,
+	       *lib_enctypes_string;
+	krb5_enctype *enctypes;
+	int num_enctypes = 0;
+	char *enctypes_string;
+	int i, j, k;
+
+	if (krb5_enctypes) {
+		printerr(2, "%s: kernel enctypes: %s\n",
+			 __func__, krb5_enctypes_string);
+	} else {
+		printerr(2, "%s: kernel enctype list is empty\n",
+			 __func__);
+		return -1;
+	}
+
+	if (lib_enctypes) {
+		printerr(2, "%s: krb5 library enctypes: %s\n",
+			 __func__, lib_enctypes_string);
+	} else {
+		printerr(2, "%s: krb5 library enctype list is empty\n",
+			 __func__);
+		return -1;
+	}
+
+	if (allowed_enctypes) {
+		printerr(2, "%s: config allowed enctypes: %s\n",
+			 __func__, allowed_enctypes_string);
+	}
+
+	if (allowed_enctypes) {
+		enctypes = (krb5_enctype *) calloc(num_allowed_enctypes,
+						   sizeof(krb5_enctype));
+		if (enctypes == NULL)
+			return ENOMEM;
+		for (i = 0; i < num_lib_enctypes; i++) {
+			for (j = 0; j < num_krb5_enctypes; j++) {
+				if (lib_enctypes[i] == krb5_enctypes[j]) {
+					for (k = 0; k < num_allowed_enctypes; k++) {
+						if (lib_enctypes[i] == allowed_enctypes[k]) {
+							enctypes[num_enctypes++] = lib_enctypes[i];
+							break;
+						}
+					}
+					break;
+				}
+			}
+		}
+	} else {
+		enctypes = (krb5_enctype *) calloc(num_krb5_enctypes,
+						   sizeof(krb5_enctype));
+		if (enctypes == NULL)
+			return ENOMEM;
+		for (i = 0; i < num_lib_enctypes; i++) {
+			for (j = 0; j < num_krb5_enctypes; j++) {
+				if (lib_enctypes[i] == krb5_enctypes[j]) {
+					enctypes[num_enctypes++] = lib_enctypes[i];
+					break;
+				}
+			}
+		}
+	}
+
+	if (num_enctypes > 0) {
+		if (enctypes_list_to_string(enctypes, num_enctypes,
+					    &enctypes_string) != 0) {
+			printerr(2, "%s: warning: enctypes_list_to_string() failed\n",
+				 __func__);
+			return -1;
+		}
+		printerr(2, "%s: result enctypes: %s\n",
+			 __func__, enctypes_string);
+	} else {
+		printerr(2, "%s: no result enctypes\n",
+			 __func__);
+		free(enctypes);
+		return -1;
+	}
+
+	*set_enctypes = enctypes;
+	*num_set_enctypes = num_enctypes;
+	*set_enctypes_string = enctypes_string;
+	return 0;
+}
+
 /*
  * this routine obtains a credentials handle via gss_acquire_cred()
  * then calls gss_krb5_set_allowable_enctypes() to limit the encryption
@@ -1743,19 +1873,13 @@ out:
  *	0 => all went well
  *     -1 => there was an error
  */
-
 int
 limit_krb5_enctypes(struct rpc_gss_sec *sec)
 {
 	u_int maj_stat, min_stat;
-	extern int num_krb5_enctypes;
-	extern krb5_enctype *krb5_enctypes;
-	extern char *krb5_enctypes_string;
-	extern int num_allowed_enctypes;
-	extern krb5_enctype *allowed_enctypes;
-	extern char *allowed_enctypes_string;
-	int num_set_enctypes;
-	krb5_enctype *set_enctypes;
+	extern int num_set_enctypes;
+	extern krb5_enctype *set_enctypes;
+	extern char *set_enctypes_string;
 	int err = -1;
 
 	if (sec->cred == GSS_C_NO_CREDENTIAL) {
@@ -1764,28 +1888,18 @@ limit_krb5_enctypes(struct rpc_gss_sec *sec)
 			return -1;
 	}
 
-	if (allowed_enctypes) {
-		printerr(2, "%s: using allowed enctypes from config: %s\n",
-			 __func__, allowed_enctypes_string);
-		num_set_enctypes = num_allowed_enctypes;
-		set_enctypes = allowed_enctypes;
-	} else if (krb5_enctypes) {
-		printerr(2, "%s: using enctypes from the kernel: %s\n",
-			 __func__, krb5_enctypes_string);
-		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;
+	if (set_enctypes == NULL) {
+		err = determine_enctypes(&set_enctypes, &num_set_enctypes,
+					 &set_enctypes_string);
+		if (err) {
+			printerr(2, "%s: failed to determine set_enctypes\n",
+				 __func__);
+			return -1;
+		}
 	}
 
+	printerr(2, "%s: %s\n", __func__, set_enctypes_string);
+
 	maj_stat = gss_set_allowable_enctypes(&min_stat, sec->cred,
 				&krb5oid, num_set_enctypes, set_enctypes);
 
Signature · 1 line
2.52.0
#5 lore raw
In reply to Scott Mayhew
Quoted 31 lines · Scott Mayhew

These patches address the issue described in "nfs: ls input/output error ("NFS: readdir(/) returns -5") on krb5 NFSv4 client using SHA2"
(https://bugs.debian.org/1120598).

The core issue is that when the krb5 library does a TGS request, it initially does so with referrals enabled, disregarding the enctypes list supplied by the requesting application. It still checks the resulting ticket to ensure that it's using one of the requested enctypes, but it may not the highest priority enctype from our list. See make_request_for_service(), step_referrals(), and wrong_enctype() in the krb5 code.

The problem arises if it does this when setting up the machine credential, but it doesn't do it when setting up a user's credential (which can happen in the case of constrained-delegation via gssproxy).

That can lead to the machine credential and the user credentials using different enctypes, leading to XDR decoding failures described in the above bug.

These patches aim to address that issue by making sure that the list we pass to limit_krb5_enctypes is in the same order as the default list in the krb5 library.

Scott Mayhew (4):
gssd: remove the limit-to-legacy-enctypes option
gssd: add enctypes_list_to_string()
gssd: get the permitted enctypes from the krb5 library on startup
gssd: add a helper to determine the set of encryption types to pass to
limit_krb5_enctypes()

Quoted 9 lines
  nfs.conf               |   1 -
  systemd/nfs.conf.man   |   2 +-
  utils/gssd/gssd.c      |  16 +--
  utils/gssd/gssd.man    |  30 +---
  utils/gssd/gssd_proc.c |  15 ++
  utils/gssd/krb5_util.c | 311 +++++++++++++++++++++++++++++++++--------
  utils/gssd/krb5_util.h |   5 +-
  7 files changed, 284 insertions(+), 96 deletions(-)

Committed... (tag: nfs-utils-2-8-6-rc3)

steved.