Skip to content

Instantly share code, notes, and snippets.

@naftulikay
Created September 7, 2016 00:44
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 naftulikay/705b4b85504fd0fd599a630b608c19b3 to your computer and use it in GitHub Desktop.
Save naftulikay/705b4b85504fd0fd599a630b608c19b3 to your computer and use it in GitHub Desktop.
Get TLS connection information for a given server.
#!/bin/bash
function usage() {
echo "Usage: $0 hostname [port]" >&2
echo " hostname Hostname of the server to connect to." >&2
echo " port Port of the server running TLS, defaults" >&2
echo " to 443." >&2
echo ""
exit 1
}
if [ -z "$1" ]; then
usage
fi
tls_hostname="$1"
# default to 443
tls_port="${2-:443}"
echo "Q" | openssl s_client -connect $tls_hostname:$tls_port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment