2019-10-28 16:51:45 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-03-15 16:00:52 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-10-28 16:51:45 +00:00
|
|
|
|
|
|
|
# Adapted from https://superuser.com/a/224263
|
|
|
|
|
|
|
|
# OpenSSL requires the port number.
|
|
|
|
SERVER=$1
|
|
|
|
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
|
|
|
|
|
|
|
|
echo Obtaining cipher list from $(openssl version).
|
|
|
|
|
|
|
|
for cipher in ${ciphers[@]}
|
|
|
|
do
|
|
|
|
echo -n Testing $cipher...
|
|
|
|
result=$(echo -n | openssl s_client -cipher "$cipher" -alpn req_fw_sb-act_v1 -connect $SERVER 2>&1)
|
|
|
|
if [[ "$result" =~ ":error:" ]] ; then
|
|
|
|
error=$(echo -n $result | cut -d':' -f6)
|
|
|
|
echo NO \($error\)
|
|
|
|
else
|
|
|
|
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then
|
|
|
|
echo YES
|
|
|
|
else
|
|
|
|
echo UNKNOWN RESPONSE
|
|
|
|
echo $result
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|