Skip to content

Instantly share code, notes, and snippets.

@elasticdog
Last active December 28, 2015 05:59
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 elasticdog/7454165 to your computer and use it in GitHub Desktop.
Save elasticdog/7454165 to your computer and use it in GitHub Desktop.
verify the ssl certificate chain for multiple domains using openssl
#!/bin/bash
readonly FILE='domains.list'
readonly MAX_CHAIN_LENGTH=5
readonly PORT=443
while IFS= read -r domain; do
echo -ne "${domain} $(/usr/bin/dig ${domain} +short | tail -n 1)\n"
echo QUIT | /usr/bin/openssl s_client -verify ${MAX_CHAIN_LENGTH} -connect ${domain}:${PORT} 2>1 | grep 'Verify return code'
done < "$FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment