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

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