Skip to content

Instantly share code, notes, and snippets.

@jeffrade
Last active September 11, 2019 18:33
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 jeffrade/d3faaac67c29503bb71963d2db6a9e5c to your computer and use it in GitHub Desktop.
Save jeffrade/d3faaac67c29503bb71963d2db6a9e5c to your computer and use it in GitHub Desktop.
Bash script to check certificate information - uses openssl.
#!/bin/sh
if [ -z "$1" ]
then
echo "Please supply a domain, e.g. www.example.com"
exit 1
fi
echo | openssl s_client -servername $1 -connect $1:443 2>/dev/null | openssl x509 -text
echo "Saving public ./cert.pem..."
openssl s_client -showcerts -connect $1:443 </dev/null 2>/dev/null | openssl x509 -outform PEM > cert.pem
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment