Skip to content

Commit 89c54ca

Browse files
committed
Disable TLS renegotiation
The API doesn't need it and a customer's security scanner is afraid of a potential DoS attack vector.
1 parent fa00cf8 commit 89c54ca

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/base/tlsutility.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <boost/asio/ssl/context.hpp>
1212
#include <openssl/opensslv.h>
1313
#include <openssl/crypto.h>
14+
#include <openssl/ssl.h>
15+
#include <openssl/ssl3.h>
1416
#include <fstream>
1517

1618
namespace icinga
@@ -91,6 +93,16 @@ static void InitSslContext(const Shared<boost::asio::ssl::context>::Ptr& context
9193

9294
flags |= SSL_OP_CIPHER_SERVER_PREFERENCE;
9395

96+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
97+
SSL_CTX_set_info_callback(sslContext, [](const SSL* ssl, int where, int) {
98+
if (where & SSL_CB_HANDSHAKE_DONE) {
99+
ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
100+
}
101+
});
102+
#else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
103+
flags |= SSL_OP_NO_RENEGOTIATION;
104+
#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
105+
94106
SSL_CTX_set_options(sslContext, flags);
95107

96108
SSL_CTX_set_mode(sslContext, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);

0 commit comments

Comments
 (0)