Skip to content

Instantly share code, notes, and snippets.

@pstadler
Last active June 6, 2018 13:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pstadler/d7dd53bd5876feb877f3e966def03286 to your computer and use it in GitHub Desktop.
Save pstadler/d7dd53bd5876feb877f3e966def03286 to your computer and use it in GitHub Desktop.
Print SSL certificate end dates for a list of domains
#!/bin/sh
domains=(
"example.org"
"example.com:7443"
)
default_port=443
for domain in ${domains[@]}; do
raw_domain=$(echo $domain | cut -d':' -f1)
port=$(echo $domain | cut -d':' -s -f2); : ${port:=$default_port}
echo $raw_domain:$port
echo | openssl s_client -servername $raw_domain -connect $raw_domain:$port 2>/dev/null | openssl x509 -noout -enddate
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment