Created
December 5, 2015 02:21
-
-
Save forestbaker/5b7cb60e0f8316ea0a64 to your computer and use it in GitHub Desktop.
6 week check ssl certificate expiration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# rough function of http://blog.commandlinekungfu.com/2014/06/episode-179-check-is-in-mail.html | |
check_CertExpire() { | |
for d in "$@"; do | |
echo -ne $d\\t; | |
[[ $(( $(date +%s -d "$(echo | openssl s_client -connect www.$d:443 2>/dev/null | | |
openssl x509 -noout -dates | tail -1 | cut -f2 -d=)") - $(date +%s) )) | |
-gt 3628800 ]] && echo GOOD || echo EXPIRING; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment