OpenSSL
Cheat sheet · https://pcornel.dk/topic.php?topic=2867
Answer
OpenSSL is the toolkit for keys, CSRs, certificates and TLS testing: openssl x509, req, pkey, verify, s_client.
Remember
Know the format: PEM (text, BEGIN lines) or DER (binary); PKCS#12 (.pfx) bundles key and chain. Convert with openssl x509 -inform der, openssl pkcs12. Always use -servername with s_client for SNI.
First checks
openssl x509 -in <cert> -noout -subject -issuer -dates -ext subjectAltName— certificate detailsopenssl s_client -connect <host>:443 -servername <name> </dev/null— live chain and verificationopenssl verify -CAfile <ca> -untrusted <chain> <cert>— chain validationtrust list | head / ls /etc/ssl/certs— system trust store
Commands
openssl x509 -in cert.pem -noout -textopenssl req -in req.csr -noout -text -verifyopenssl pkey -in key.pem -noout -textopenssl x509 -noout -pubkeyopenssl pkey -puboutopenssl x509 -in cert.pem -outform DER -out cert.deropenssl verify -CAfile root.pem -untrusted inter.pem leaf.pemopenssl s_client -connect host:443 -servername host -showcertsopenssl s_client -connect host:443 -tls1_2openssl s_client -connect mail:25 -starttls smtp
Verify in this order
file or server → openssl subcommand → decoded or tested → result
Where it usually breaks
First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2867