brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: openssl version -d shows where OpenSSL looks for its config and CA store

Openssl
~/tips/tip-openssl-version-openssldir

openssl version -d

Find the folder OpenSSL uses for openssl.cnf and trusted certificates on this machine.

When a certificate is trusted by one tool and not by another, the two are often reading different CA stores. openssl version -d tells you where this OpenSSL looks.

Ask for the directory, or for everything at once:

openssl version -d
openssl version -a

On Debian and Ubuntu the first prints OPENSSLDIR: "/usr/lib/ssl", where openssl.cnf, certs and cert.pem are links into /etc/ssl. That cert.pem points at ca-certificates.crt, the trust store OpenSSL uses by default. Homebrew on macOS has its own folder under the Homebrew prefix. -a adds the build date, platform, compiler flags and the folder for modules such as providers.

I’d check this first when a script fails with unable to get local issuer certificate while a browser on the same machine is fine. Browsers often use their own trust store or the system keychain, so they can trust a CA that OpenSSL has never heard of.

macOS adds a twist: /usr/bin/openssl is LibreSSL, while a Homebrew openssl is the real OpenSSL, each with its own folder. Run which -a openssl to see which ones you have. To trust a homelab CA system wide on Debian or Ubuntu, do not drop files in OPENSSLDIR by hand; put the CA in /usr/local/share/ca-certificates and run update-ca-certificates.

Further reading: OpenSSL: openssl-version, Debian: update-ca-certificates

More Openssl tips openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null | openssl x509 -noout -subject openssl x509 -in cert.pem -days 365 -signkey key.pem -out cert-new.pem printf %s hello | openssl dgst -sha256 -hmac secret openssl pkcs12 -legacy -in old.pfx -nokeys echo 'aGVsbG8gd29ybGQ=' | openssl base64 -d All Openssl tips (34) All topics

Link