Useful for Icinga or other alert tool. Checks certificates from service, not file. This detects cases where certificate is renewed but not updated.
Public domain.
Checks if HTTPS (port 443) certificate is valid. Limits are: warning 14 days, critical 7 days. Returns the expiration time and return value is 0, 1, or 2 for OK, WARNING, and CRITICAL, respectively.
./ssl_get_expiration ssl localhost:443 '14 days' '7 days'
The same as above, but for SMTP with STARTTLS and checking validity for a month warning level and 1 day for critical:
./ssl_get_expiration smtp localhost:smtp '1 month' '1 day'