Skip to content

Instantly share code, notes, and snippets.

@holly
holly / remote_cert_remaining_days
Created December 4, 2012 16:38
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; }