Skip to content

Instantly share code, notes, and snippets.

@forestbaker
Created December 5, 2015 02:21
Show Gist options
  • Save forestbaker/5b7cb60e0f8316ea0a64 to your computer and use it in GitHub Desktop.
Save forestbaker/5b7cb60e0f8316ea0a64 to your computer and use it in GitHub Desktop.
6 week check ssl certificate expiration
#!/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