Checking SSL Expiry Dates From The Command Line

This is a simple way to check your sites SSL certificate expiry date from the command line.

I’ll probably expand the script to work with lists and to send alerts if under XX days are remaining, but for now it just works with

./ssl_exp.sh your.domain.name
#!/bin/bash

DOMAIN=$1

EXPIRES=$(echo | openssl s_client -connect ${DOMAIN}:443 2>/dev/null | openssl x509 -noout -dates | grep notAfter | awk -F= {'print $2'})

echo "SSL Cert Expires"
echo ${EXPIRES}

Comments are closed, but trackbacks and pingbacks are open.