BASH Script: Check SSL certificate(s) for expiration

A Bash script to retrieve and check expiration date on given certificate(s).
This can be a file, website/internet site, or a list.

show_ssl_expire [-h] [-c] [-d DAYS] [-f FILENAME] | [-w WEBSITE] | [-s SITELIST]

Retrieve the expiration date(s) on SSL certificate(s) using OpenSSL.

Usage:
-h Help

-c Color output

-d Amount of days to show warnings (default is 30 days)
Example: -d 15

-f SSL date from FILENAME
Example: -f /home/user/example.pem

-w SSL date from SITE(:PORT) (Port defaults to 443)
Example: -w www.example.com

-s SSL date(s) from SITELIST
Example: -s ./websites.txt
List format: sub.domain.tld:993 (one per line - port optional)

Example:
$ show_ssl_expire -c -d 14 -s ./websites.txt

WARNS (in color) if within 14 days of expiring on each entry in the file list.

If no arguments/flags given the script defaults to interactive mode/loop.

Full script is located here: gist.github.com/bmatthewshea

Leave a Reply

Your email address will not be published. Required fields are marked *