Skip to content

Instantly share code, notes, and snippets.

@sharl
Last active February 9, 2023 03:35
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 sharl/97ec549f037580d2b4fa84ad25ebc0f4 to your computer and use it in GitHub Desktop.
Save sharl/97ec549f037580d2b4fa84ad25ebc0f4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# -*- coding: utf-8 -*-
OPENSSL_CMD=$(which openssl)
if [[ $OSTYPE =~ ^darwin ]]; then
OPENSSL_CMD=$(ls -1 /usr/local/Cellar/openssl*/*/bin/openssl | tail -1)
if [ "x${OPENSSL_CMD}" = "x" ]; then
echo "need to: brew install openssl"
exit 1
fi
fi
domain=$1
if [ -z "$domain" ]; then
echo "usage: $(basename $0) <domain>" 1>&2
exit 2
fi
for op in tls1 tls1_1 tls1_2 tls1_3; do
_OP=${op/tls/TLSv}
if [[ $_OP =~ _ ]]; then
:
else
_OP=${_OP}_0
fi
_OP=${_OP/_/.}
${OPENSSL_CMD} s_client -connect $domain:443 -servername $domain -$op < /dev/null > /dev/null 2>&1 && echo $domain OK $_OP || echo $domain NG $_OP
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment