One-liner: how to check the SSL certificate expiration of several servers

for i in
  exp=`echo | openssl s_client -connect $i:443  2>/dev/null | 
  openssl x509 -noout -dates | fgrep notAfter | sed -e 's/^.*=//'`
  echo "$i        $exp"
done	    Feb  6 12:00:00 2018 GMT   Apr 20 10:01:10 2017 GMT

Leave a Reply

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