Skip to content

Commit 03f4a0f

Browse files
rsomla1silvakid
authored andcommitted
Merge from CDK: Restrict allowed TLS ciphers.
1 parent dad63f0 commit 03f4a0f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cdk/foundation/connection_yassl.cc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ POP_SYS_WARNINGS
3434
#include "connection_tcpip_base.h"
3535

3636

37+
static const char* tls_ciphers_list="DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:"
38+
"AES128-RMD:DES-CBC3-RMD:DHE-RSA-AES256-RMD:"
39+
"DHE-RSA-AES128-RMD:DHE-RSA-DES-CBC3-RMD:"
40+
"AES256-SHA:RC4-SHA:RC4-MD5:DES-CBC3-SHA:"
41+
"DES-CBC-SHA:EDH-RSA-DES-CBC3-SHA:"
42+
"EDH-RSA-DES-CBC-SHA:AES128-SHA:AES256-RMD:";
43+
static const char* tls_cipher_blocked= "!aNULL:!eNULL:!EXPORT:!LOW:!MD5:!DES:!RC2:!RC4:!PSK:!SSLv3:";
44+
45+
3746
static void throw_yassl_error_msg(const char* msg)
3847
{
3948
throw cdk::foundation::Error(cdk::foundation::cdkerrc::tls_error,
@@ -103,7 +112,7 @@ void connection_TLS_impl::do_connect()
103112

104113
try
105114
{
106-
yaSSL::SSL_METHOD* method = yaSSL::TLSv1_client_method();
115+
yaSSL::SSL_METHOD* method = yaSSL::TLSv1_1_client_method();
107116

108117
if (!method)
109118
throw_yassl_error();
@@ -112,6 +121,13 @@ void connection_TLS_impl::do_connect()
112121
if (!m_tls_ctx)
113122
throw_yassl_error();
114123

124+
125+
std::string cipher_list;
126+
cipher_list.append(tls_cipher_blocked);
127+
cipher_list.append(tls_ciphers_list);
128+
129+
SSL_CTX_set_cipher_list(m_tls_ctx, cipher_list.c_str());
130+
115131
if (!m_options.get_ca().empty() ||
116132
!m_options.get_ca_path().empty())
117133
{

0 commit comments

Comments
 (0)