mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
TLS: Do not require CA config if not used. (#7862)
The tls-ca-cert or tls-ca-cert-dir configuration parameters are only
used when Redis needs to authenticate peer certificates, in one of these
scenarios:
1. Incoming clients or replicas, with `tls-auth-clients` enabled.
2. A replica authenticating the master's peer certificate.
3. Cluster nodes authenticating other nodes when establishing the bus
protocol connection.
(cherry picked from commit 1591e3479d
)
This commit is contained in:
parent
9ce6fc7322
commit
cb070accb4
@ -167,8 +167,9 @@ int tlsConfigure(redisTLSContextConfig *ctx_config) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!ctx_config->ca_cert_file && !ctx_config->ca_cert_dir) {
|
||||
serverLog(LL_WARNING, "Either tls-ca-cert-file or tls-ca-cert-dir must be configured!");
|
||||
if (((server.tls_auth_clients != TLS_CLIENT_AUTH_NO) || server.tls_cluster || server.tls_replication) &&
|
||||
!ctx_config->ca_cert_file && !ctx_config->ca_cert_dir) {
|
||||
serverLog(LL_WARNING, "Either tls-ca-cert-file or tls-ca-cert-dir must be specified when tls-cluster, tls-replication or tls-auth-clients are enabled!");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -235,7 +236,8 @@ int tlsConfigure(redisTLSContextConfig *ctx_config) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (SSL_CTX_load_verify_locations(ctx, ctx_config->ca_cert_file, ctx_config->ca_cert_dir) <= 0) {
|
||||
if ((ctx_config->ca_cert_file || ctx_config->ca_cert_dir) &&
|
||||
SSL_CTX_load_verify_locations(ctx, ctx_config->ca_cert_file, ctx_config->ca_cert_dir) <= 0) {
|
||||
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
|
||||
serverLog(LL_WARNING, "Failed to configure CA certificate(s) file/directory: %s", errbuf);
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user