]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix cipher suite selection with GNU TLS (Issue #5145)
authorMichael Sweet <michael.r.sweet@gmail.com>
Fri, 20 Oct 2017 02:44:12 +0000 (22:44 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Fri, 20 Oct 2017 02:44:12 +0000 (22:44 -0400)
Also make sure that client.conf SSLOptions do not override cupsd.conf
SSLOptions, and document the (hopefully obvious) fact that Allow* is less
secure and Deny* is more secure.

- cups/http-private.h: Add "_HTTP_TLS_SET_DEFAULT" flag for options set from
  client.conf.
- cups/tls-*.c: Use new flag.
- cups/tls-gnutls.c: Fix CBC cipher suite exclusion logic, and always disable
  anonymous DH.
- cups/usersys.c: Pass new flag when calling _httpTLSSetOptions.
- man/*: Update documentation.

CHANGES.md
cups/http-private.h
cups/tls-darwin.c
cups/tls-gnutls.c
cups/tls-sspi.c
cups/usersys.c
man/client.conf.man.in
man/cupsd.conf.man.in

index 6749b1c6d6f5f2aed820d1ac2eb18c6a50e178ad..2fdf93e3247d1cff5817ec5ca2456d896a36bcd5 100644 (file)
@@ -6,6 +6,7 @@ Changes in CUPS v2.2.6
 ----------------------
 
 - Added USB quirks rules for Canon MP540 and Samsung ML-2160 (Issue #5148)
+- Fixed TLS cipher suite selection with GNU TLS (Issue #5145)
 
 
 Changes in CUPS v2.2.5
index 00afed0df123382687ff4076eb8068514d19d1af..f71e564b259881cc4d6fcb0e182e584e32a5622b 100644 (file)
@@ -172,20 +172,20 @@ extern "C" {
  * Constants...
  */
 
-
-#define _HTTP_MAX_SBUFFER      65536   /* Size of (de)compression buffer */
-#define _HTTP_RESOLVE_DEFAULT  0       /* Just resolve with default options */
-#define _HTTP_RESOLVE_STDERR   1       /* Log resolve progress to stderr */
-#define _HTTP_RESOLVE_FQDN     2       /* Resolve to a FQDN */
-#define _HTTP_RESOLVE_FAXOUT   4       /* Resolve FaxOut service? */
-
-#define _HTTP_TLS_NONE         0       /* No TLS options */
-#define _HTTP_TLS_ALLOW_RC4    1       /* Allow RC4 cipher suites */
-#define _HTTP_TLS_ALLOW_SSL3   2       /* Allow SSL 3.0 */
-#define _HTTP_TLS_ALLOW_DH     4       /* Allow DH/DHE key negotiation */
-#define _HTTP_TLS_DENY_TLS10   16      /* Deny TLS 1.0 */
-#define _HTTP_TLS_DENY_CBC     32      /* Deny CBC cipher suites */
-#define _HTTP_TLS_ONLY_TLS10    64      /* Only use TLS 1.0 */
+#  define _HTTP_MAX_SBUFFER    65536   /* Size of (de)compression buffer */
+#  define _HTTP_RESOLVE_DEFAULT        0       /* Just resolve with default options */
+#  define _HTTP_RESOLVE_STDERR 1       /* Log resolve progress to stderr */
+#  define _HTTP_RESOLVE_FQDN   2       /* Resolve to a FQDN */
+#  define _HTTP_RESOLVE_FAXOUT 4       /* Resolve FaxOut service? */
+
+#  define _HTTP_TLS_NONE       0       /* No TLS options */
+#  define _HTTP_TLS_ALLOW_RC4  1       /* Allow RC4 cipher suites */
+#  define _HTTP_TLS_ALLOW_SSL3 2       /* Allow SSL 3.0 */
+#  define _HTTP_TLS_ALLOW_DH   4       /* Allow DH/DHE key negotiation */
+#  define _HTTP_TLS_DENY_TLS10 16      /* Deny TLS 1.0 */
+#  define _HTTP_TLS_DENY_CBC   32      /* Deny CBC cipher suites */
+#  define _HTTP_TLS_ONLY_TLS10  64      /* Only use TLS 1.0 */
+#  define _HTTP_TLS_SET_DEFAULT 128     /* Setting the default TLS options */
 
 
 /*
index d2d3687a1134998afcb2b2419ecd8efd684598a7..92430aca0f7f8cc5303260b1fb5a2af7bac00d83 100644 (file)
@@ -1141,7 +1141,8 @@ _httpTLSRead(http_t *http,                /* I - HTTP connection */
 void
 _httpTLSSetOptions(int options)                /* I - Options */
 {
-  tls_options = options;
+  if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
+    tls_options = options;
 }
 
 
index 3f13760b2b0c3b40d3dd6e947331dda57ca6321f..4c92b68506f8298b58b6a3d3e91bd70bda847fab 100644 (file)
@@ -1226,7 +1226,8 @@ _httpTLSSetCredentials(http_t *http)      /* I - Connection to server */
 void
 _httpTLSSetOptions(int options)                /* I - Options */
 {
-  tls_options = options;
+  if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
+    tls_options = options;
 }
 
 
@@ -1517,10 +1518,9 @@ _httpTLSStart(http_t *http)              /* I - Connection to server */
   if (!(tls_options & _HTTP_TLS_ALLOW_RC4))
     strlcat(priority_string, ":-ARCFOUR-128", sizeof(priority_string));
 
-  if (!(tls_options & _HTTP_TLS_ALLOW_DH))
-    strlcat(priority_string, ":!ANON-DH", sizeof(priority_string));
+  strlcat(priority_string, ":!ANON-DH", sizeof(priority_string));
 
-  if (!(tls_options & _HTTP_TLS_DENY_CBC))
+  if (tls_options & _HTTP_TLS_DENY_CBC)
     strlcat(priority_string, ":!AES-128-CBC:!AES-256-CBC:!CAMELLIA-128-CBC:!CAMELLIA-256-CBC:!3DES-CBC", sizeof(priority_string));
 
 #ifdef HAVE_GNUTLS_PRIORITY_SET_DIRECT
index 77b883b2297622eb03ffebccf5fac6fee1642b1b..6eaec4c83acfc6a0d0f298910ce020b7466f3ac4 100644 (file)
@@ -2,7 +2,7 @@
  * TLS support for CUPS on Windows using the Security Support Provider
  * Interface (SSPI).
  *
- * Copyright 2010-2015 by Apple Inc.
+ * Copyright 2010-2017 by Apple Inc.
  *
  * These coded instructions, statements, and computer programs are the
  * property of Apple Inc. and are protected by Federal copyright
@@ -913,7 +913,8 @@ _httpTLSRead(http_t *http,          /* I - HTTP connection */
 void
 _httpTLSSetOptions(int options)                /* I - Options */
 {
-  tls_options = options;
+  if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
+    tls_options = options;
 }
 
 
index 026b4a7cc493760193de0b93d989b4784b6066f8..2a004b540217ee1c6aa9a016c7a87854bb312784 100644 (file)
@@ -957,7 +957,7 @@ _cupsSetDefaults(void)
     cg->validate_certs = cc.validate_certs;
 
 #ifdef HAVE_SSL
-  _httpTLSSetOptions(cc.ssl_options);
+  _httpTLSSetOptions(cc.ssl_options | _HTTP_TLS_SET_DEFAULT);
 #endif /* HAVE_SSL */
 }
 
index fba9fe97776a18cd3741d7f79c86f7d377d576ec..c9fb91da28538e04124ec4f04f3bcc9f2e3994da 100644 (file)
@@ -10,7 +10,7 @@
 .\" which should have been included with this file.  If this file is
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH client.conf 5 "CUPS" "26 June 2017" "Apple Inc."
+.TH client.conf 5 "CUPS" "19 October 2017" "Apple Inc."
 .SH NAME
 client.conf \- client configuration file for cups
 .SH DESCRIPTION
@@ -61,8 +61,10 @@ Specifies the address and optionally the port to use when connecting to a server
 \fBSSLOptions None\fR
 Sets encryption options (only in /etc/cups/client.conf).
 By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites.
-The \fIAllowDH\fR option enables cipher suites using plain Diffie-Hellman key negotiation.
-The \fIAllowRC4\fR option enables the 128-bit RC4 cipher suites, which are required for some older clients that do not implement newer ones.
+Security is reduced when \fIAllow\fR options are used.
+Security is enhanced when \fIDeny\fR options are used.
+The \fIAllowDH\fR option enables cipher suites using plain Diffie-Hellman key negotiation (not supported on systems using GNU TLS).
+The \fIAllowRC4\fR option enables the 128-bit RC4 cipher suites, which are required for some older clients.
 The \fIAllowSSL3\fR option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
 The \fIDenyCBC\fR option disables all CBC cipher suites.
 The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.
index 918bbee7aa1333a47f98b765dcda9a125f71f74f..ab89e156a7b761b88a7902137011d7337f5598c7 100644 (file)
@@ -10,7 +10,7 @@
 .\" which should have been included with this file.  If this file is
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH cupsd.conf 5 "CUPS" "28 August 2017" "Apple Inc."
+.TH cupsd.conf 5 "CUPS" "19 October 2017" "Apple Inc."
 .SH NAME
 cupsd.conf \- server configuration file for cups
 .SH DESCRIPTION
@@ -445,8 +445,10 @@ Listens on the specified address and port for encrypted connections.
 \fBSSLOptions None\fR
 Sets encryption options.
 By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites.
-The \fIAllowDH\fR option enables cipher suites using plain Diffie-Hellman key negotiation.
-The \fIAllowRC4\fR option enables the 128-bit RC4 cipher suites, which are required for some older clients that do not implement newer ones.
+Security is reduced when \fIAllow\fR options are used.
+Security is enhanced when \fIDeny\fR options are used.
+The \fIAllowDH\fR option enables cipher suites using plain Diffie-Hellman key negotiation (not supported on systems using GNU TLS).
+The \fIAllowRC4\fR option enables the 128-bit RC4 cipher suites, which are required for some older clients.
 The \fIAllowSSL3\fR option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
 The \fIDenyCBC\fR option disables all CBC cipher suites.
 The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.