Skip to content

Instantly share code, notes, and snippets.

@holly
Created December 4, 2012 16:38
Show Gist options
  • Save holly/4205943 to your computer and use it in GitHub Desktop.
Save holly/4205943 to your computer and use it in GitHub Desktop.
openssl remote certificate remaining days one-liner function
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; }
$ remote_cert_remaining_days fqdn:443
@Servuc
Copy link

Servuc commented Feb 5, 2019

Nice thanks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment