Fix advanced SSL configuration for Keeper's internal communication

This commit is contained in:
Antonio Andelic 2024-12-03 09:44:17 +01:00
parent 541098d0c6
commit d65f440679
13 changed files with 210 additions and 155 deletions

2
contrib/NuRaft vendored

@ -1 +1 @@
Subproject commit ce6de271811899d587fc28b500041ebcf720014f Subproject commit c11f7fce68737cdc67a1d61678b2717d617ebb5a

View File

@ -83,6 +83,7 @@ namespace ErrorCodes
extern const int LOGICAL_ERROR; extern const int LOGICAL_ERROR;
extern const int INVALID_CONFIG_PARAMETER; extern const int INVALID_CONFIG_PARAMETER;
extern const int BAD_ARGUMENTS; extern const int BAD_ARGUMENTS;
extern const int OPENSSL_ERROR;
} }
using namespace std::chrono_literals; using namespace std::chrono_literals;
@ -92,47 +93,39 @@ namespace
#if USE_SSL #if USE_SSL
int callSetCertificate(SSL * ssl, void * arg) auto getSslContextProvider(const Poco::Util::AbstractConfiguration & config, std::string_view key)
{ {
if (!arg) String load_default_ca_file_property = fmt::format("openSSL.{}.loadDefaultCAFile", key);
return -1; String verification_mode_property = fmt::format("openSSL.{}.verificationMode", key);
String root_ca_file_property = fmt::format("openSSL.{}.caConfig", key);
const CertificateReloader::Data * data = reinterpret_cast<CertificateReloader::Data *>(arg); String prefer_server_cypher_property = fmt::format("openSSL.{}.preferServerCiphers", key);
return setCertificateCallback(ssl, data, getLogger("SSLContext")); String private_key_passphrase_property = fmt::format("openSSL.{}.privateKeyPassphraseHandler.options.password", key);
}
void setSSLParams(nuraft::asio_service::options & asio_opts)
{
const Poco::Util::LayeredConfiguration & config = Poco::Util::Application::instance().config();
String certificate_file_property = "openSSL.server.certificateFile";
String private_key_file_property = "openSSL.server.privateKeyFile";
String root_ca_file_property = "openSSL.server.caConfig";
if (!config.has(certificate_file_property))
throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "Server certificate file is not set.");
if (!config.has(private_key_file_property))
throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "Server private key file is not set.");
Poco::Net::Context::Params params; Poco::Net::Context::Params params;
params.certificateFile = config.getString(certificate_file_property); String certificate_file_property = fmt::format("openSSL.{}.certificateFile", key);
if (params.certificateFile.empty()) String private_key_file_property = fmt::format("openSSL.{}.privateKeyFile", key);
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Server certificate file in config '{}' is empty", certificate_file_property); if (config.has(certificate_file_property))
params.certificateFile = config.getString(certificate_file_property);
params.privateKeyFile = config.getString(private_key_file_property); if (config.has(private_key_file_property))
if (params.privateKeyFile.empty()) params.privateKeyFile = config.getString(private_key_file_property);
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Server key file in config '{}' is empty", private_key_file_property);
auto pass_phrase = config.getString("openSSL.server.privateKeyPassphraseHandler.options.password", ""); std::shared_ptr<CertificateReloader::Data> certificate_data;
auto certificate_data = std::make_shared<CertificateReloader::Data>(params.certificateFile, params.privateKeyFile, pass_phrase); if (config.has(private_key_passphrase_property))
{
certificate_data = std::make_shared<CertificateReloader::Data>(
params.certificateFile, params.privateKeyFile, config.getString(private_key_passphrase_property));
params.certificateFile.clear();
params.privateKeyFile.clear();
}
if (config.has(root_ca_file_property)) if (config.has(root_ca_file_property))
params.caLocation = config.getString(root_ca_file_property); params.caLocation = config.getString(root_ca_file_property);
params.loadDefaultCAs = config.getBool("openSSL.server.loadDefaultCAFile", false); params.loadDefaultCAs = config.getBool(load_default_ca_file_property, false);
params.verificationMode = Poco::Net::Utility::convertVerificationMode(config.getString("openSSL.server.verificationMode", "none")); params.verificationMode = Poco::Net::Utility::convertVerificationMode(config.getString(verification_mode_property, "none"));
std::string disabled_protocols_list = config.getString("openSSL.server.disableProtocols", ""); std::string disabled_protocols_list = config.getString(fmt::format("openSSL.{}.disableProtocols", key), "");
Poco::StringTokenizer dp_tok(disabled_protocols_list, ";,", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); Poco::StringTokenizer dp_tok(disabled_protocols_list, ";,", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY);
int disabled_protocols = 0; int disabled_protocols = 0;
for (const auto & token : dp_tok) for (const auto & token : dp_tok)
@ -149,21 +142,54 @@ void setSSLParams(nuraft::asio_service::options & asio_opts)
disabled_protocols |= Poco::Net::Context::PROTO_TLSV1_2; disabled_protocols |= Poco::Net::Context::PROTO_TLSV1_2;
} }
asio_opts.ssl_context_provider_server_ = [params, certificate_data, disabled_protocols] auto prefer_server_cypher = config.getBool(fmt::format("openSSL.{}.preferServerCiphers", key), false);
auto cache_sessions = config.getBool(fmt::format("openSSL.{}.cache_sessions", key), false);
return [params, disabled_protocols, prefer_server_cypher, cache_sessions, is_server = key == "server", certificate_data]
{ {
Poco::Net::Context context(Poco::Net::Context::Usage::TLSV1_2_SERVER_USE, params); Poco::Net::Context context(is_server ? Poco::Net::Context::Usage::SERVER_USE : Poco::Net::Context::Usage::CLIENT_USE, params);
context.disableProtocols(disabled_protocols); context.disableProtocols(disabled_protocols);
SSL_CTX * ssl_ctx = context.takeSslContext();
SSL_CTX_set_cert_cb(ssl_ctx, callSetCertificate, reinterpret_cast<void *>(certificate_data.get()));
return ssl_ctx;
};
asio_opts.ssl_context_provider_client_ = [ctx_params = std::move(params)] if (prefer_server_cypher)
{ context.preferServerCiphers();
Poco::Net::Context context(Poco::Net::Context::Usage::TLSV1_2_CLIENT_USE, ctx_params);
if (cache_sessions)
context.enableSessionCache();
auto * ssl_ctx = context.sslContext();
if (certificate_data)
{
if (auto err = SSL_CTX_clear_chain_certs(ssl_ctx); err != 1)
throw Exception(ErrorCodes::OPENSSL_ERROR, "Clear certificates {}", Poco::Net::Utility::getLastError());
if (auto err = SSL_CTX_use_certificate(ssl_ctx, const_cast<X509 *>(certificate_data->certs_chain[0].certificate())); err != 1)
throw Exception(ErrorCodes::OPENSSL_ERROR, "Use certificate {}", Poco::Net::Utility::getLastError());
for (auto cert = certificate_data->certs_chain.begin() + 1; cert != certificate_data->certs_chain.end(); cert++)
{
if (auto err = SSL_CTX_add1_chain_cert(ssl_ctx, const_cast<X509 *>(cert->certificate())); err != 1)
throw Exception(ErrorCodes::OPENSSL_ERROR, "Add certificate to chain {}", Poco::Net::Utility::getLastError());
}
if (auto err = SSL_CTX_use_PrivateKey(ssl_ctx, const_cast<EVP_PKEY *>(static_cast<const EVP_PKEY *>(certificate_data->key))); err != 1)
throw Exception(ErrorCodes::OPENSSL_ERROR, "Use private key {}", Poco::Net::Utility::getLastError());
if (auto err = SSL_CTX_check_private_key(ssl_ctx); err != 1)
throw Exception(ErrorCodes::OPENSSL_ERROR, "Unusable key-pair {}", Poco::Net::Utility::getLastError());
}
return context.takeSslContext(); return context.takeSslContext();
}; };
} }
void setSSLParams(nuraft::asio_service::options & asio_opts)
{
asio_opts.enable_ssl_ = true;
const Poco::Util::LayeredConfiguration & config = Poco::Util::Application::instance().config();
asio_opts.ssl_context_provider_server_ = getSslContextProvider(config, "server");
asio_opts.ssl_context_provider_client_ = getSslContextProvider(config, "client");
}
#endif #endif
std::string checkAndGetSuperdigest(const String & user_and_digest) std::string checkAndGetSuperdigest(const String & user_and_digest)
@ -483,7 +509,6 @@ void KeeperServer::launchRaftServer(const Poco::Util::AbstractConfiguration & co
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "SSL support for NuRaft is disabled because ClickHouse was built without SSL support."); throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "SSL support for NuRaft is disabled because ClickHouse was built without SSL support.");
#endif #endif
} }
if (is_recovering) if (is_recovering)
enterRecoveryMode(params); enterRecoveryMode(params);

View File

@ -1,20 +1,22 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDPDCCAiQCFBXNOvsLA+dqmX/TkYG9JXdD5m72MA0GCSqGSIb3DQEBCwUAMFox MIIDtjCCAp6gAwIBAgIUdOfco+b8/fQZQOafHgghkEYL3YkwDQYJKoZIhvcNAQEL
CzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRl B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oROAy7g2mL0RMw
P3cl+Bod3NrabhjAqG01nHsQzy0uJ/aJHbqoR3OtYo8DdsoKrBRramiG
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,30 +1,28 @@
-----BEGIN RSA PRIVATE KEY----- -----BEGIN PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDUXmnnCv7sY9lb
DEK-Info: AES-256-CBC,4E14FF586022476CD22AAFB662BB0E40 rS1Q3c5q7ok9R4XEPq/jWBFkIEnJR7vSjCEnOjLxg+1MdUItjbqODf9N5vFbHiiq
WQVkGrmg8/CTSme0qyNr7FcmG1hO4bzK/dvIyK1R7YISqZpXoCTVzEnUIjU7f+Pk
dpJZKq5k+fMuC7XECfTSRjPeOEl9wNuVtZkcjEWaHN8ky4umND7ARyRyuU1Nk7cy X2uAiSypxM4zpNyC7++j6ah8xYNRfR9AS5c7e1dvNKBNMmNipYxVgaEopIke40m1
fpCFlFKOqDfCkT5zVK/fB6pF32wqAI7sqeSuYPfQY0+L77yRdwM6L46WslzVKZYE 2ezIzLOtkL/rGlsnM2Tv/0Wv1xQE+OjHByyQE08vuliatFfweTXLF48m4S4NdOq5
lXD1AmqKT/LgF3+eBY5slkAAJo10zYDgKEwnoQVBp31YW2/+6oAGaY/O6x3p7aTG dh2WX8xLPr8BxRLjXzs08wgKVFpWkIOR2uEInjuVQAGMuZeOqUuQGdarGMH4M/3t
dw9CP+SFc0o8lPl1lsSovdNXDUiVCftvClog7hwyDv8AhHyGgynw3UJXX8UlyWu+ Dl0eJ7mbAgMBAAECggEAJwzxZlXESI2Xw17VzV/r/Ae+3rDPLSXly+U+1W2Gg+eX
Zz5zpgrvB2gvDLeoZZ6qjMGvtpEwlYBh4de9ZOsvQUpXEEfkQFtJV0j613OCQune 5wBzfDYcdgKvWPba42uDWWnDf3yu9vVVvvU9o4myhqE0pLDy3ur1SXwdDlnK5D5o
LoTxKpYV1V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wp0jCyiH0CgYAus9B6
9OTC+hstpMSxHlkADlSaQBnVAf8CdvbX2R65FfwYzGEHkGGl5KuDDcd57b2rathG g/jHUU1kxWgKftWTU1yRj41Z+t6cB64fUZmqQTucj9dwSa/0qfAym76kGG8UPtto
rzMbpXA4r/u1fkG2Nf0fbABL5ZA7so4mSTXQSmSM4LpO+I7K2vVh9XC4rzAcX4g/ 6QBM/8YGpEHcZZFSm1MWRZqXJwlp0MeSj3RKEEKf/NOG1OanZQ8kO7E9lt5kewG1
mHoUrQKBgBf3rxp5h9P3HWoZYjzBDo2FqXUjKLLjE9ed5e/VqecqfHIkmueuNHlN OEZaGfeQw2p+G2fAdJiM9DY0+gDC9zRQdEW9/QKBgQCIlZ6ToPdBJPuhKTtV0+c/
xifHr7lpsYu6IXkTnlK14pvLoPuwP59dCIOUYwAFz8RlH4MSUGNhYeGA8cqRrhmJ e3k0+bKy3OIoW+laaRS3JMMyvveQECaLKMsVMYCppJfKCV/NOUnTIw/g1vXuom6I
tYk3OKExuN/+O12kUPVTy6BMH1hBdRJP+7y7lapWsRhZt18y+8Za QZHGK10aWB8bunblKFrSFxfBStgDCPeZklb4ECQP4+QfLb7Xi7fAvfSi0hFP4LNo
-----END RSA PRIVATE KEY----- Ea+Ttp/shik8d0sy217IEQ==
-----END PRIVATE KEY-----

View File

@ -11,6 +11,7 @@
<session_timeout_ms>10000</session_timeout_ms> <session_timeout_ms>10000</session_timeout_ms>
<snapshot_distance>75</snapshot_distance> <snapshot_distance>75</snapshot_distance>
<raft_logs_level>trace</raft_logs_level> <raft_logs_level>trace</raft_logs_level>
<startup_timeout>1000</startup_timeout>
</coordination_settings> </coordination_settings>
<raft_configuration> <raft_configuration>

View File

@ -11,6 +11,7 @@
<session_timeout_ms>10000</session_timeout_ms> <session_timeout_ms>10000</session_timeout_ms>
<snapshot_distance>75</snapshot_distance> <snapshot_distance>75</snapshot_distance>
<raft_logs_level>trace</raft_logs_level> <raft_logs_level>trace</raft_logs_level>
<startup_timeout>1000</startup_timeout>
</coordination_settings> </coordination_settings>
<raft_configuration> <raft_configuration>

View File

@ -11,6 +11,7 @@
<session_timeout_ms>10000</session_timeout_ms> <session_timeout_ms>10000</session_timeout_ms>
<snapshot_distance>75</snapshot_distance> <snapshot_distance>75</snapshot_distance>
<raft_logs_level>trace</raft_logs_level> <raft_logs_level>trace</raft_logs_level>
<startup_timeout>1000</startup_timeout>
</coordination_settings> </coordination_settings>
<raft_configuration> <raft_configuration>

View File

@ -1,21 +1,22 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUUiyhAav08YhTLfUIXLN/0Ln09n4wDQYJKoZIhvcNAQEL MIIDtzCCAp+gAwIBAgIUeJXILNkZb1FYvV7YnFYDB1OUrB4wDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM BQAwazELMAkGA1UEBhMCREUxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTA0MTIxMTQ1MjBaFw0yMTA1 MRAwDgYDVQQKDAdDb21wYW55MQ0wCwYDVQQLDARVbml0MRwwGgYDVQQDDBNUZXN0
MTIxMTQ1MjBaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw Y2x1c3RlciBSb290IENBMB4XDTI0MTIwMjE0MjkyNloXDTM0MTEzMDE0MjkyNlow
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB azELMAkGA1UEBhMCREUxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRAw
AQUAA4IBDwAwggEKAoIBAQDK0Ww4voPlkePBPS2MsEi7e1ePS+CDxTdDuOwWWEA7 DgYDVQQKDAdDb21wYW55MQ0wCwYDVQQLDARVbml0MRwwGgY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hnL2WcPYbo2Np59p7fo9SMbYwF49OZ40twsuKeeoAp BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAEyO49djQOI9qaHc0tvuAtio+qRqT
pfow+y/EBZqa99MY2q6FU6FDA3Rpv0Sdk+/5PHdsSP6cgeMszFBUS0tCQEvEl83n zQN5H8FJS4T7RDZSc3sXaUElY8hD2ecGZPDtxmFZy+IMtSGZcMfKlEr3pugrYwRh
FJUb0vjEX4x3J64XO/0DKXyCxFyF77OwHG2ZV5BeCpIhGXu+d/e221LJkGI2orKR 571dFp1+o8wEmyOU0NHsGmSxCLZOk9nMxZEhLvc722B6oKHTIm3rvxkQqKpdfliE
kgsaUwrkS8HQt3Hd0gYpLI1Opx/JlRpB0VLYLzRGj7kDpbAcTj3SMEUp/FAZmlXR oFW2QZVBteZ04A4AKOs0mkZptycZKMLiht5I2s1gzlbK9084huGmnayW9a3pKWyV
Iiebt73eE3rOWVFgyY9f zpgnugfxEiwjKh7HpF9Mc2M4Z3f483bj/f6+G8Z7668dORQUFUwv/ohxN8w8zfgA
pfrQNknzYfihuFam6/CFzOsT9Nndtuz14N/LKI9csd2ixWTknHPLyMGrVA==
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -8,3 +8,11 @@ openSSL:
cacheSessions: true cacheSessions: true
disableProtocols: 'sslv2,sslv3' disableProtocols: 'sslv2,sslv3'
preferServerCiphers: true preferServerCiphers: true
client:
certificateFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.crt'
caConfig: '/etc/clickhouse-server/config.d/rootCA.pem'
loadDefaultCAFile: true
verificationMode: 'none'
cacheSessions: true
disableProtocols: 'sslv2,sslv3'
preferServerCiphers: true

View File

@ -2,10 +2,18 @@ openSSL:
server: server:
certificateFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.crt' certificateFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.crt'
privateKeyFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.key' privateKeyFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.key'
caConfig: '/etc/clickhouse-server/config.d/rootCA.pem'
privateKeyPassphraseHandler: privateKeyPassphraseHandler:
name: KeyFileHandler name: KeyFileHandler
options: options:
password: 'PASSWORD' password: 'PASSWORD'
loadDefaultCAFile: true
verificationMode: 'none'
cacheSessions: true
disableProtocols: 'sslv2,sslv3'
preferServerCiphers: true
client:
certificateFile: '/etc/clickhouse-server/config.d/WithoutPassPhrase.crt'
caConfig: '/etc/clickhouse-server/config.d/rootCA.pem' caConfig: '/etc/clickhouse-server/config.d/rootCA.pem'
loadDefaultCAFile: true loadDefaultCAFile: true
verificationMode: 'none' verificationMode: 'none'

View File

@ -160,6 +160,9 @@ def check_valid_configuration(filename, password):
for node in nodes: for node in nodes:
setupSsl(node, filename, password) setupSsl(node, filename, password)
start_all_clickhouse() start_all_clickhouse()
nodes[0].wait_for_log_line(
"Raft ASIO listener initiated on :::9234, SSL enabled", look_behind_lines=1000
)
run_test() run_test()
@ -168,9 +171,12 @@ def check_invalid_configuration(filename, password):
for node in nodes: for node in nodes:
setupSsl(node, filename, password) setupSsl(node, filename, password)
nodes[0].start_clickhouse(expected_to_fail=True) nodes[0].start_clickhouse()
nodes[0].wait_for_log_line( nodes[0].wait_for_log_line(
"OpenSSLException: EVPKey::loadKey.*error:0480006C:PEM routines::no start line", "Raft ASIO listener initiated on :::9234, SSL enabled", look_behind_lines=1000
)
nodes[0].wait_for_log_line(
"failed to connect to peer.*Connection refused"
) )