MXS-2839: Make ssl_ca_cert optional
Not defining ssl_ca_cert causes the system default verification chain to be used.
This commit is contained in:
@ -2756,15 +2756,6 @@ bool config_create_ssl(const char* name,
|
||||
char* ssl_key = config_get_value(params, CN_SSL_KEY);
|
||||
char* ssl_ca_cert = config_get_value(params, CN_SSL_CA_CERT);
|
||||
|
||||
if (ssl_ca_cert == NULL)
|
||||
{
|
||||
MXS_ERROR("CA Certificate missing for '%s'."
|
||||
"Please provide the path to the certificate authority "
|
||||
"certificate by adding the ssl_ca_cert=<path> parameter",
|
||||
name);
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (require_cert)
|
||||
{
|
||||
if (ssl_cert == NULL)
|
||||
@ -2803,7 +2794,7 @@ bool config_create_ssl(const char* name,
|
||||
|
||||
listener_set_certificates(ssl, ssl_cert, ssl_key, ssl_ca_cert);
|
||||
|
||||
mxb_assert(access(ssl_ca_cert, F_OK) == 0);
|
||||
mxb_assert(!ssl_ca_cert || access(ssl_ca_cert, F_OK) == 0);
|
||||
mxb_assert(!ssl_cert || access(ssl_cert, F_OK) == 0);
|
||||
mxb_assert(!ssl_key || access(ssl_key, F_OK) == 0);
|
||||
|
||||
|
||||
@ -378,12 +378,18 @@ bool SSL_LISTENER_init(SSL_LISTENER* ssl)
|
||||
SSL_CTX_set_tmp_rsa_callback(ctx, tmp_rsa_callback);
|
||||
}
|
||||
|
||||
mxb_assert(ssl->ssl_ca_cert);
|
||||
|
||||
/* Load the CA certificate into the SSL_CTX structure */
|
||||
if (!SSL_CTX_load_verify_locations(ctx, ssl->ssl_ca_cert, NULL))
|
||||
if (ssl->ssl_ca_cert)
|
||||
{
|
||||
MXS_ERROR("Failed to set Certificate Authority file: %s", get_ssl_errors());
|
||||
/* Load the CA certificate into the SSL_CTX structure */
|
||||
if (!SSL_CTX_load_verify_locations(ctx, ssl->ssl_ca_cert, NULL))
|
||||
{
|
||||
MXS_ERROR("Failed to set Certificate Authority file: %s", get_ssl_errors());
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
else if (SSL_CTX_set_default_verify_paths(ctx) == 0)
|
||||
{
|
||||
MXS_ERROR("Failed to set default CA verify paths: %s", get_ssl_errors());
|
||||
rval = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user