How do you inspect an HTTPS server with `openssl` and `curl` for expiry monitoring?
IntermediateConceptCommand-Line Tools & Diagnostics
Answer
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -enddate
openssl x509 -checkend 1209600 -noout -in cert.pem && echo ok || echo "expires within 14 days"
curl -vI https://example.com 2>&1 | grep -E "expire date|subject:|issuer:"
Feed the first command into cron or a Prometheus blackbox exporter and alert at 21 and 7 days.
More on Command-Line Tools & Diagnostics
How do you check if a remote port is open?BeginnerHow do you list listening ports and the processes that own them?BeginnerWhat does `ping` tell you and what does it not?BeginnerHow does traceroute work and how do you read the output?BeginnerWhat is mtr and why is it better than traceroute?IntermediateHow do you query DNS with dig and read the answer?Beginner