SUNRPC: Add build option to disable support for insecure enctypes
authorChuck Lever <chuck.lever@oracle.com>
Mon, 11 Feb 2019 16:24:43 +0000 (11:24 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 13 Feb 2019 18:33:12 +0000 (13:33 -0500)
Enable distributions to enforce the rejection of ancient and
insecure Kerberos enctypes in the kernel's RPCSEC_GSS
implementation. These are the single-DES encryption types that
were deprecated in 2012 by RFC 6649.

Enctypes that were deprecated more recently (by RFC 8429) remain
fully supported for now because they are still likely to be widely
used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Acked-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/linux/sunrpc/gss_krb5_enctypes.h
net/sunrpc/Kconfig
net/sunrpc/auth_gss/gss_krb5_mech.c

index ec6234eee89c47ec1330c108d87daa3b33db1740..981c89cef19d6a0fd2097b95ec2b0a1c797aad74 100644 (file)
@@ -1,4 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Dumb way to share this static piece of information with nfsd
+ * Define the string that exports the set of kernel-supported
+ * Kerberos enctypes. This list is sent via upcall to gssd, and
+ * is also exposed via the nfsd /proc API. The consumers generally
+ * treat this as an ordered list, where the first item in the list
+ * is the most preferred.
+ */
+
+#ifndef _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H
+#define _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H
+
+#ifdef CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES
+
+/*
+ * NB: This list includes encryption types that were deprecated
+ * by RFC 8429 (DES3_CBC_SHA1 and ARCFOUR_HMAC).
+ *
+ * ENCTYPE_AES256_CTS_HMAC_SHA1_96
+ * ENCTYPE_AES128_CTS_HMAC_SHA1_96
+ * ENCTYPE_DES3_CBC_SHA1
+ * ENCTYPE_ARCFOUR_HMAC
+ */
+#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23"
+
+#else  /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */
+
+/*
+ * NB: This list includes encryption types that were deprecated
+ * by RFC 8429 and RFC 6649.
+ *
+ * ENCTYPE_AES256_CTS_HMAC_SHA1_96
+ * ENCTYPE_AES128_CTS_HMAC_SHA1_96
+ * ENCTYPE_DES3_CBC_SHA1
+ * ENCTYPE_ARCFOUR_HMAC
+ * ENCTYPE_DES_CBC_MD5
+ * ENCTYPE_DES_CBC_CRC
+ * ENCTYPE_DES_CBC_MD4
  */
 #define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
+
+#endif /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */
+
+#endif /* _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H */
index ac09ca8032965bfd4280fb3f6d3410c08cbda243..83f5617bae07eda1cdada10022c541d0b6d2d239 100644 (file)
@@ -34,6 +34,22 @@ config RPCSEC_GSS_KRB5
 
          If unsure, say Y.
 
+config CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES
+       bool "Secure RPC: Disable insecure Kerberos encryption types"
+       depends on RPCSEC_GSS_KRB5
+       default n
+       help
+         Choose Y here to disable the use of deprecated encryption types
+         with the Kerberos version 5 GSS-API mechanism (RFC 1964). The
+         deprecated encryption types include DES-CBC-MD5, DES-CBC-CRC,
+         and DES-CBC-MD4. These types were deprecated by RFC 6649 because
+         they were found to be insecure.
+
+         N is the default because many sites have deployed KDCs and
+         keytabs that contain only these deprecated encryption types.
+         Choosing Y prevents the use of known-insecure encryption types
+         but might result in compatibility problems.
+
 config SUNRPC_DEBUG
        bool "RPC: Enable dprintk debugging"
        depends on SUNRPC && SYSCTL
index eab71fc7af3e00ff72a339c1f3d7f1e910358e89..be31a58d54e050b7033a69ca648cb9276f197e73 100644 (file)
@@ -53,6 +53,7 @@
 static struct gss_api_mech gss_kerberos_mech;  /* forward declaration */
 
 static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
+#ifndef CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES
        /*
         * DES (All DES enctypes are mapped to the same gss functionality)
         */
@@ -74,6 +75,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
          .cksumlength = 8,
          .keyed_cksum = 0,
        },
+#endif /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */
        /*
         * RC4-HMAC
         */