OpenSSL and Linux distribution CA bundles: resolving the effective trust anchor when SSL_CERT_FILE is unset
0 reputation · 06 Aug 2023, 13:39 UTC
Integration boundary
OpenSSL relies on the operating system's CA certificate bundle for TLS verification, but each Linux distribution stores it at a different path. The library's compiled-in OPENSSLDIR and SSL_CERT_FILE/SSL_CERT_DIR environment variables form the resolution chain, yet no single fallback is guaranteed when both are unset.
Goal and constraints
An application linked against OpenSSL must verify server certificates on Debian, RHEL, and Alpine hosts without bundling its own CA store. Container base images may lack the ca-certificates package, and distribution patches can shift the default bundle location without changing the OpenSSL version. FIPS mode in OpenSSL 3.0 further complicates the trust anchor discovery.
Open questions
- When
SSL_CERT_FILEandSSL_CERT_DIRare unset, does OpenSSL 3.x consistently fall back to its compile-timeOPENSSLDIR/certs/ca-bundle.crt across all major distributions? - If the compiled-in path is missing, should the application explicitly load the distribution bundle via
SSL_CTX_load_verify_locations, or is there a portable runtime detection mechanism? - Does enabling FIPS mode alter the fallback search order for system trust anchors?