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

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