Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: check for the capath by default #11987

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Expand Up @@ -1011,9 +1011,13 @@ elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT)
endif()
endif()

if(CURL_CA_PATH_SET AND NOT USE_OPENSSL AND NOT USE_MBEDTLS)
if(CURL_CA_PATH_SET AND
NOT USE_OPENSSL AND
NOT USE_WOLFSSL AND
NOT USE_GNUTLS AND
NOT USE_MBEDTLS)
message(STATUS
"CA path only supported by OpenSSL, GnuTLS or mbed TLS. "
"CA path only supported by OpenSSL, wolfSSL, GnuTLS or mbedTLS. "
"Set CURL_CA_PATH=none or enable one of those TLS backends.")
endif()

Expand Down
20 changes: 14 additions & 6 deletions acinclude.m4
Expand Up @@ -1469,7 +1469,7 @@ AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
AS_HELP_STRING([--with-ca-path=DIRECTORY],
[Path to a directory containing CA certificates stored individually, with \
their filenames in a hash format. This option can be used with the OpenSSL, \
GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \
GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
(example: /etc/certificates)])
AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
[
Expand All @@ -1495,8 +1495,11 @@ AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
capath="no"
elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
dnl --with-ca-path given
if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then
AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS])
if test "x$OPENSSL_ENABLED" != "x1" -a \
"x$GNUTLS_ENABLED" != "x1" -a \
"x$MBEDTLS_ENABLED" != "x1" -a \
"x$WOLFSSL_ENABLED" != "x1"; then
AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS, mbedTLS or wolfSSL])
fi
capath="$want_capath"
ca="no"
Expand Down Expand Up @@ -1530,9 +1533,14 @@ AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
fi
done
fi
if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
"x$OPENSSL_ENABLED" = "x1"; then
check_capath="/etc/ssl/certs/"
AC_MSG_NOTICE([want $want_capath ca $ca])
if test "x$want_capath" = "xunset"; then
if test "x$OPENSSL_ENABLED" = "x1" -o \
"x$GNUTLS_ENABLED" = "x1" -o \
"x$MBEDTLS_ENABLED" = "x1" -o \
"x$WOLFSSL_ENABLED" = "x1"; then
check_capath="/etc/ssl/certs/"
fi
fi
else
dnl no option given and cross-compiling
Expand Down
7 changes: 5 additions & 2 deletions lib/vquic/curl_ngtcp2.c
Expand Up @@ -648,10 +648,13 @@ static CURLcode quic_ssl_ctx(WOLFSSL_CTX **pssl_ctx,
const char * const ssl_capath = conn->ssl_config.CApath;

wolfSSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);
if(conn->ssl_config.CAfile || conn->ssl_config.CApath) {
if(ssl_cafile || ssl_capath) {
/* tell wolfSSL where to find CA certificates that are used to verify
the server's certificate. */
if(!wolfSSL_CTX_load_verify_locations(ssl_ctx, ssl_cafile, ssl_capath)) {
int rc =
wolfSSL_CTX_load_verify_locations_ex(ssl_ctx, ssl_cafile, ssl_capath,
WOLFSSL_LOAD_FLAG_IGNORE_ERR);
if(SSL_SUCCESS != rc) {
/* Fail if we insist on successfully verifying the server. */
failf(data, "error setting certificate verify locations:"
" CAfile: %s CApath: %s",
Expand Down
10 changes: 7 additions & 3 deletions lib/vtls/wolfssl.c
Expand Up @@ -547,9 +547,12 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
#ifndef NO_FILESYSTEM
/* load trusted cacert from file if not blob */
if(ssl_cafile || ssl_capath) {
if(1 != wolfSSL_CTX_load_verify_locations(backend->ctx,
ssl_cafile,
ssl_capath)) {
int rc =
wolfSSL_CTX_load_verify_locations_ex(backend->ctx,
ssl_cafile,
ssl_capath,
WOLFSSL_LOAD_FLAG_IGNORE_ERR);
if(SSL_SUCCESS != rc) {
if(conn_config->verifypeer && !imported_ca_info_blob &&
!imported_native_ca) {
/* Fail if we insist on successfully verifying the server. */
Expand Down Expand Up @@ -1378,6 +1381,7 @@ const struct Curl_ssl Curl_ssl_wolfssl = {
#ifdef USE_BIO_CHAIN
SSLSUPP_HTTPS_PROXY |
#endif
SSLSUPP_CA_PATH |
SSLSUPP_CAINFO_BLOB |
SSLSUPP_SSL_CTX,

Expand Down