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 storeutl lists every certificate in a bundle file

Openssl
~/tips/tip-openssl-storeutl-bundle

openssl storeutl -noout -certs fullchain.pem

See all certificates in a chain or CA bundle, since x509 only reads the first one.

openssl x509 -in fullchain.pem shows the first certificate and silently ignores the rest. To see everything in a bundle I’d use storeutl.

List what is in the file, then show the subjects:

openssl storeutl -noout -certs fullchain.pem
openssl storeutl -noout -text -certs fullchain.pem | grep -E '^[0-9]+:|Subject:|Not After'

The first command prints numbered entries like 0: Certificate and 1: Certificate, followed by Total found: 2. The second adds the subject and expiry date of each one. In a correct fullchain.pem, entry 0 is your server certificate and the next ones are the intermediates, in order.

I find it most useful for a bundle someone else built: a wrong order, a missing intermediate, or an expired cross-signed certificate is easy to spot this way. It also reads the big CA bundles that ship with your system, though the output gets long.

storeutl came with OpenSSL 1.1.1, so very old systems do not have it. There, openssl crl2pkcs7 -nocrl -certfile bundle.pem | openssl pkcs7 -print_certs -noout lists the subjects instead. Without -certs, storeutl also lists private keys that may be in the file, so be careful where you paste the output.

Further reading: OpenSSL: openssl-storeutl

Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get

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