OpenSSL: troubleshooting
Troubleshooting certificate issues is not an easy task. They can be caused by various root causes: Common Name (CN) mismatch, usage of self-signed certificate, expired certificate, invalid cert chain and many other. Fortunately, here we have some commands to help!
Testing client connection
echo | openssl s_client -connect host:443 -state
In this example echo command is used to send a new line and terminate connection and -state prints out the SSL session states.
echo | openssl s_client -connect host:443 -status
"With OSCP, a relying party is able to submit a certificate status request to an OCSP responder, such as a Certification Authority (CA). This returns an authentic, digitally signed response indicating the certificate status." - Entrust
More on OCSP: https://www.entrust.com/knowledgebase/ssl/online-certificate-status-protocol-ocsp-stapling
Verifying cert details
openssl x509 -in cert.pem -text
This command displays contents of a PEM certificate: Issuer, Validity period, CN, X509v3 extensions, etc.
Verifying cert chain
openssl verify -CAfile rootca.pem -untrusted intermediate.pem cert.pem
The verify command verifies certificate chains.
-CAFile a file of trusted certificates, for instance Root CA
-untrusted a file of untrusted certificates, in this case Intermediate CA; openssl will check certificate signature to check if it can be trusted
Specified files can contain multiple concatenated certs in PEM format.
Comments
Post a Comment