How do you inspect a remote server's certificate from the command line?
IntermediateConceptHTTP, TLS & Certificates
Answer
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -fingerprint -sha256
# show full chain
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
Check Verify return code: 0 (ok) at the end. Use -verify_hostname example.com to test name matching.
More on HTTP, TLS & Certificates
What is the structure of an HTTP request and response?BeginnerWhich HTTP status code classes and codes should every DevOps engineer know?BeginnerWhat are the common HTTP methods and which are idempotent?BeginnerWhat changed between HTTP/1.1, HTTP/2 and HTTP/3?IntermediateHow does QUIC differ from TCP+TLS?AdvancedWhat are HTTP keep-alive and connection reuse, and why do they matter?Advanced