Blame SOURCES/0033-Introduce-TLSv1.1-and-TLSv1.2-options.patch

d7fdbd
From 01bef55a1987700af3d43cdc5f5be88d3843ab85 Mon Sep 17 00:00:00 2001
d7fdbd
From: Martin Sehnoutka <msehnout@redhat.com>
d7fdbd
Date: Thu, 17 Nov 2016 13:36:17 +0100
d7fdbd
Subject: [PATCH 33/59] Introduce TLSv1.1 and TLSv1.2 options.
d7fdbd
d7fdbd
Users can now enable a specific version of TLS protocol.
d7fdbd
---
d7fdbd
 parseconf.c   |  2 ++
d7fdbd
 ssl.c         |  8 ++++++++
d7fdbd
 tunables.c    |  9 +++++++--
d7fdbd
 tunables.h    |  2 ++
d7fdbd
 vsftpd.conf.5 | 24 ++++++++++++++++++++----
d7fdbd
 5 files changed, 39 insertions(+), 6 deletions(-)
d7fdbd
d7fdbd
diff --git a/parseconf.c b/parseconf.c
d7fdbd
index a2c715b..33a1349 100644
d7fdbd
--- a/parseconf.c
d7fdbd
+++ b/parseconf.c
d7fdbd
@@ -85,6 +85,8 @@ parseconf_bool_array[] =
d7fdbd
   { "ssl_sslv2", &tunable_sslv2 },
d7fdbd
   { "ssl_sslv3", &tunable_sslv3 },
d7fdbd
   { "ssl_tlsv1", &tunable_tlsv1 },
d7fdbd
+  { "ssl_tlsv1_1", &tunable_tlsv1_1 },
d7fdbd
+  { "ssl_tlsv1_2", &tunable_tlsv1_2 },
d7fdbd
   { "tilde_user_enable", &tunable_tilde_user_enable },
d7fdbd
   { "force_anon_logins_ssl", &tunable_force_anon_logins_ssl },
d7fdbd
   { "force_anon_data_ssl", &tunable_force_anon_data_ssl },
d7fdbd
diff --git a/ssl.c b/ssl.c
d7fdbd
index 96bf8ad..ba8a613 100644
d7fdbd
--- a/ssl.c
d7fdbd
+++ b/ssl.c
d7fdbd
@@ -135,6 +135,14 @@ ssl_init(struct vsf_session* p_sess)
d7fdbd
     {
d7fdbd
       options |= SSL_OP_NO_TLSv1;
d7fdbd
     }
d7fdbd
+    if (!tunable_tlsv1_1)
d7fdbd
+    {
d7fdbd
+      options |= SSL_OP_NO_TLSv1_1;
d7fdbd
+    }
d7fdbd
+    if (!tunable_tlsv1_2)
d7fdbd
+    {
d7fdbd
+      options |= SSL_OP_NO_TLSv1_2;
d7fdbd
+    }
d7fdbd
     SSL_CTX_set_options(p_ctx, options);
d7fdbd
     if (tunable_rsa_cert_file)
d7fdbd
     {
d7fdbd
diff --git a/tunables.c b/tunables.c
d7fdbd
index 93f85b1..78f2bcd 100644
d7fdbd
--- a/tunables.c
d7fdbd
+++ b/tunables.c
d7fdbd
@@ -66,6 +66,8 @@ int tunable_force_local_data_ssl;
d7fdbd
 int tunable_sslv2;
d7fdbd
 int tunable_sslv3;
d7fdbd
 int tunable_tlsv1;
d7fdbd
+int tunable_tlsv1_1;
d7fdbd
+int tunable_tlsv1_2;
d7fdbd
 int tunable_tilde_user_enable;
d7fdbd
 int tunable_force_anon_logins_ssl;
d7fdbd
 int tunable_force_anon_data_ssl;
d7fdbd
@@ -209,7 +211,10 @@ tunables_load_defaults()
d7fdbd
   tunable_force_local_data_ssl = 1;
d7fdbd
   tunable_sslv2 = 0;
d7fdbd
   tunable_sslv3 = 0;
d7fdbd
+  /* TLSv1 up to TLSv1.2 is enabled by default */
d7fdbd
   tunable_tlsv1 = 1;
d7fdbd
+  tunable_tlsv1_1 = 1;
d7fdbd
+  tunable_tlsv1_2 = 1;
d7fdbd
   tunable_tilde_user_enable = 0;
d7fdbd
   tunable_force_anon_logins_ssl = 0;
d7fdbd
   tunable_force_anon_data_ssl = 0;
d7fdbd
@@ -292,8 +297,8 @@ tunables_load_defaults()
d7fdbd
   install_str_setting(0, &tunable_dsa_cert_file);
d7fdbd
   install_str_setting(0, &tunable_dh_param_file);
d7fdbd
   install_str_setting(0, &tunable_ecdh_param_file);
d7fdbd
-  install_str_setting("AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA",
d7fdbd
-                      &tunable_ssl_ciphers);
d7fdbd
+  install_str_setting("AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384",
d7fdbd
+          &tunable_ssl_ciphers);
d7fdbd
   install_str_setting(0, &tunable_rsa_private_key_file);
d7fdbd
   install_str_setting(0, &tunable_dsa_private_key_file);
d7fdbd
   install_str_setting(0, &tunable_ca_certs_file);
d7fdbd
diff --git a/tunables.h b/tunables.h
d7fdbd
index 3e2d40c..a466427 100644
d7fdbd
--- a/tunables.h
d7fdbd
+++ b/tunables.h
d7fdbd
@@ -67,6 +67,8 @@ extern int tunable_force_local_data_ssl;      /* Require local data uses SSL */
d7fdbd
 extern int tunable_sslv2;                     /* Allow SSLv2 */
d7fdbd
 extern int tunable_sslv3;                     /* Allow SSLv3 */
d7fdbd
 extern int tunable_tlsv1;                     /* Allow TLSv1 */
d7fdbd
+extern int tunable_tlsv1_1;                   /* Allow TLSv1.1 */
d7fdbd
+extern int tunable_tlsv1_2;                   /* Allow TLSv1.2 */
d7fdbd
 extern int tunable_tilde_user_enable;         /* Support e.g. ~chris */
d7fdbd
 extern int tunable_force_anon_logins_ssl;     /* Require anon logins use SSL */
d7fdbd
 extern int tunable_force_anon_data_ssl;       /* Require anon data uses SSL */
d7fdbd
diff --git a/vsftpd.conf.5 b/vsftpd.conf.5
d7fdbd
index cf1ae34..a3d569e 100644
d7fdbd
--- a/vsftpd.conf.5
d7fdbd
+++ b/vsftpd.conf.5
d7fdbd
@@ -506,7 +506,7 @@ Default: YES
d7fdbd
 Only applies if
d7fdbd
 .BR ssl_enable
d7fdbd
 is activated. If enabled, this option will permit SSL v2 protocol connections.
d7fdbd
-TLS v1 connections are preferred.
d7fdbd
+TLS v1.2 connections are preferred.
d7fdbd
 
d7fdbd
 Default: NO
d7fdbd
 .TP
d7fdbd
@@ -514,7 +514,7 @@ Default: NO
d7fdbd
 Only applies if
d7fdbd
 .BR ssl_enable
d7fdbd
 is activated. If enabled, this option will permit SSL v3 protocol connections.
d7fdbd
-TLS v1 connections are preferred.
d7fdbd
+TLS v1.2 connections are preferred.
d7fdbd
 
d7fdbd
 Default: NO
d7fdbd
 .TP
d7fdbd
@@ -522,7 +522,23 @@ Default: NO
d7fdbd
 Only applies if
d7fdbd
 .BR ssl_enable
d7fdbd
 is activated. If enabled, this option will permit TLS v1 protocol connections.
d7fdbd
-TLS v1 connections are preferred.
d7fdbd
+TLS v1.2 connections are preferred.
d7fdbd
+
d7fdbd
+Default: YES
d7fdbd
+.TP
d7fdbd
+.B ssl_tlsv1_1
d7fdbd
+Only applies if
d7fdbd
+.BR ssl_enable
d7fdbd
+is activated. If enabled, this option will permit TLS v1.1 protocol connections.
d7fdbd
+TLS v1.2 connections are preferred.
d7fdbd
+
d7fdbd
+Default: YES
d7fdbd
+.TP
d7fdbd
+.B ssl_tlsv1_2
d7fdbd
+Only applies if
d7fdbd
+.BR ssl_enable
d7fdbd
+is activated. If enabled, this option will permit TLS v1.2 protocol connections.
d7fdbd
+TLS v1.2 connections are preferred.
d7fdbd
 
d7fdbd
 Default: YES
d7fdbd
 .TP
d7fdbd
@@ -1044,7 +1060,7 @@ man page for further details. Note that restricting ciphers can be a useful
d7fdbd
 security precaution as it prevents malicious remote parties forcing a cipher
d7fdbd
 which they have found problems with.
d7fdbd
 
d7fdbd
-Default: DES-CBC3-SHA
d7fdbd
+Default: AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384
d7fdbd
 .TP
d7fdbd
 .B user_config_dir
d7fdbd
 This powerful option allows the override of any config option specified in
d7fdbd
-- 
d7fdbd
2.14.4
d7fdbd