Last active
February 9, 2023 03:35
-
-
Save sharl/97ec549f037580d2b4fa84ad25ebc0f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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