Skip to content

Instantly share code, notes, and snippets.

@pajtai
Last active September 27, 2016 14:25
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 pajtai/c9bcba7d60ab56292bde0ec4794f0566 to your computer and use it in GitHub Desktop.
Save pajtai/c9bcba7d60ab56292bde0ec4794f0566 to your computer and use it in GitHub Desktop.
Test open ssl cyphers for a domain. e.g.: ./test-ssl.sh example.com
#!/usr/bin/env bash
# source: http://superuser.com/a/224263/41059
# OpenSSL requires the port number.
SERVER=$1:443
DELAY=1
echo Obtaining cipher list from $(openssl version).
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color]]'
OK="${GREEN}✔${NC} "
FAIL="${RED}✘${NC} "
for cipher in ${ciphers[@]}
do
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1)
if [[ "$result" =~ ":error:" ]] ; then
error=$(echo -n $result | cut -d':' -f6)
echo -e $FAIL $cipher ERROR \($error\)
else
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then
echo -e $OK $cipher
else
echo -e "$FAIL $cipher \t\t\t $result"
fi
fi
sleep $DELAY
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment