Merge branch 'master' of feistymeow.org:feisty_meow
[feisty_meow.git] / scripts / security / poodle_check.sh
1 #!/bin/bash
2
3 host="$1"; shift
4 port="$1"; shift
5 if [ -z "$port" ]; then
6   port=443
7 fi
8
9 if [ -z "$host" ]; then
10   echo "This test takes at least a hostname parameter for testing, and will also"
11   echo "accept an optional port parameter, e.g."
12   echo "  $(basename $0) garvey.edu 17001"
13   exit 1
14 fi
15
16 echo
17 echo "about to try connecting; if this fails to stay connected, then you are not"
18 echo "vulnerable to POODLE SSLv3 attack.  if it does connect, and you see the"
19 echo "protocol SSLv3 listed, then the server at $host:$port"
20 echo "is vulnerable to POODLE!"
21 echo
22 openssl s_client -ssl3 -host "$host" -port $port
23
24 exit 0
25
26
27 #could improve this by starting openssl connect in background 
28 # and awaiting its exit.  if it doesn't exit in like 3 seconds,
29 # then it probably connected.  at that point, print the error
30 # message about vulnerability found, and show where the output
31 # file from connect can be found for inspection.