Blame SOURCES/0001-Add-support-for-MinTLS-and-MaxTLS-options-Issue-5119.patch

ce62dc
diff -up cups-2.2.6/cups/http-private.h.remove-weak-ciphers cups-2.2.6/cups/http-private.h
ce62dc
--- cups-2.2.6/cups/http-private.h.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/cups/http-private.h	2018-08-07 11:53:54.985633959 +0200
ce62dc
@@ -180,13 +180,17 @@ extern "C" {
ce62dc
 
ce62dc
 #  define _HTTP_TLS_NONE	0	/* No TLS options */
ce62dc
 #  define _HTTP_TLS_ALLOW_RC4	1	/* Allow RC4 cipher suites */
ce62dc
-#  define _HTTP_TLS_ALLOW_SSL3	2	/* Allow SSL 3.0 */
ce62dc
-#  define _HTTP_TLS_ALLOW_DH	4	/* Allow DH/DHE key negotiation */
ce62dc
-#  define _HTTP_TLS_DENY_TLS10	16	/* Deny TLS 1.0 */
ce62dc
-#  define _HTTP_TLS_DENY_CBC	32	/* Deny CBC cipher suites */
ce62dc
-#  define _HTTP_TLS_ONLY_TLS10  64      /* Only use TLS 1.0 */
ce62dc
+#  define _HTTP_TLS_ALLOW_DH	2	/* Allow DH/DHE key negotiation */
ce62dc
+#  define _HTTP_TLS_DENY_CBC	4	/* Deny CBC cipher suites */
ce62dc
 #  define _HTTP_TLS_SET_DEFAULT 128     /* Setting the default TLS options */
ce62dc
 
ce62dc
+#  define _HTTP_TLS_SSL3	0	/* Min/max version is SSL/3.0 */
ce62dc
+#  define _HTTP_TLS_1_0		1	/* Min/max version is TLS/1.0 */
ce62dc
+#  define _HTTP_TLS_1_1		2	/* Min/max version is TLS/1.1 */
ce62dc
+#  define _HTTP_TLS_1_2		3	/* Min/max version is TLS/1.2 */
ce62dc
+#  define _HTTP_TLS_1_3		4	/* Min/max version is TLS/1.3 */
ce62dc
+#  define _HTTP_TLS_MAX		5	/* Highest known TLS version */
ce62dc
+
ce62dc
 
ce62dc
 /*
ce62dc
  * Types and functions for SSL support...
ce62dc
@@ -442,7 +446,7 @@ extern void		_httpTLSInitialize(void);
ce62dc
 extern size_t		_httpTLSPending(http_t *http);
ce62dc
 extern int		_httpTLSRead(http_t *http, char *buf, int len);
ce62dc
 extern int		_httpTLSSetCredentials(http_t *http);
ce62dc
-extern void		_httpTLSSetOptions(int options);
ce62dc
+extern void		_httpTLSSetOptions(int options, int min_version, int max_version);
ce62dc
 extern int		_httpTLSStart(http_t *http);
ce62dc
 extern void		_httpTLSStop(http_t *http);
ce62dc
 extern int		_httpTLSWrite(http_t *http, const char *buf, int len);
ce62dc
diff -up cups-2.2.6/cups/tlscheck.c.remove-weak-ciphers cups-2.2.6/cups/tlscheck.c
ce62dc
--- cups-2.2.6/cups/tlscheck.c.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/cups/tlscheck.c	2018-08-07 11:53:54.987633942 +0200
ce62dc
@@ -54,6 +54,8 @@ main(int  argc,				/* I - Number of comm
ce62dc
   int		af = AF_UNSPEC,		/* Address family */
ce62dc
 		tls_options = _HTTP_TLS_NONE,
ce62dc
 					/* TLS options */
ce62dc
+		tls_min_version = _HTTP_TLS_1_0,
ce62dc
+		tls_max_version = _HTTP_TLS_MAX,
ce62dc
 		verbose = 0;		/* Verbosity */
ce62dc
   ipp_t		*request,		/* IPP Get-Printer-Attributes request */
ce62dc
 		*response;		/* IPP Get-Printer-Attributes response */
ce62dc
@@ -88,11 +90,12 @@ main(int  argc,				/* I - Number of comm
ce62dc
     }
ce62dc
     else if (!strcmp(argv[i], "--no-tls10"))
ce62dc
     {
ce62dc
-      tls_options |= _HTTP_TLS_DENY_TLS10;
ce62dc
+      tls_min_version = _HTTP_TLS_1_1;
ce62dc
     }
ce62dc
     else if (!strcmp(argv[i], "--tls10"))
ce62dc
     {
ce62dc
-      tls_options |= _HTTP_TLS_ONLY_TLS10;
ce62dc
+      tls_min_version = _HTTP_TLS_1_0;
ce62dc
+      tls_max_version = _HTTP_TLS_1_0;
ce62dc
     }
ce62dc
     else if (!strcmp(argv[i], "--rc4"))
ce62dc
     {
ce62dc
@@ -148,7 +151,7 @@ main(int  argc,				/* I - Number of comm
ce62dc
   if (!port)
ce62dc
     port = 631;
ce62dc
 
ce62dc
-  _httpTLSSetOptions(tls_options);
ce62dc
+  _httpTLSSetOptions(tls_options, tls_min_version, tls_max_version);
ce62dc
 
ce62dc
   http = httpConnect2(server, port, NULL, af, HTTP_ENCRYPTION_ALWAYS, 1, 30000, NULL);
ce62dc
   if (!http)
ce62dc
diff -up cups-2.2.6/cups/tls-darwin.c.remove-weak-ciphers cups-2.2.6/cups/tls-darwin.c
ce62dc
--- cups-2.2.6/cups/tls-darwin.c.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/cups/tls-darwin.c	2018-08-07 11:53:54.986633951 +0200
ce62dc
@@ -53,7 +53,9 @@ static char		*tls_keypath = NULL;
ce62dc
 					/* Server cert keychain path */
ce62dc
 static _cups_mutex_t	tls_mutex = _CUPS_MUTEX_INITIALIZER;
ce62dc
 					/* Mutex for keychain/certs */
ce62dc
-static int		tls_options = -1;/* Options for TLS connections */
ce62dc
+static int		tls_options = -1,/* Options for TLS connections */
ce62dc
+			tls_min_version = _HTTP_TLS_1_0,
ce62dc
+			tls_max_version = _HTTP_TLS_MAX;
ce62dc
 
ce62dc
 
ce62dc
 /*
ce62dc
@@ -1139,10 +1141,16 @@ _httpTLSRead(http_t *http,		/* I - HTTP
ce62dc
  */
ce62dc
 
ce62dc
 void
ce62dc
-_httpTLSSetOptions(int options)		/* I - Options */
ce62dc
+_httpTLSSetOptions(int options,		/* I - Options */
ce62dc
+                   int min_version,	/* I - Minimum TLS version */
ce62dc
+                   int max_version)	/* I - Maximum TLS version */
ce62dc
 {
ce62dc
   if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
ce62dc
-    tls_options = options;
ce62dc
+  {
ce62dc
+    tls_options     = options;
ce62dc
+    tls_min_version = min_version;
ce62dc
+    tls_max_version = max_version;
ce62dc
+  }
ce62dc
 }
ce62dc
 
ce62dc
 
ce62dc
@@ -1174,7 +1182,7 @@ _httpTLSStart(http_t *http)		/* I - HTTP
ce62dc
   {
ce62dc
     DEBUG_puts("4_httpTLSStart: Setting defaults.");
ce62dc
     _cupsSetDefaults();
ce62dc
-    DEBUG_printf(("4_httpTLSStart: tls_options=%x", tls_options));
ce62dc
+    DEBUG_printf(("4_httpTLSStart: tls_options=%x, tls_min_version=%d, tls_max_version=%d", tls_options, tls_min_version, tls_max_version));
ce62dc
   }
ce62dc
 
ce62dc
 #ifdef HAVE_SECKEYCHAINOPEN
ce62dc
@@ -1217,22 +1225,23 @@ _httpTLSStart(http_t *http)		/* I - HTTP
ce62dc
 
ce62dc
   if (!error)
ce62dc
   {
ce62dc
-    SSLProtocol minProtocol;
ce62dc
-
ce62dc
-    if (tls_options & _HTTP_TLS_DENY_TLS10)
ce62dc
-      minProtocol = kTLSProtocol11;
ce62dc
-    else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
ce62dc
-      minProtocol = kSSLProtocol3;
ce62dc
-    else
ce62dc
-      minProtocol = kTLSProtocol1;
ce62dc
+    static const SSLProtocol protocols[] =	/* Min/max protocol versions */
ce62dc
+    {
ce62dc
+      kSSLProtocol3,
ce62dc
+      kTLSProtocol1,
ce62dc
+      kTLSProtocol11,
ce62dc
+      kTLSProtocol12,
ce62dc
+      kTLSProtocol13,
ce62dc
+      kTLSProtocolMaxSupported
ce62dc
+    };
ce62dc
 
ce62dc
-    error = SSLSetProtocolVersionMin(http->tls, minProtocol);
ce62dc
-    DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMin(%d), error=%d", minProtocol, (int)error));
ce62dc
+    error = SSLSetProtocolVersionMin(http->tls, protocols[tls_min_version]);
ce62dc
+    DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMin(%d), error=%d", protocols[tls_min_version], (int)error));
ce62dc
 
ce62dc
-    if (!error && (tls_options & _HTTP_TLS_ONLY_TLS10))
ce62dc
+    if (!error)
ce62dc
     {
ce62dc
-      error = SSLSetProtocolVersionMax(http->tls, kTLSProtocol1);
ce62dc
-      DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMax(kTLSProtocol1), error=%d", (int)error));
ce62dc
+      error = SSLSetProtocolVersionMax(http->tls, protocols[tls_max_version]);
ce62dc
+      DEBUG_printf(("4_httpTLSStart: SSLSetProtocolVersionMax(%d), error=%d", protocols[tls_max_version], (int)error));
ce62dc
     }
ce62dc
   }
ce62dc
 
ce62dc
diff -up cups-2.2.6/cups/tls-gnutls.c.remove-weak-ciphers cups-2.2.6/cups/tls-gnutls.c
ce62dc
--- cups-2.2.6/cups/tls-gnutls.c.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/cups/tls-gnutls.c	2018-08-07 11:58:45.164114342 +0200
ce62dc
@@ -35,7 +35,9 @@ static char		*tls_keypath = NULL;
ce62dc
 					/* Server cert keychain path */
ce62dc
 static _cups_mutex_t	tls_mutex = _CUPS_MUTEX_INITIALIZER;
ce62dc
 					/* Mutex for keychain/certs */
ce62dc
-static int		tls_options = -1;/* Options for TLS connections */
ce62dc
+static int		tls_options = -1,/* Options for TLS connections */
ce62dc
+			tls_min_version = _HTTP_TLS_1_0,
ce62dc
+			tls_max_version = _HTTP_TLS_MAX;
ce62dc
 
ce62dc
 
ce62dc
 /*
ce62dc
@@ -1224,10 +1226,16 @@ _httpTLSSetCredentials(http_t *http)	/*
ce62dc
  */
ce62dc
 
ce62dc
 void
ce62dc
-_httpTLSSetOptions(int options)		/* I - Options */
ce62dc
+_httpTLSSetOptions(int options, 		/* I - Options */
ce62dc
+                   int min_version,             /* I - Minimum TLS version */
ce62dc
+                   int max_version)             /* I - Maximum TLS version */
ce62dc
 {
ce62dc
   if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
ce62dc
-    tls_options = options;
ce62dc
+  {
ce62dc
+    tls_options     = options;
ce62dc
+    tls_min_version = min_version;
ce62dc
+    tls_max_version = max_version;
ce62dc
+  }
ce62dc
 }
ce62dc
 
ce62dc
 
ce62dc
@@ -1245,6 +1253,16 @@ _httpTLSStart(http_t *http)		/* I - Conn
ce62dc
 					/* TLS credentials */
ce62dc
   char			priority_string[2048];
ce62dc
 					/* Priority string */
ce62dc
+  int			version;	/* Current version */
ce62dc
+  static const char * const versions[] =/* SSL/TLS versions */
ce62dc
+  {
ce62dc
+    "VERS-SSL3.0",
ce62dc
+    "VERS-TLS1.0",
ce62dc
+    "VERS-TLS1.1",
ce62dc
+    "VERS-TLS1.2",
ce62dc
+    "VERS-TLS1.3",
ce62dc
+    "VERS-TLS-ALL"
ce62dc
+  };
ce62dc
 
ce62dc
 
ce62dc
   DEBUG_printf(("3_httpTLSStart(http=%p)", http));
ce62dc
@@ -1506,14 +1524,40 @@ _httpTLSStart(http_t *http)		/* I - Conn
ce62dc
 
ce62dc
   strlcpy(priority_string, "NORMAL", sizeof(priority_string));
ce62dc
 
ce62dc
-  if (tls_options & _HTTP_TLS_DENY_TLS10)
ce62dc
-    strlcat(priority_string, ":+VERS-TLS-ALL:-VERS-TLS1.0:-VERS-SSL3.0", sizeof(priority_string));
ce62dc
-  else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
ce62dc
+  if (tls_max_version < _HTTP_TLS_MAX)
ce62dc
+  {
ce62dc
+   /*
ce62dc
+    * Require specific TLS versions...
ce62dc
+    */
ce62dc
+
ce62dc
+    strlcat(priority_string, ":-VERS-TLS-ALL", sizeof(priority_string));
ce62dc
+    for (version = tls_min_version; version <= tls_max_version; version ++)
ce62dc
+    {
ce62dc
+      strlcat(priority_string, ":+", sizeof(priority_string));
ce62dc
+      strlcat(priority_string, versions[version], sizeof(priority_string));
ce62dc
+    }
ce62dc
+  }
ce62dc
+  else if (tls_min_version == _HTTP_TLS_SSL3)
ce62dc
+  {
ce62dc
+   /*
ce62dc
+    * Allow all versions of TLS and SSL/3.0...
ce62dc
+    */
ce62dc
+
ce62dc
     strlcat(priority_string, ":+VERS-TLS-ALL:+VERS-SSL3.0", sizeof(priority_string));
ce62dc
-  else if (tls_options & _HTTP_TLS_ONLY_TLS10)
ce62dc
-    strlcat(priority_string, ":-VERS-TLS-ALL:-VERS-SSL3.0:+VERS-TLS1.0", sizeof(priority_string));
ce62dc
+  }
ce62dc
   else
ce62dc
-    strlcat(priority_string, ":+VERS-TLS-ALL:-VERS-SSL3.0", sizeof(priority_string));
ce62dc
+  {
ce62dc
+   /*
ce62dc
+    * Require a minimum version...
ce62dc
+    */
ce62dc
+
ce62dc
+    strlcat(priority_string, ":+VERS-TLS-ALL", sizeof(priority_string));
ce62dc
+    for (version = 0; version < tls_min_version; version ++)
ce62dc
+    {
ce62dc
+      strlcat(priority_string, ":-", sizeof(priority_string));
ce62dc
+      strlcat(priority_string, versions[version], sizeof(priority_string));
ce62dc
+    }
ce62dc
+  }
ce62dc
 
ce62dc
   if (tls_options & _HTTP_TLS_ALLOW_RC4)
ce62dc
     strlcat(priority_string, ":+ARCFOUR-128", sizeof(priority_string));
ce62dc
diff -up cups-2.2.6/cups/tls-sspi.c.remove-weak-ciphers cups-2.2.6/cups/tls-sspi.c
ce62dc
--- cups-2.2.6/cups/tls-sspi.c.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/cups/tls-sspi.c	2018-08-07 11:53:54.986633951 +0200
ce62dc
@@ -52,7 +52,9 @@
ce62dc
  * Local globals...
ce62dc
  */
ce62dc
 
ce62dc
-static int		tls_options = -1;/* Options for TLS connections */
ce62dc
+static int		tls_options = -1,/* Options for TLS connections */
ce62dc
+			tls_min_version = _HTTP_TLS_1_0,
ce62dc
+			tls_max_version = _HTTP_TLS_MAX;
ce62dc
 
ce62dc
 
ce62dc
 /*
ce62dc
@@ -914,7 +916,11 @@ void
ce62dc
 _httpTLSSetOptions(int options)		/* I - Options */
ce62dc
 {
ce62dc
   if (!(options & _HTTP_TLS_SET_DEFAULT) || tls_options < 0)
ce62dc
-    tls_options = options;
ce62dc
+  {
ce62dc
+    tls_options     = options;
ce62dc
+    tls_min_version = min_version;
ce62dc
+    tls_max_version = max_version;
ce62dc
+  }
ce62dc
 }
ce62dc
 
ce62dc
 
ce62dc
@@ -1782,14 +1788,14 @@ http_sspi_find_credentials(
ce62dc
 #else
ce62dc
   if (http->mode == _HTTP_MODE_SERVER)
ce62dc
   {
ce62dc
-    if (tls_options & _HTTP_TLS_ALLOW_SSL3)
ce62dc
+    if (tls_min_version == _HTTP_TLS_SSL3)
ce62dc
       SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER;
ce62dc
     else
ce62dc
       SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_SERVER;
ce62dc
   }
ce62dc
   else
ce62dc
   {
ce62dc
-    if (tls_options & _HTTP_TLS_ALLOW_SSL3)
ce62dc
+    if (tls_min_version == _HTTP_TLS_SSL3)
ce62dc
       SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT;
ce62dc
     else
ce62dc
       SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1_CLIENT;
ce62dc
diff -up cups-2.2.6/cups/usersys.c.remove-weak-ciphers cups-2.2.6/cups/usersys.c
ce62dc
--- cups-2.2.6/cups/usersys.c.remove-weak-ciphers	2018-08-07 11:53:54.945634283 +0200
ce62dc
+++ cups-2.2.6/cups/usersys.c	2018-08-07 11:53:54.987633942 +0200
ce62dc
@@ -54,7 +54,9 @@
ce62dc
 typedef struct _cups_client_conf_s	/**** client.conf config data ****/
ce62dc
 {
ce62dc
 #ifdef HAVE_SSL
ce62dc
-  int			ssl_options;	/* SSLOptions values */
ce62dc
+  int			ssl_options,	/* SSLOptions values */
ce62dc
+			ssl_min_version,/* Minimum SSL/TLS version */
ce62dc
+			ssl_max_version;/* Maximum SSL/TLS version */
ce62dc
 #endif /* HAVE_SSL */
ce62dc
   int			trust_first,	/* Trust on first use? */
ce62dc
 			any_root,	/* Allow any (e.g., self-signed) root */
ce62dc
@@ -957,7 +959,7 @@ _cupsSetDefaults(void)
ce62dc
     cg->validate_certs = cc.validate_certs;
ce62dc
 
ce62dc
 #ifdef HAVE_SSL
ce62dc
-  _httpTLSSetOptions(cc.ssl_options | _HTTP_TLS_SET_DEFAULT);
ce62dc
+  _httpTLSSetOptions(cc.ssl_options | _HTTP_TLS_SET_DEFAULT, cc.ssl_min_version, cc.ssl_max_version);
ce62dc
 #endif /* HAVE_SSL */
ce62dc
 }
ce62dc
 
ce62dc
@@ -1336,7 +1338,9 @@ cups_set_ssl_options(
ce62dc
   * SSLOptions [AllowRC4] [AllowSSL3] [AllowDH] [DenyTLS1.0] [None]
ce62dc
   */
ce62dc
 
ce62dc
-  int	options = _HTTP_TLS_NONE;	/* SSL/TLS options */
ce62dc
+  int	options = _HTTP_TLS_NONE,	/* SSL/TLS options */
ce62dc
+	min_version = _HTTP_TLS_1_0,	/* Minimum SSL/TLS version */
ce62dc
+	max_version = _HTTP_TLS_MAX;	/* Maximum SSL/TLS version */
ce62dc
   char	temp[256],			/* Copy of value */
ce62dc
 	*start,				/* Start of option */
ce62dc
 	*end;				/* End of option */
ce62dc
@@ -1364,20 +1368,38 @@ cups_set_ssl_options(
ce62dc
     if (!_cups_strcasecmp(start, "AllowRC4"))
ce62dc
       options |= _HTTP_TLS_ALLOW_RC4;
ce62dc
     else if (!_cups_strcasecmp(start, "AllowSSL3"))
ce62dc
-      options |= _HTTP_TLS_ALLOW_SSL3;
ce62dc
+      min_version = _HTTP_TLS_SSL3;
ce62dc
     else if (!_cups_strcasecmp(start, "AllowDH"))
ce62dc
       options |= _HTTP_TLS_ALLOW_DH;
ce62dc
     else if (!_cups_strcasecmp(start, "DenyCBC"))
ce62dc
       options |= _HTTP_TLS_DENY_CBC;
ce62dc
     else if (!_cups_strcasecmp(start, "DenyTLS1.0"))
ce62dc
-      options |= _HTTP_TLS_DENY_TLS10;
ce62dc
+      min_version = _HTTP_TLS_1_1;
ce62dc
+    else if (!_cups_strcasecmp(start, "MaxTLS1.0"))
ce62dc
+      max_version = _HTTP_TLS_1_0;
ce62dc
+    else if (!_cups_strcasecmp(start, "MaxTLS1.1"))
ce62dc
+      max_version = _HTTP_TLS_1_1;
ce62dc
+    else if (!_cups_strcasecmp(start, "MaxTLS1.2"))
ce62dc
+      max_version = _HTTP_TLS_1_2;
ce62dc
+    else if (!_cups_strcasecmp(start, "MaxTLS1.3"))
ce62dc
+      max_version = _HTTP_TLS_1_3;
ce62dc
+    else if (!_cups_strcasecmp(start, "MinTLS1.0"))
ce62dc
+      min_version = _HTTP_TLS_1_0;
ce62dc
+    else if (!_cups_strcasecmp(start, "MinTLS1.1"))
ce62dc
+      min_version = _HTTP_TLS_1_1;
ce62dc
+    else if (!_cups_strcasecmp(start, "MinTLS1.2"))
ce62dc
+      min_version = _HTTP_TLS_1_2;
ce62dc
+    else if (!_cups_strcasecmp(start, "MinTLS1.3"))
ce62dc
+      min_version = _HTTP_TLS_1_3;
ce62dc
     else if (!_cups_strcasecmp(start, "None"))
ce62dc
       options = _HTTP_TLS_NONE;
ce62dc
   }
ce62dc
 
ce62dc
-  cc->ssl_options = options;
ce62dc
+  cc->ssl_options     = options;
ce62dc
+  cc->ssl_max_version = max_version;
ce62dc
+  cc->ssl_min_version = min_version;
ce62dc
 
ce62dc
-  DEBUG_printf(("4cups_set_ssl_options(cc=%p, value=\"%s\") options=%x", (void *)cc, value, options));
ce62dc
+  DEBUG_printf(("4cups_set_ssl_options(cc=%p, value=\"%s\") options=%x, min_version=%d, max_version=%d", (void *)cc, value, options, min_version, max_version));
ce62dc
 }
ce62dc
 #endif /* HAVE_SSL */
ce62dc
 
ce62dc
diff -up cups-2.2.6/man/client.conf.man.in.remove-weak-ciphers cups-2.2.6/man/client.conf.man.in
ce62dc
--- cups-2.2.6/man/client.conf.man.in.remove-weak-ciphers	2017-11-01 15:57:53.000000000 +0100
ce62dc
+++ cups-2.2.6/man/client.conf.man.in	2018-08-07 11:53:54.987633942 +0200
ce62dc
@@ -10,7 +10,7 @@
ce62dc
 .\" which should have been included with this file.  If this file is
ce62dc
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
ce62dc
 .\"
ce62dc
-.TH client.conf 5 "CUPS" "19 October 2017" "Apple Inc."
ce62dc
+.TH client.conf 5 "CUPS" "3 November 2017" "Apple Inc."
ce62dc
 .SH NAME
ce62dc
 client.conf \- client configuration file for cups
ce62dc
 .SH DESCRIPTION
ce62dc
@@ -56,7 +56,7 @@ Specifies the address and optionally the
ce62dc
 \fBServerName \fIhostname-or-ip-address\fR[\fI:port\fR]\fB/version=1.1\fR
ce62dc
 Specifies the address and optionally the port to use when connecting to a server running CUPS 1.3.12 and earlier.
ce62dc
 .TP 5
ce62dc
-\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR]
ce62dc
+\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR]
ce62dc
 .TP 5
ce62dc
 \fBSSLOptions None\fR
ce62dc
 Sets encryption options (only in /etc/cups/client.conf).
ce62dc
@@ -68,6 +68,9 @@ The \fIAllowRC4\fR option enables the 12
ce62dc
 The \fIAllowSSL3\fR option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
ce62dc
 The \fIDenyCBC\fR option disables all CBC cipher suites.
ce62dc
 The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.
ce62dc
+The \fMinTLS\fR options set the minimum TLS version to support.
ce62dc
+The \fMaxTLS\fR options set the maximum TLS version to support.
ce62dc
+Not all operating systems support TLS 1.3 at this time.
ce62dc
 .TP 5
ce62dc
 \fBTrustOnFirstUse Yes\fR
ce62dc
 .TP 5
ce62dc
diff -up cups-2.2.6/man/cupsd.conf.man.in.remove-weak-ciphers cups-2.2.6/man/cupsd.conf.man.in
ce62dc
--- cups-2.2.6/man/cupsd.conf.man.in.remove-weak-ciphers	2018-08-07 11:53:54.981633991 +0200
ce62dc
+++ cups-2.2.6/man/cupsd.conf.man.in	2018-08-07 11:53:54.987633942 +0200
ce62dc
@@ -432,10 +432,11 @@ The default is "Minimal".
ce62dc
 Listens on the specified address and port for encrypted connections.
ce62dc
 .\"#SSLOptions
ce62dc
 .TP 5
ce62dc
-\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR]
ce62dc
+.TP 5
ce62dc
+\fBSSLOptions \fR[\fIAllowDH\fR] [\fIAllowRC4\fR] [\fIAllowSSL3\fR] [\fIDenyCBC\fR] [\fIDenyTLS1.0\fR] [\fIMaxTLS1.0\fR] [\fIMaxTLS1.1\fR] [\fIMaxTLS1.2\fR] [\fIMaxTLS1.3\fR] [\fIMinTLS1.0\fR] [\fIMinTLS1.1\fR] [\fIMinTLS1.2\fR] [\fIMinTLS1.3\fR]
ce62dc
 .TP 5
ce62dc
 \fBSSLOptions None\fR
ce62dc
-Sets encryption options.
ce62dc
+Sets encryption options (only in /etc/cups/client.conf).
ce62dc
 By default, CUPS only supports encryption using TLS v1.0 or higher using known secure cipher suites.
ce62dc
 Security is reduced when \fIAllow\fR options are used.
ce62dc
 Security is enhanced when \fIDeny\fR options are used.
ce62dc
@@ -444,6 +445,9 @@ The \fIAllowRC4\fR option enables the 12
ce62dc
 The \fIAllowSSL3\fR option enables SSL v3.0, which is required for some older clients that do not support TLS v1.0.
ce62dc
 The \fIDenyCBC\fR option disables all CBC cipher suites.
ce62dc
 The \fIDenyTLS1.0\fR option disables TLS v1.0 support - this sets the minimum protocol version to TLS v1.1.
ce62dc
+The \fMinTLS\fR options set the minimum TLS version to support.
ce62dc
+The \fMaxTLS\fR options set the maximum TLS version to support.
ce62dc
+Not all operating systems support TLS 1.3 at this time.
ce62dc
 .\"#SSLPort
ce62dc
 .TP 5
ce62dc
 \fBSSLPort \fIport\fR
ce62dc
diff -up cups-2.2.6/scheduler/conf.c.remove-weak-ciphers cups-2.2.6/scheduler/conf.c
ce62dc
--- cups-2.2.6/scheduler/conf.c.remove-weak-ciphers	2018-08-07 11:53:54.981633991 +0200
ce62dc
+++ cups-2.2.6/scheduler/conf.c	2018-08-07 11:53:54.988633934 +0200
ce62dc
@@ -630,7 +630,7 @@ cupsdReadConfiguration(void)
ce62dc
   cupsdSetString(&ServerKeychain, "/Library/Keychains/System.keychain");
ce62dc
 #  endif /* HAVE_GNUTLS */
ce62dc
 
ce62dc
-  _httpTLSSetOptions(0);
ce62dc
+  _httpTLSSetOptions(_HTTP_TLS_NONE, _HTTP_TLS_1_0, _HTTP_TLS_MAX);
ce62dc
 #endif /* HAVE_SSL */
ce62dc
 
ce62dc
   language = cupsLangDefault();
ce62dc
@@ -3024,7 +3024,9 @@ read_cupsd_conf(cups_file_t *fp)	/* I -
ce62dc
       * SSLOptions [AllowRC4] [AllowSSL3] [AllowDH] [DenyCBC] [DenyTLS1.0] [None]
ce62dc
       */
ce62dc
 
ce62dc
-      int	options = 0;		/* SSL/TLS options */
ce62dc
+      int	options = _HTTP_TLS_NONE,/* SSL/TLS options */
ce62dc
+		min_version = _HTTP_TLS_1_0,
ce62dc
+		max_version = _HTTP_TLS_MAX;
ce62dc
 
ce62dc
       if (value)
ce62dc
       {
ce62dc
@@ -3048,24 +3050,40 @@ read_cupsd_conf(cups_file_t *fp)	/* I -
ce62dc
 	  * Compare...
ce62dc
 	  */
ce62dc
 
ce62dc
-          if (!_cups_strcasecmp(start, "AllowRC4"))
ce62dc
+	  if (!_cups_strcasecmp(start, "AllowRC4"))
ce62dc
 	    options |= _HTTP_TLS_ALLOW_RC4;
ce62dc
-          else if (!_cups_strcasecmp(start, "AllowSSL3"))
ce62dc
-	    options |= _HTTP_TLS_ALLOW_SSL3;
ce62dc
+	  else if (!_cups_strcasecmp(start, "AllowSSL3"))
ce62dc
+	    min_version = _HTTP_TLS_SSL3;
ce62dc
 	  else if (!_cups_strcasecmp(start, "AllowDH"))
ce62dc
 	    options |= _HTTP_TLS_ALLOW_DH;
ce62dc
 	  else if (!_cups_strcasecmp(start, "DenyCBC"))
ce62dc
 	    options |= _HTTP_TLS_DENY_CBC;
ce62dc
 	  else if (!_cups_strcasecmp(start, "DenyTLS1.0"))
ce62dc
-	    options |= _HTTP_TLS_DENY_TLS10;
ce62dc
-          else if (!_cups_strcasecmp(start, "None"))
ce62dc
-	    options = 0;
ce62dc
+	    min_version = _HTTP_TLS_1_1;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MaxTLS1.0"))
ce62dc
+	    max_version = _HTTP_TLS_1_0;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MaxTLS1.1"))
ce62dc
+	    max_version = _HTTP_TLS_1_1;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MaxTLS1.2"))
ce62dc
+	    max_version = _HTTP_TLS_1_2;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MaxTLS1.3"))
ce62dc
+	    max_version = _HTTP_TLS_1_3;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MinTLS1.0"))
ce62dc
+	    min_version = _HTTP_TLS_1_0;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MinTLS1.1"))
ce62dc
+	    min_version = _HTTP_TLS_1_1;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MinTLS1.2"))
ce62dc
+	    min_version = _HTTP_TLS_1_2;
ce62dc
+	  else if (!_cups_strcasecmp(start, "MinTLS1.3"))
ce62dc
+	    min_version = _HTTP_TLS_1_3;
ce62dc
+	  else if (!_cups_strcasecmp(start, "None"))
ce62dc
+	    options = _HTTP_TLS_NONE;
ce62dc
 	  else if (_cups_strcasecmp(start, "NoEmptyFragments"))
ce62dc
 	    cupsdLogMessage(CUPSD_LOG_WARN, "Unknown SSL option %s at line %d.", start, linenum);
ce62dc
         }
ce62dc
       }
ce62dc
 
ce62dc
-      _httpTLSSetOptions(options);
ce62dc
+      _httpTLSSetOptions(options, min_version, max_version);
ce62dc
     }
ce62dc
 #endif /* HAVE_SSL */
ce62dc
     else if ((!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen")