Skip to content

Commit

Permalink
fix(ssl): load fullchain in openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
martinopresnik authored and irmana committed May 30, 2018
1 parent 1ae584a commit 8756a51
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ void parse_config(const char *json_string, config_t *config)
if (ssl_enabled)
{
config->proxies[config->num_proxies - 1]->ssl_context = SSL_CTX_new(SSLv23_method());
if (!SSL_CTX_use_certificate_file(config->proxies[config->num_proxies - 1]->ssl_context, certificate_path->valuestring, SSL_FILETYPE_PEM))
if (!SSL_CTX_use_certificate_chain_file(config->proxies[config->num_proxies - 1]->ssl_context, certificate_path->valuestring))
{
log_error("Could not load certificate file: %s", certificate_path->valuestring);
int err = ERR_get_error();
log_error("Could not load certificate file: %s; reason: %s", certificate_path->valuestring, ERR_error_string(err, NULL));
ssl_enabled = false;
}
if (ssl_enabled && !SSL_CTX_use_PrivateKey_file(config->proxies[config->num_proxies - 1]->ssl_context, key_path->valuestring, SSL_FILETYPE_PEM))
{
log_error("Could not load key file: %s or key doesn't match certificate: %s", key_path->valuestring, certificate_path->valuestring);
int err = ERR_get_error();
log_error("Could not load key file: %s or key doesn't match certificate: %s; reason: %s", key_path->valuestring, certificate_path->valuestring, ERR_error_string(err, NULL));
ssl_enabled = false;
}
}
Expand Down

0 comments on commit 8756a51

Please sign in to comment.