Bug#343085: exim4: Exim SMTP_AUTH hangs since today...

Florian Weimer fw at deneb.enyo.de
Mon Jan 30 13:13:20 UTC 2006


It's the generation of the special server-side key used to support
"RSA export" clients which use 40-bit symmetric session keys.

The following patch disables this feature; it should eliminate all use
of /dev/urandom.  If you omit the hunk removing GNUTLS_KX_RSA_EXPORT,
the functionality should remain there and Exim will generate the the
key on demand, i.e. if a client tries to actually connect to the
server in RSA_EXPORT mode.  This connection will potentially block, of
course, it won't prevent delivery of other mail.

A better fix would be to instruct GnuTLS to use random bits which are
not cryptographically secure for the RSA_EXPORT key because this key
is insecure anyway (it's just 512 bits, after all).

#! /bin/sh /usr/share/dpatch/dpatch-run
## 84_tls-entropy-fix.dpatch by Florian Weimer <fw at deneb.enyo.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Do not generate RSA_EXPORT keys, to preserve entropy.

@DPATCH@
diff -urNad exim4~/src/tls-gnu.c exim4/src/tls-gnu.c
--- exim4~/src/tls-gnu.c	2006-01-30 13:30:45.000000000 +0100
+++ exim4/src/tls-gnu.c	2006-01-30 13:48:19.000000000 +0100
@@ -23,7 +23,6 @@
 
 #define UNKNOWN_NAME "unknown"
 #define DH_BITS      768
-#define RSA_BITS     512
 
 /* Values for verify_requirment and initialized */
 
@@ -35,7 +34,6 @@
 static BOOL initialized = INITIALIZED_NOT;
 static host_item *client_host;
 
-static gnutls_rsa_params rsa_params = NULL;
 static gnutls_dh_params dh_params = NULL;
 
 static gnutls_certificate_server_credentials x509_cred = NULL;
@@ -55,7 +53,6 @@
   GNUTLS_KX_RSA,
   GNUTLS_KX_DHE_DSS,
   GNUTLS_KX_DHE_RSA,
-  GNUTLS_KX_RSA_EXPORT,
   0 };
 
 static int default_cipher_priority[16] = {
@@ -296,9 +293,6 @@
 
 /* Initialize the data structures for holding the parameters */
 
-ret = gnutls_rsa_params_init(&rsa_params);
-if (ret < 0) return tls_error(US"init rsa_params", host, ret);
-
 ret = gnutls_dh_params_init(&dh_params);
 if (ret < 0) return tls_error(US"init dh_params", host, ret);
 
@@ -315,7 +309,6 @@
 fd = Uopen(filename, O_RDONLY, 0);
 if (fd < 0)
   {
-  unsigned int rsa_bits = RSA_BITS;
   unsigned int dh_bits = DH_BITS;
   uschar tempfilename[sizeof(filename) + 10];
 
@@ -323,10 +316,6 @@
     return tls_error(string_open_failed(errno, "%s for reading", filename),
       host, 0);
 
-  DEBUG(D_tls) debug_printf("generating %d bit RSA key...\n", RSA_BITS);
-  ret = gnutls_rsa_params_generate2(rsa_params, RSA_BITS);
-  if (ret < 0) return tls_error(US"RSA key generation", host, ret);
-
   DEBUG(D_tls) debug_printf("generating %d bit Diffie-Hellman key...\n",
     DH_BITS);
   ret = gnutls_dh_params_generate2(dh_params, DH_BITS);
@@ -342,10 +331,6 @@
       host, 0);
   (void)fchown(fd, exim_uid, exim_gid);   /* Probably not necessary */
 
-  ret = gnutls_rsa_params_export_raw(rsa_params, &m, &e, &d, &p, &q, &u,
-    &rsa_bits);
-  if (ret < 0) return tls_error(US"RSA params export", host, ret);
-
   ret = gnutls_dh_params_export_raw(dh_params, &prime, &generator, &dh_bits);
   if (ret < 0) return tls_error(US"DH params export", host, ret);
 
@@ -365,7 +350,7 @@
     return tls_error(string_sprintf("failed to rename %s as %s: %s",
       tempfilename, filename, strerror(errno)), host, 0);
 
-  DEBUG(D_tls) debug_printf("wrote RSA and D-H parameters to file\n");
+  DEBUG(D_tls) debug_printf("wrote D-H parameters to file\n");
   }
 
 /* File opened for reading; get the data */
@@ -384,16 +369,13 @@
 
   (void)close(fd);
 
-  ret = gnutls_rsa_params_import_raw(rsa_params, &m, &e, &d, &p, &q, &u);
-  if (ret < 0) return tls_error(US"RSA params import", host, ret);
-
   ret = gnutls_dh_params_import_raw(dh_params, &prime, &generator);
   if (ret < 0) return tls_error(US"DH params import", host, ret);
 
-  DEBUG(D_tls) debug_printf("read RSA and D-H parameters from file\n");
+  DEBUG(D_tls) debug_printf("read D-H parameters from file\n");
   }
 
-DEBUG(D_tls) debug_printf("initialized RSA and D-H parameters\n");
+DEBUG(D_tls) debug_printf("initialized D-H parameters\n");
 return OK;
 }
 
@@ -524,7 +506,6 @@
 /* Associate the parameters with the x509 credentials structure. */
 
 gnutls_certificate_set_dh_params(x509_cred, dh_params);
-gnutls_certificate_set_rsa_params(x509_cred, rsa_params);
 
 DEBUG(D_tls) debug_printf("initialized certificate stuff\n");
 return OK;




More information about the Pkg-exim4-maintainers mailing list