From 76e2c1b0878f3d000e8c6c4076354405c2a344fc Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 15 May 2018 18:38:34 +0200 Subject: [PATCH] abort startup when using SSLv2 for a server endpoint (#5339) --- CHANGELOG | 6 ++++++ .../Books/Manual/Administration/Configuration/SSL.md | 6 +++++- arangosh/Shell/ClientFeature.cpp | 5 +++++ lib/SimpleHttpClient/SslClientConnection.cpp | 8 +------- lib/Ssl/SslServerFeature.cpp | 8 ++++++++ lib/Ssl/SslServerFeature.h | 1 + lib/Ssl/ssl-helper.cpp | 8 -------- lib/Ssl/ssl-helper.h | 9 ++++++++- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 039f21bfd3..d37ea6b01f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,12 @@ devel ----- +* abort startup when using SSLv2 for a server endpoint, or when connecting with + a client tool via an SSLv2 connection. + + SSLv2 has been disabled in the OpenSSL library by default in recent versions + because of security vulnerabilities inherent in this protocol. + * added startup option `--log.escape` This option toggles the escaping of log output. diff --git a/Documentation/Books/Manual/Administration/Configuration/SSL.md b/Documentation/Books/Manual/Administration/Configuration/SSL.md index a425840602..63da3a0276 100644 --- a/Documentation/Books/Manual/Administration/Configuration/SSL.md +++ b/Documentation/Books/Manual/Administration/Configuration/SSL.md @@ -89,7 +89,7 @@ The certificates in *filename* must be PEM formatted. Use this option to specify the default encryption protocol to be used. The following variants are available: -- 1: SSLv2 +- 1: SSLv2 (unsupported) - 2: SSLv2 or SSLv3 (negotiated) - 3: SSLv3 - 4: TLSv1 @@ -97,6 +97,10 @@ following variants are available: The default *value* is 5 (TLSv1.2). +Note that SSLv2 is unsupported as of ArangoDB 3.4, because of the inherent +security vulnerabilities in this protocol. Selecting SSLv2 as protocol will +abort the startup. + ### SSL cache `--ssl.session-cache value` diff --git a/arangosh/Shell/ClientFeature.cpp b/arangosh/Shell/ClientFeature.cpp index c44ae0252b..97012f2b9a 100644 --- a/arangosh/Shell/ClientFeature.cpp +++ b/arangosh/Shell/ClientFeature.cpp @@ -129,6 +129,11 @@ void ClientFeature::collectOptions(std::shared_ptr options) { } void ClientFeature::validateOptions(std::shared_ptr options) { + if (_sslProtocol == 1) { + LOG_TOPIC(FATAL, arangodb::Logger::SSL) << "SSLv2 is not supported any longer because of security vulnerabilities in this protocol"; + FATAL_ERROR_EXIT(); + } + // if a username is specified explicitly, assume authentication is desired if (options->processingResult().touched("server.username")) { _authentication = true; diff --git a/lib/SimpleHttpClient/SslClientConnection.cpp b/lib/SimpleHttpClient/SslClientConnection.cpp index 576f67e231..0204b3e065 100644 --- a/lib/SimpleHttpClient/SslClientConnection.cpp +++ b/lib/SimpleHttpClient/SslClientConnection.cpp @@ -213,12 +213,6 @@ void SslClientConnection::init(uint64_t sslProtocol) { SSL_METHOD SSL_CONST* meth = nullptr; switch (SslProtocol(sslProtocol)) { -#ifndef OPENSSL_NO_SSL2 - case SSL_V2: - meth = SSLv2_method(); - break; -#endif - #ifndef OPENSSL_NO_SSL3_METHOD case SSL_V3: meth = SSLv3_method(); @@ -235,7 +229,7 @@ void SslClientConnection::init(uint64_t sslProtocol) { case TLS_V12: case SSL_UNKNOWN: default: - // default is to use TLSv13 + // default is to use TLSv12 meth = TLS_method(); break; #else diff --git a/lib/Ssl/SslServerFeature.cpp b/lib/Ssl/SslServerFeature.cpp index c1425e1d61..26b8edb230 100644 --- a/lib/Ssl/SslServerFeature.cpp +++ b/lib/Ssl/SslServerFeature.cpp @@ -92,6 +92,14 @@ void SslServerFeature::collectOptions(std::shared_ptr options) { new StringParameter(&_ecdhCurve)); } +void SslServerFeature::validateOptions(std::shared_ptr options) { + // check for SSLv2 + if (_sslProtocol == 1) { + LOG_TOPIC(FATAL, arangodb::Logger::SSL) << "SSLv2 is not supported any longer because of security vulnerabilities in this protocol"; + FATAL_ERROR_EXIT(); + } +} + void SslServerFeature::prepare() { LOG_TOPIC(INFO, arangodb::Logger::SSL) << "using SSL options: " << stringifySslOptions(_sslOptions); diff --git a/lib/Ssl/SslServerFeature.h b/lib/Ssl/SslServerFeature.h index 752738ee5c..b9472a647c 100644 --- a/lib/Ssl/SslServerFeature.h +++ b/lib/Ssl/SslServerFeature.h @@ -42,6 +42,7 @@ class SslServerFeature : public application_features::ApplicationFeature { public: void collectOptions(std::shared_ptr) override; + void validateOptions(std::shared_ptr) override; void prepare() override final; void unprepare() override final; diff --git a/lib/Ssl/ssl-helper.cpp b/lib/Ssl/ssl-helper.cpp index de5a9f3958..4029408e47 100644 --- a/lib/Ssl/ssl-helper.cpp +++ b/lib/Ssl/ssl-helper.cpp @@ -46,11 +46,6 @@ asio::ssl::context arangodb::sslContext( context::method meth; switch (protocol) { -#ifndef OPENSSL_NO_SSL2 - case SSL_V2: - meth = context::method::sslv2; - break; -#endif #ifndef OPENSSL_NO_SSL3_METHOD case SSL_V3: meth = context::method::sslv3; @@ -107,9 +102,6 @@ asio::ssl::context arangodb::sslContext( std::string arangodb::protocolName(SslProtocol protocol) { switch (protocol) { - case SSL_V2: - return "SSLv2"; - case SSL_V23: return "SSLv23"; diff --git a/lib/Ssl/ssl-helper.h b/lib/Ssl/ssl-helper.h index 1a8339b77b..87f334d232 100644 --- a/lib/Ssl/ssl-helper.h +++ b/lib/Ssl/ssl-helper.h @@ -36,7 +36,14 @@ namespace arangodb { // SSL protocol methods enum SslProtocol { SSL_UNKNOWN = 0, - SSL_V2 = 1, + // removed SSL_V2 here, because newer versions of OpenSSL do not + // include it by default. + // from https://www.openssl.org/news/cl110.txt: + // Changes between 1.0.2f and 1.0.2g [1 Mar 2016] + // * Disable SSLv2 default build, default negotiation and weak ciphers. SSLv2 + // is by default disabled at build-time. Builds that are not configured with + // "enable-ssl2" will not support SSLv2. + // SSL_V2 = 1, SSL_V23 = 2, SSL_V3 = 3, TLS_V1 = 4,