January 2019
Intermediate to advanced
798 pages
20h 33m
English
We could find out the certificate expiry time with an openssl command such as this:
$ echo | openssl s_client -connect www.google.com:443 2>/dev/null | openssl x509 -noout -enddate
Feel free to use any other domain for testing here and later.
We're closing stdin for the openssl command with echo and passing the retrieved certificate information to another openssl command, x509, to return the date and time when the certificate will expire:
notAfter=Jan 30 08:59:00 2019 GMT
The resulting string isn't something we could easily parse in Zabbix, though. We could convert it into a UNIX timestamp like this:
$ date -d "$(echo | openssl s_client -connect www.google.com:443 2>/dev/null | openssl x509 -noout -enddate ...
Read now
Unlock full access