Skip to content

Instantly share code, notes, and snippets.

@calebcase
Created August 8, 2018 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calebcase/3688f5b2e739f7003b9963d38b3ad651 to your computer and use it in GitHub Desktop.
Save calebcase/3688f5b2e739f7003b9963d38b3ad651 to your computer and use it in GitHub Desktop.
Basic check of domain's certificate status.
#!/bin/bash
set -euo pipefail
name=${1?You must set the DNS name to check.}
host=${2:-$1}
port=${3:-443}
# https://www.shellhacks.com/openssl-check-ssl-certificate-expiration-date/
echo | openssl s_client -servername "$name" -connect "$host":"$port" 2>/dev/null | openssl x509 -noout -subject -issuer -startdate -enddate -ocsp_uri -fingerprint -sha256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment