Skip to content

Instantly share code, notes, and snippets.

@amirkdv
Created March 11, 2024 03:18
Show Gist options
  • Save amirkdv/ca3c3c78fff3db803f0d6d7b491447a7 to your computer and use it in GitHub Desktop.
Save amirkdv/ca3c3c78fff3db803f0d6d7b491447a7 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Usage:
# $ inspect-tls-cert.sh facebook.com
set -eux
server=${1:-"stripe.com"}
certfile=/tmp/${server}.cert
openssl_client_connect="openssl s_client -connect ${server}:443 -servername ${server}"
echo "Downloading TLS cert for ${server} to ${certfile}"
echo | ${openssl_client_connect} | openssl x509 > ${certfile}
echo "Inspecting TLS cert at ${certfile}"
openssl x509 -in ${certfile} -text -noout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment