Created
December 4, 2012 16:38
-
-
Save holly/4205943 to your computer and use it in GitHub Desktop.
openssl remote certificate remaining days one-liner function
This file contains 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
remote_cert_remaining_days() { cert_remaining_time=$(date -d "$(openssl s_client -connect $1 2>/dev/null </dev/null | openssl x509 -enddate -noout | cut -d'=' -f2)" "+%s"); current_time=$(date "+%s"); echo remaining $((($cert_remaining_time - $current_time) / 60 / 60 / 24)) days; } |
This file contains 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
$ remote_cert_remaining_days fqdn:443 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice thanks ;)