📜 SSL / TLS certificates
My OpenSSL notes for everything around certificates.
| I want to… | Note |
|---|---|
| make a key and a certificate request (CSR) with SANs | CSR best practices |
check a CSR, key, certificate or .p12, and whether a key fits a certificate | SSL checks |
| get the public key out of a private key | Extract the public key |
| run my own certificate authority | Set up your own CA with OpenSSL |
| build certificate bundles and hash links, with safe permissions | SSL rehash and file permissions |
⚡ Quick reference
# when does the certificate of a website expire?
openssl s_client -connect tlnd.org:443 -servername tlnd.org </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
# what is in this certificate?
openssl x509 -in cert.pem -noout -text | less
# do this key and this certificate belong together? (the two hashes must be equal)
openssl pkey -in key.pem -pubout | sha256sum
openssl x509 -in cert.pem -pubkey -noout | sha256sum
🛠️ On GitHub
| Repository | What it is |
|---|---|
| check-SSL-expiry-in-daysbash-script | A bash script that shows how many days a certificate is still valid, also for a whole list of domains |
| caddy_config_examples | Caddy v2 configuration examples (automatic HTTPS) |
| Cloudflare-ufw-rule-creator | Allow only Cloudflare’s IP ranges through UFW, for a site behind Cloudflare |
🔗 Go deeper
- TLS, WireGuard, FIDO2 and Signal: what a certificate proves and how HTTPS uses it
- S/MIME: certificates for email
- Fetchmail and OpenSSL: when a mail client doesn’t trust a certificate