Skip to content

Commit

Permalink
libfetch: don't rely on ca_root_nss for certificate validation
Browse files Browse the repository at this point in the history
Before certctl(8), there was no system trust store, and libfetch
relied on the CA certificate bundle from the ca_root_nss port to
verify peers.

We now have a system trust store and a reliable mechanism for
manipulating it (to explicitly add, remove, or revoke certificates),
but if ca_root_nss is installed, libfetch will still prefer that to
the system trust store.

With this change, unless explicitly overridden, libfetch will rely on
OpenSSL to pick up the default system trust store.

PR:		256902
MFC after:	3 days
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D42059

(cherry picked from commit 09f5c1e118bb4eca77b83a0d08f559b20f60aa59)
  • Loading branch information
michael-o authored and laffer1 committed Nov 24, 2023
1 parent 2345f0e commit f484947
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/libfetch/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,6 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose)
/*
* Configure peer verification based on environment.
*/
#define LOCAL_CERT_FILE "/usr/local/etc/ssl/cert.pem"
#define BASE_CERT_FILE "/etc/ssl/cert.pem"
static int
fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose)
{
Expand All @@ -796,12 +794,6 @@ fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose)

if (getenv("SSL_NO_VERIFY_PEER") == NULL) {
ca_cert_file = getenv("SSL_CA_CERT_FILE");
if (ca_cert_file == NULL &&
access(LOCAL_CERT_FILE, R_OK) == 0)
ca_cert_file = LOCAL_CERT_FILE;
if (ca_cert_file == NULL &&
access(BASE_CERT_FILE, R_OK) == 0)
ca_cert_file = BASE_CERT_FILE;
ca_cert_path = getenv("SSL_CA_CERT_PATH");
if (verbose) {
fetch_info("Peer verification enabled");
Expand Down

0 comments on commit f484947

Please sign in to comment.