Skip to content

Instantly share code, notes, and snippets.

@holly
holly / remote_cert_remaining_days
Created Dec 4, 2012
openssl remote certificate remaining days one-liner function
View remote_cert_remaining_days
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; }