blob: 38cca0786890e7ee4d65b8e4170151d88d104d7d [file] [log] [blame]
James E. King, III06190872017-02-20 08:52:11 -05001#!/bin/bash
2
3#
4# Checks to make sure SSLv3 is not allowed by a server.
5#
6
7THRIFTHOST=localhost
8THRIFTPORT=9090
9
10while [[ $# -ge 1 ]]; do
11 arg="$1"
12 argIN=(${arg//=/ })
13
14 case ${argIN[0]} in
15 -h|--host)
16 THRIFTHOST=${argIN[1]}
17 shift # past argument
18 ;;
19 -p|--port)
20 THRIFTPORT=${argIN[1]}
21 shift # past argument
22 ;;
23 *)
24 # unknown option ignored
25 ;;
26 esac
27
28 shift # past argument or value
29done
30
31function nosslv3
32{
33 local nego
34 local negodenied
James E. King IIIf5f430d2018-06-08 03:37:55 +000035 local opensslv
36
37 opensslv=$(openssl version | cut -d' ' -f2)
38 if [[ $opensslv > "1.0" ]]; then
39 echo "[pass] OpenSSL 1.1 or later - no need to check ssl3"
40 return 0
41 fi
James E. King, III06190872017-02-20 08:52:11 -050042
43 # echo "openssl s_client -connect $THRIFTHOST:$THRIFTPORT -CAfile ../keys/CA.pem -ssl3 2>&1 < /dev/null"
44 nego=$(openssl s_client -connect $THRIFTHOST:$THRIFTPORT -CAfile ../keys/CA.pem -ssl3 2>&1 < /dev/null)
45 negodenied=$?
46
47 if [[ $negodenied -ne 0 ]]; then
48 echo "[pass] SSLv3 negotiation disabled"
49 echo $nego
50 return 0
51 fi
52
53 echo "[fail] SSLv3 negotiation enabled! stdout:"
54 echo $nego
55 return 1
56}
57
58nosslv3
59exit $?