Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Test various options that are not covered by compat.sh |
| 4 | # |
| 5 | # Here the goal is not to cover every ciphersuite/version, but |
| 6 | # rather specific options (max fragment length, truncated hmac, etc) |
| 7 | # or procedures (session resumption from cache or ticket, renego, etc). |
| 8 | # |
| 9 | # Assumes all options are compiled in. |
| 10 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 11 | set -u |
| 12 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 13 | PROGS_DIR='../programs/ssl' |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 14 | P_SRV="$PROGS_DIR/ssl_server2 server_addr=0.0.0.0" # force IPv4 for OpenSSL |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 15 | P_CLI="$PROGS_DIR/ssl_client2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 16 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 17 | O_ARGS="-www -cert data_files/server5.crt -key data_files/server5.key" |
| 18 | O_CLI="echo 'GET / HTTP/1.0' | openssl s_client" |
| 19 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 20 | TESTS=0 |
| 21 | FAILS=0 |
| 22 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 23 | MEMCHECK=0 |
| 24 | |
| 25 | print_usage() { |
| 26 | echo "Usage: $0 [options]" |
| 27 | echo -e " -h, --help\tPrint this help." |
| 28 | echo -e " -m, --memcheck\tCheck memory leaks." |
| 29 | } |
| 30 | |
| 31 | get_options() { |
| 32 | while [ $# -gt 0 ]; do |
| 33 | case "$1" in |
| 34 | -m|--memcheck) |
| 35 | MEMCHECK=1 |
| 36 | ;; |
| 37 | -h|--help) |
| 38 | print_usage |
| 39 | exit 0 |
| 40 | ;; |
| 41 | *) |
| 42 | echo "Unkown argument: '$1'" |
| 43 | print_usage |
| 44 | exit 1 |
| 45 | ;; |
| 46 | esac |
| 47 | shift |
| 48 | done |
| 49 | } |
| 50 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 51 | # print_name <name> |
| 52 | print_name() { |
| 53 | echo -n "$1 " |
| 54 | LEN=`echo "$1" | wc -c` |
| 55 | LEN=`echo 72 - $LEN | bc` |
| 56 | for i in `seq 1 $LEN`; do echo -n '.'; done |
| 57 | echo -n ' ' |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 58 | |
| 59 | TESTS=`echo $TESTS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | # fail <message> |
| 63 | fail() { |
| 64 | echo "FAIL" |
| 65 | echo " $1" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 66 | |
| 67 | cp srv_out srv-${TESTS}.log |
| 68 | cp cli_out cli-${TESTS}.log |
| 69 | echo " outputs saved to srv-${TESTS}.log and cli-${TESTS}.log" |
| 70 | |
| 71 | FAILS=`echo $FAILS + 1 | bc` |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 72 | } |
| 73 | |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 74 | # is_polar <cmd_line> |
| 75 | is_polar() { |
| 76 | echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null |
| 77 | } |
| 78 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 79 | # has_mem_err <log_file_name> |
| 80 | has_mem_err() { |
| 81 | if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" && |
| 82 | grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null |
| 83 | then |
| 84 | return 1 # false: does not have errors |
| 85 | else |
| 86 | return 0 # true: has errors |
| 87 | fi |
| 88 | } |
| 89 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 90 | # Usage: run_test name srv_cmd cli_cmd cli_exit [option [...]] |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 91 | # Options: -s pattern pattern that must be present in server output |
| 92 | # -c pattern pattern that must be present in client output |
| 93 | # -S pattern pattern that must be absent in server output |
| 94 | # -C pattern pattern that must be absent in client output |
| 95 | run_test() { |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 96 | NAME="$1" |
| 97 | SRV_CMD="$2" |
| 98 | CLI_CMD="$3" |
| 99 | CLI_EXPECT="$4" |
| 100 | shift 4 |
| 101 | |
| 102 | print_name "$NAME" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 103 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 104 | # prepend valgrind to our commands if active |
| 105 | if [ "$MEMCHECK" -gt 0 ]; then |
| 106 | if is_polar "$SRV_CMD"; then |
| 107 | SRV_CMD="valgrind --leak-check=full $SRV_CMD" |
| 108 | fi |
| 109 | if is_polar "$CLI_CMD"; then |
| 110 | CLI_CMD="valgrind --leak-check=full $CLI_CMD" |
| 111 | fi |
| 112 | fi |
| 113 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 114 | # run the commands |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 115 | $SHELL -c "$SRV_CMD" > srv_out 2>&1 & |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 116 | SRV_PID=$! |
| 117 | sleep 1 |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 118 | $SHELL -c "$CLI_CMD" > cli_out 2>&1 |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 119 | CLI_EXIT=$? |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 120 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 121 | echo SERVERQUIT | openssl s_client -no_ticket \ |
| 122 | -cert data_files/cli2.crt -key data_files/cli2.key \ |
| 123 | >/dev/null 2>&1 |
| 124 | else |
| 125 | kill $SRV_PID |
| 126 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 127 | wait $SRV_PID |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 128 | |
| 129 | # check if the client and server went at least to the handshake stage |
| 130 | # (usefull to avoid tests with only negative assertions and non-zero |
| 131 | # expected client exit to incorrectly succeed in case of catastrophic |
| 132 | # failure) |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 133 | if is_polar "$SRV_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 134 | if grep "Performing the SSL/TLS handshake" srv_out >/dev/null; then :; |
| 135 | else |
| 136 | fail "server failed to start" |
| 137 | return |
| 138 | fi |
| 139 | fi |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 140 | if is_polar "$CLI_CMD"; then |
Manuel Pégourié-Gonnard | 677884d | 2014-02-25 16:42:31 +0100 | [diff] [blame] | 141 | if grep "Performing the SSL/TLS handshake" cli_out >/dev/null; then :; |
| 142 | else |
| 143 | fail "client failed to start" |
| 144 | return |
| 145 | fi |
| 146 | fi |
| 147 | |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 148 | # check server exit code |
| 149 | if [ $? != 0 ]; then |
| 150 | fail "server fail" |
| 151 | return |
| 152 | fi |
| 153 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 154 | # check client exit code |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 155 | if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \ |
| 156 | \( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ] |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 157 | then |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 158 | fail "bad client exit code" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 159 | return |
| 160 | fi |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 161 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 162 | # check other assertions |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 163 | while [ $# -gt 0 ] |
| 164 | do |
| 165 | case $1 in |
| 166 | "-s") |
| 167 | if grep "$2" srv_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 168 | fail "-s $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 169 | return |
| 170 | fi |
| 171 | ;; |
| 172 | |
| 173 | "-c") |
| 174 | if grep "$2" cli_out >/dev/null; then :; else |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 175 | fail "-c $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 176 | return |
| 177 | fi |
| 178 | ;; |
| 179 | |
| 180 | "-S") |
| 181 | if grep "$2" srv_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 182 | fail "-S $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 183 | return |
| 184 | fi |
| 185 | ;; |
| 186 | |
| 187 | "-C") |
| 188 | if grep "$2" cli_out >/dev/null; then |
Manuel Pégourié-Gonnard | f8bdbb5 | 2014-02-21 09:20:14 +0100 | [diff] [blame] | 189 | fail "-C $2" |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 190 | return |
| 191 | fi |
| 192 | ;; |
| 193 | |
| 194 | *) |
| 195 | echo "Unkown test: $1" >&2 |
| 196 | exit 1 |
| 197 | esac |
| 198 | shift 2 |
| 199 | done |
| 200 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 201 | # check valgrind's results |
| 202 | if [ "$MEMCHECK" -gt 0 ]; then |
| 203 | if is_polar "$SRV_CMD" && has_mem_err srv_out; then |
| 204 | fail "Server has memory errors" |
| 205 | return |
| 206 | fi |
| 207 | if is_polar "$CLI_CMD" && has_mem_err cli_out; then |
| 208 | fail "Client has memory errors" |
| 209 | return |
| 210 | fi |
| 211 | fi |
| 212 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 213 | # if we're here, everything is ok |
| 214 | echo "PASS" |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 215 | rm -f srv_out cli_out |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 216 | } |
| 217 | |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 218 | cleanup() { |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 219 | rm -f cli_out srv_out sess |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 220 | kill $SRV_PID |
| 221 | exit 1 |
| 222 | } |
| 223 | |
Manuel Pégourié-Gonnard | 9dea8bd | 2014-02-26 18:21:02 +0100 | [diff] [blame^] | 224 | # |
| 225 | # MAIN |
| 226 | # |
| 227 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 228 | get_options "$@" |
| 229 | |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 230 | killall -q openssl ssl_server ssl_server2 |
Manuel Pégourié-Gonnard | a9062e9 | 2014-02-25 16:21:22 +0100 | [diff] [blame] | 231 | trap cleanup INT TERM HUP |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 232 | |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 233 | # Test for SSLv2 ClientHello |
| 234 | |
| 235 | run_test "SSLv2 ClientHello #0 (reference)" \ |
| 236 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 237 | "$O_CLI -no_ssl2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 238 | 0 \ |
| 239 | -S "parse client hello v2" \ |
| 240 | -S "ssl_handshake returned" |
| 241 | |
| 242 | # Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello |
| 243 | run_test "SSLv2 ClientHello #1 (actual test)" \ |
| 244 | "$P_SRV debug_level=3" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 245 | "$O_CLI -cipher 'DES-CBC-MD5:ALL'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 246 | 0 \ |
| 247 | -s "parse client hello v2" \ |
| 248 | -S "ssl_handshake returned" |
| 249 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 250 | # Tests for Truncated HMAC extension |
| 251 | |
| 252 | run_test "Truncated HMAC #0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 253 | "$P_SRV debug_level=5" \ |
| 254 | "$P_CLI trunc_hmac=0 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 255 | 0 \ |
| 256 | -s "dumping 'computed mac' (20 bytes)" |
| 257 | |
| 258 | run_test "Truncated HMAC #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 259 | "$P_SRV debug_level=5" \ |
| 260 | "$P_CLI trunc_hmac=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \ |
Manuel Pégourié-Gonnard | eaadc50 | 2014-02-20 11:01:30 +0100 | [diff] [blame] | 261 | 0 \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 262 | -s "dumping 'computed mac' (10 bytes)" |
| 263 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 264 | # Tests for Session Tickets |
| 265 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 266 | run_test "Session resume using tickets #1 (basic)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 267 | "$P_SRV debug_level=4 tickets=1" \ |
| 268 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 269 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 270 | -c "client hello, adding session ticket extension" \ |
| 271 | -s "found session ticket extension" \ |
| 272 | -s "server hello, adding session ticket extension" \ |
| 273 | -c "found session_ticket extension" \ |
| 274 | -c "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 275 | -S "session successfully restored from cache" \ |
| 276 | -s "session successfully restored from ticket" \ |
| 277 | -s "a session has been resumed" \ |
| 278 | -c "a session has been resumed" |
| 279 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 280 | run_test "Session resume using tickets #2 (cache disabled)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 281 | "$P_SRV debug_level=4 tickets=1 cache_max=0" \ |
| 282 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 283 | 0 \ |
| 284 | -c "client hello, adding session ticket extension" \ |
| 285 | -s "found session ticket extension" \ |
| 286 | -s "server hello, adding session ticket extension" \ |
| 287 | -c "found session_ticket extension" \ |
| 288 | -c "parse new session ticket" \ |
| 289 | -S "session successfully restored from cache" \ |
| 290 | -s "session successfully restored from ticket" \ |
| 291 | -s "a session has been resumed" \ |
| 292 | -c "a session has been resumed" |
| 293 | |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 294 | run_test "Session resume using tickets #3 (timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 295 | "$P_SRV debug_level=4 tickets=1 cache_max=0 ticket_timeout=1" \ |
| 296 | "$P_CLI debug_level=4 tickets=1 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | dbe1ee1 | 2014-02-21 09:18:13 +0100 | [diff] [blame] | 297 | 0 \ |
| 298 | -c "client hello, adding session ticket extension" \ |
| 299 | -s "found session ticket extension" \ |
| 300 | -s "server hello, adding session ticket extension" \ |
| 301 | -c "found session_ticket extension" \ |
| 302 | -c "parse new session ticket" \ |
| 303 | -S "session successfully restored from cache" \ |
| 304 | -S "session successfully restored from ticket" \ |
| 305 | -S "a session has been resumed" \ |
| 306 | -C "a session has been resumed" |
| 307 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 308 | run_test "Session resume using tickets #4 (openssl server)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 309 | "openssl s_server $O_ARGS" \ |
| 310 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
| 311 | 0 \ |
| 312 | -c "client hello, adding session ticket extension" \ |
| 313 | -c "found session_ticket extension" \ |
| 314 | -c "parse new session ticket" \ |
| 315 | -c "a session has been resumed" |
| 316 | |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 317 | run_test "Session resume using tickets #5 (openssl client)" \ |
Manuel Pégourié-Gonnard | fccd325 | 2014-02-25 17:14:15 +0100 | [diff] [blame] | 318 | "$P_SRV debug_level=4 tickets=1" \ |
| 319 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 320 | 0 \ |
| 321 | -s "found session ticket extension" \ |
| 322 | -s "server hello, adding session ticket extension" \ |
| 323 | -S "session successfully restored from cache" \ |
| 324 | -s "session successfully restored from ticket" \ |
| 325 | -s "a session has been resumed" |
| 326 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 327 | # Tests for Session Resume based on session-ID and cache |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 328 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 329 | run_test "Session resume using cache #1 (tickets enabled on client)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 330 | "$P_SRV debug_level=4 tickets=0" \ |
| 331 | "$P_CLI debug_level=4 tickets=1 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 332 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 333 | -c "client hello, adding session ticket extension" \ |
| 334 | -s "found session ticket extension" \ |
| 335 | -S "server hello, adding session ticket extension" \ |
| 336 | -C "found session_ticket extension" \ |
| 337 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 338 | -s "session successfully restored from cache" \ |
| 339 | -S "session successfully restored from ticket" \ |
| 340 | -s "a session has been resumed" \ |
| 341 | -c "a session has been resumed" |
| 342 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 343 | run_test "Session resume using cache #2 (tickets enabled on server)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 344 | "$P_SRV debug_level=4 tickets=1" \ |
| 345 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 346 | 0 \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 347 | -C "client hello, adding session ticket extension" \ |
| 348 | -S "found session ticket extension" \ |
| 349 | -S "server hello, adding session ticket extension" \ |
| 350 | -C "found session_ticket extension" \ |
| 351 | -C "parse new session ticket" \ |
Manuel Pégourié-Gonnard | f7c5201 | 2014-02-20 11:43:46 +0100 | [diff] [blame] | 352 | -s "session successfully restored from cache" \ |
| 353 | -S "session successfully restored from ticket" \ |
| 354 | -s "a session has been resumed" \ |
| 355 | -c "a session has been resumed" |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 356 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 357 | run_test "Session resume using cache #3 (cache_max=0)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 358 | "$P_SRV debug_level=4 tickets=0 cache_max=0" \ |
| 359 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 360 | 0 \ |
| 361 | -S "session successfully restored from cache" \ |
| 362 | -S "session successfully restored from ticket" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 363 | -S "a session has been resumed" \ |
| 364 | -C "a session has been resumed" |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 365 | |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 366 | run_test "Session resume using cache #4 (cache_max=1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 367 | "$P_SRV debug_level=4 tickets=0 cache_max=1" \ |
| 368 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 369 | 0 \ |
| 370 | -s "session successfully restored from cache" \ |
| 371 | -S "session successfully restored from ticket" \ |
| 372 | -s "a session has been resumed" \ |
| 373 | -c "a session has been resumed" |
| 374 | |
| 375 | run_test "Session resume using cache #5 (timemout > delay)" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 376 | "$P_SRV debug_level=4 tickets=0" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 377 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=0" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 378 | 0 \ |
| 379 | -s "session successfully restored from cache" \ |
| 380 | -S "session successfully restored from ticket" \ |
| 381 | -s "a session has been resumed" \ |
| 382 | -c "a session has been resumed" |
| 383 | |
| 384 | run_test "Session resume using cache #6 (timeout < delay)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 385 | "$P_SRV debug_level=4 tickets=0 cache_timeout=1" \ |
| 386 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | c55a5b7 | 2014-02-20 22:50:56 +0100 | [diff] [blame] | 387 | 0 \ |
| 388 | -S "session successfully restored from cache" \ |
| 389 | -S "session successfully restored from ticket" \ |
| 390 | -S "a session has been resumed" \ |
| 391 | -C "a session has been resumed" |
| 392 | |
| 393 | run_test "Session resume using cache #7 (no timeout)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 394 | "$P_SRV debug_level=4 tickets=0 cache_timeout=0" \ |
| 395 | "$P_CLI debug_level=4 tickets=0 reconnect=1 reco_delay=2" \ |
Manuel Pégourié-Gonnard | 4c88345 | 2014-02-20 21:32:41 +0100 | [diff] [blame] | 396 | 0 \ |
| 397 | -s "session successfully restored from cache" \ |
| 398 | -S "session successfully restored from ticket" \ |
| 399 | -s "a session has been resumed" \ |
| 400 | -c "a session has been resumed" |
| 401 | |
Manuel Pégourié-Gonnard | db735f6 | 2014-02-25 17:57:59 +0100 | [diff] [blame] | 402 | run_test "Session resume using cache #8 (openssl client)" \ |
| 403 | "$P_SRV debug_level=4 tickets=0" \ |
| 404 | "($O_CLI -sess_out sess; $O_CLI -sess_in sess; rm -f sess)" \ |
| 405 | 0 \ |
| 406 | -s "found session ticket extension" \ |
| 407 | -S "server hello, adding session ticket extension" \ |
| 408 | -s "session successfully restored from cache" \ |
| 409 | -S "session successfully restored from ticket" \ |
| 410 | -s "a session has been resumed" |
| 411 | |
| 412 | run_test "Session resume using cache #9 (openssl server)" \ |
| 413 | "openssl s_server $O_ARGS" \ |
| 414 | "$P_CLI debug_level=4 tickets=0 reconnect=1" \ |
| 415 | 0 \ |
| 416 | -C "found session_ticket extension" \ |
| 417 | -C "parse new session ticket" \ |
| 418 | -c "a session has been resumed" |
| 419 | |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 420 | # Tests for Max Fragment Length extension |
| 421 | |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 422 | run_test "Max fragment length #1" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 423 | "$P_SRV debug_level=4" \ |
| 424 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 425 | 0 \ |
| 426 | -C "client hello, adding max_fragment_length extension" \ |
| 427 | -S "found max fragment length extension" \ |
| 428 | -S "server hello, max_fragment_length extension" \ |
| 429 | -C "found max_fragment_length extension" |
| 430 | |
| 431 | run_test "Max fragment length #2" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 432 | "$P_SRV debug_level=4" \ |
| 433 | "$P_CLI debug_level=4 max_frag_len=4096" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 434 | 0 \ |
| 435 | -c "client hello, adding max_fragment_length extension" \ |
| 436 | -s "found max fragment length extension" \ |
| 437 | -s "server hello, max_fragment_length extension" \ |
| 438 | -c "found max_fragment_length extension" |
| 439 | |
| 440 | run_test "Max fragment length #3" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 441 | "$P_SRV debug_level=4 max_frag_len=4096" \ |
| 442 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | de14378 | 2014-02-20 14:50:42 +0100 | [diff] [blame] | 443 | 0 \ |
| 444 | -C "client hello, adding max_fragment_length extension" \ |
| 445 | -S "found max fragment length extension" \ |
| 446 | -S "server hello, max_fragment_length extension" \ |
| 447 | -C "found max_fragment_length extension" |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 448 | |
| 449 | # Tests for renegotiation |
| 450 | |
| 451 | run_test "Renegotiation #0 (none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 452 | "$P_SRV debug_level=4" \ |
| 453 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 454 | 0 \ |
| 455 | -C "client hello, adding renegotiation extension" \ |
| 456 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 457 | -S "found renegotiation extension" \ |
| 458 | -s "server hello, secure renegotiation extension" \ |
| 459 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 460 | -C "=> renegotiate" \ |
| 461 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 462 | -S "write hello request" |
| 463 | |
| 464 | run_test "Renegotiation #1 (enabled, client-initiated)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 465 | "$P_SRV debug_level=4" \ |
| 466 | "$P_CLI debug_level=4 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 467 | 0 \ |
| 468 | -c "client hello, adding renegotiation extension" \ |
| 469 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 470 | -s "found renegotiation extension" \ |
| 471 | -s "server hello, secure renegotiation extension" \ |
| 472 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 473 | -c "=> renegotiate" \ |
| 474 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 475 | -S "write hello request" |
| 476 | |
| 477 | run_test "Renegotiation #2 (enabled, server-initiated)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 478 | "$P_SRV debug_level=4 renegotiate=1" \ |
| 479 | "$P_CLI debug_level=4" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 480 | 0 \ |
| 481 | -c "client hello, adding renegotiation extension" \ |
| 482 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 483 | -s "found renegotiation extension" \ |
| 484 | -s "server hello, secure renegotiation extension" \ |
| 485 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 486 | -c "=> renegotiate" \ |
| 487 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 488 | -s "write hello request" |
| 489 | |
| 490 | run_test "Renegotiation #3 (enabled, double)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 491 | "$P_SRV debug_level=4 renegotiate=1" \ |
| 492 | "$P_CLI debug_level=4 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 493 | 0 \ |
| 494 | -c "client hello, adding renegotiation extension" \ |
| 495 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 496 | -s "found renegotiation extension" \ |
| 497 | -s "server hello, secure renegotiation extension" \ |
| 498 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 499 | -c "=> renegotiate" \ |
| 500 | -s "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 501 | -s "write hello request" |
| 502 | |
| 503 | run_test "Renegotiation #4 (client-initiated, server-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 504 | "$P_SRV debug_level=4 renegotiation=0" \ |
| 505 | "$P_CLI debug_level=4 renegotiate=1" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 506 | 1 \ |
| 507 | -c "client hello, adding renegotiation extension" \ |
| 508 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 509 | -S "found renegotiation extension" \ |
| 510 | -s "server hello, secure renegotiation extension" \ |
| 511 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 512 | -c "=> renegotiate" \ |
| 513 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 514 | -S "write hello request" |
| 515 | |
| 516 | run_test "Renegotiation #5 (server-initiated, client-rejected)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 517 | "$P_SRV debug_level=4 renegotiate=1" \ |
| 518 | "$P_CLI debug_level=4 renegotiation=0" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 519 | 0 \ |
| 520 | -C "client hello, adding renegotiation extension" \ |
| 521 | -s "received TLS_EMPTY_RENEGOTIATION_INFO" \ |
| 522 | -S "found renegotiation extension" \ |
| 523 | -s "server hello, secure renegotiation extension" \ |
| 524 | -c "found renegotiation extension" \ |
Manuel Pégourié-Gonnard | c73339f | 2014-02-26 16:35:27 +0100 | [diff] [blame] | 525 | -C "=> renegotiate" \ |
| 526 | -S "=> renegotiate" \ |
Manuel Pégourié-Gonnard | 780d671 | 2014-02-20 17:19:59 +0100 | [diff] [blame] | 527 | -s "write hello request" \ |
| 528 | -s "SSL - An unexpected message was received from our peer" \ |
| 529 | -s "failed" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 530 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 531 | # Tests for auth_mode |
| 532 | |
| 533 | run_test "Authentication #1 (server badcert, client required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 534 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 535 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 536 | "$P_CLI debug_level=2 auth_mode=required" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 537 | 1 \ |
| 538 | -c "x509_verify_cert() returned" \ |
| 539 | -c "! self-signed or not signed by a trusted CA" \ |
| 540 | -c "! ssl_handshake returned" \ |
| 541 | -c "X509 - Certificate verification failed" |
| 542 | |
| 543 | run_test "Authentication #2 (server badcert, client optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 544 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 545 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 546 | "$P_CLI debug_level=2 auth_mode=optional" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 547 | 0 \ |
| 548 | -c "x509_verify_cert() returned" \ |
| 549 | -c "! self-signed or not signed by a trusted CA" \ |
| 550 | -C "! ssl_handshake returned" \ |
| 551 | -C "X509 - Certificate verification failed" |
| 552 | |
| 553 | run_test "Authentication #3 (server badcert, client none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 554 | "$P_SRV crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 555 | key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 556 | "$P_CLI debug_level=2 auth_mode=none" \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 557 | 0 \ |
| 558 | -C "x509_verify_cert() returned" \ |
| 559 | -C "! self-signed or not signed by a trusted CA" \ |
| 560 | -C "! ssl_handshake returned" \ |
| 561 | -C "X509 - Certificate verification failed" |
| 562 | |
| 563 | run_test "Authentication #4 (client badcert, server required)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 564 | "$P_SRV debug_level=4 auth_mode=required" \ |
| 565 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 566 | key_file=data_files/server5.key" \ |
| 567 | 1 \ |
| 568 | -S "skip write certificate request" \ |
| 569 | -C "skip parse certificate request" \ |
| 570 | -c "got a certificate request" \ |
| 571 | -C "skip write certificate" \ |
| 572 | -C "skip write certificate verify" \ |
| 573 | -S "skip parse certificate verify" \ |
| 574 | -s "x509_verify_cert() returned" \ |
| 575 | -S "! self-signed or not signed by a trusted CA" \ |
| 576 | -s "! ssl_handshake returned" \ |
| 577 | -c "! ssl_handshake returned" \ |
| 578 | -s "X509 - Certificate verification failed" |
| 579 | |
| 580 | run_test "Authentication #5 (client badcert, server optional)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 581 | "$P_SRV debug_level=4 auth_mode=optional" \ |
| 582 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 583 | key_file=data_files/server5.key" \ |
| 584 | 0 \ |
| 585 | -S "skip write certificate request" \ |
| 586 | -C "skip parse certificate request" \ |
| 587 | -c "got a certificate request" \ |
| 588 | -C "skip write certificate" \ |
| 589 | -C "skip write certificate verify" \ |
| 590 | -S "skip parse certificate verify" \ |
| 591 | -s "x509_verify_cert() returned" \ |
| 592 | -s "! self-signed or not signed by a trusted CA" \ |
| 593 | -S "! ssl_handshake returned" \ |
| 594 | -C "! ssl_handshake returned" \ |
| 595 | -S "X509 - Certificate verification failed" |
| 596 | |
| 597 | run_test "Authentication #6 (client badcert, server none)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 598 | "$P_SRV debug_level=4 auth_mode=none" \ |
| 599 | "$P_CLI debug_level=4 crt_file=data_files/server5-badsign.crt \ |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 600 | key_file=data_files/server5.key" \ |
| 601 | 0 \ |
| 602 | -s "skip write certificate request" \ |
| 603 | -C "skip parse certificate request" \ |
| 604 | -c "got no certificate request" \ |
| 605 | -c "skip write certificate" \ |
| 606 | -c "skip write certificate verify" \ |
| 607 | -s "skip parse certificate verify" \ |
| 608 | -S "x509_verify_cert() returned" \ |
| 609 | -S "! self-signed or not signed by a trusted CA" \ |
| 610 | -S "! ssl_handshake returned" \ |
| 611 | -C "! ssl_handshake returned" \ |
| 612 | -S "X509 - Certificate verification failed" |
| 613 | |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 614 | # tests for SNI |
| 615 | |
| 616 | run_test "SNI #0 (no SNI callback)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 617 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 618 | crt_file=data_files/server5.crt key_file=data_files/server5.key" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 619 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 620 | server_name=localhost" \ |
| 621 | 0 \ |
| 622 | -S "parse ServerName extension" \ |
| 623 | -c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \ |
| 624 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 625 | |
| 626 | run_test "SNI #1 (matching cert 1)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 627 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 628 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 629 | sni='localhost,data_files/server2.crt,data_files/server2.key,PolarSSL Server 1,data_files/server1.crt,data_files/server1.key'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 630 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 631 | server_name=localhost" \ |
| 632 | 0 \ |
| 633 | -s "parse ServerName extension" \ |
| 634 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 635 | -c "subject name *: C=NL, O=PolarSSL, CN=localhost" |
| 636 | |
| 637 | run_test "SNI #2 (matching cert 2)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 638 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 639 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 640 | sni='localhost,data_files/server2.crt,data_files/server2.key,PolarSSL Server 1,data_files/server1.crt,data_files/server1.key'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 641 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 642 | server_name='PolarSSL Server 1'" \ |
| 643 | 0 \ |
| 644 | -s "parse ServerName extension" \ |
| 645 | -c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \ |
| 646 | -c "subject name *: C=NL, O=PolarSSL, CN=PolarSSL Server 1" |
| 647 | |
| 648 | run_test "SNI #3 (no matching cert)" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 649 | "$P_SRV debug_level=4 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 650 | crt_file=data_files/server5.crt key_file=data_files/server5.key \ |
| 651 | sni='localhost,data_files/server2.crt,data_files/server2.key,PolarSSL Server 1,data_files/server1.crt,data_files/server1.key'" \ |
Manuel Pégourié-Gonnard | c1da664 | 2014-02-25 14:18:30 +0100 | [diff] [blame] | 652 | "$P_CLI debug_level=0 server_addr=127.0.0.1 \ |
Manuel Pégourié-Gonnard | 96ea2f2 | 2014-02-25 12:26:29 +0100 | [diff] [blame] | 653 | server_name='PolarSSL Server 2'" \ |
| 654 | 1 \ |
| 655 | -s "parse ServerName extension" \ |
| 656 | -s "ssl_sni_wrapper() returned" \ |
| 657 | -s "ssl_handshake returned" \ |
| 658 | -c "ssl_handshake returned" \ |
| 659 | -c "SSL - A fatal alert message was received from our peer" |
| 660 | |
Manuel Pégourié-Gonnard | 0b6609b | 2014-02-26 14:45:12 +0100 | [diff] [blame] | 661 | # Tests for non-blocking I/O: exercise a variety of handshake flows |
| 662 | |
| 663 | run_test "Non-blocking I/O #1 (basic handshake)" \ |
| 664 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 665 | "$P_CLI nbio=2 tickets=0" \ |
| 666 | 0 \ |
| 667 | -S "ssl_handshake returned" \ |
| 668 | -C "ssl_handshake returned" \ |
| 669 | -c "Read from server: .* bytes read" |
| 670 | |
| 671 | run_test "Non-blocking I/O #2 (client auth)" \ |
| 672 | "$P_SRV nbio=2 tickets=0 auth_mode=required" \ |
| 673 | "$P_CLI nbio=2 tickets=0" \ |
| 674 | 0 \ |
| 675 | -S "ssl_handshake returned" \ |
| 676 | -C "ssl_handshake returned" \ |
| 677 | -c "Read from server: .* bytes read" |
| 678 | |
| 679 | run_test "Non-blocking I/O #3 (ticket)" \ |
| 680 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 681 | "$P_CLI nbio=2 tickets=1" \ |
| 682 | 0 \ |
| 683 | -S "ssl_handshake returned" \ |
| 684 | -C "ssl_handshake returned" \ |
| 685 | -c "Read from server: .* bytes read" |
| 686 | |
| 687 | run_test "Non-blocking I/O #4 (ticket + client auth)" \ |
| 688 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 689 | "$P_CLI nbio=2 tickets=1" \ |
| 690 | 0 \ |
| 691 | -S "ssl_handshake returned" \ |
| 692 | -C "ssl_handshake returned" \ |
| 693 | -c "Read from server: .* bytes read" |
| 694 | |
| 695 | run_test "Non-blocking I/O #5 (ticket + client auth + resume)" \ |
| 696 | "$P_SRV nbio=2 tickets=1 auth_mode=required" \ |
| 697 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 698 | 0 \ |
| 699 | -S "ssl_handshake returned" \ |
| 700 | -C "ssl_handshake returned" \ |
| 701 | -c "Read from server: .* bytes read" |
| 702 | |
| 703 | run_test "Non-blocking I/O #6 (ticket + resume)" \ |
| 704 | "$P_SRV nbio=2 tickets=1 auth_mode=none" \ |
| 705 | "$P_CLI nbio=2 tickets=1 reconnect=1" \ |
| 706 | 0 \ |
| 707 | -S "ssl_handshake returned" \ |
| 708 | -C "ssl_handshake returned" \ |
| 709 | -c "Read from server: .* bytes read" |
| 710 | |
| 711 | run_test "Non-blocking I/O #7 (session-id resume)" \ |
| 712 | "$P_SRV nbio=2 tickets=0 auth_mode=none" \ |
| 713 | "$P_CLI nbio=2 tickets=0 reconnect=1" \ |
| 714 | 0 \ |
| 715 | -S "ssl_handshake returned" \ |
| 716 | -C "ssl_handshake returned" \ |
| 717 | -c "Read from server: .* bytes read" |
| 718 | |
Manuel Pégourié-Gonnard | a3d808e | 2014-02-26 16:33:03 +0100 | [diff] [blame] | 719 | run_test "Version check #1 (all -> 1.2)" \ |
| 720 | "$P_SRV" \ |
| 721 | "$P_CLI" \ |
| 722 | 0 \ |
| 723 | -S "ssl_handshake returned" \ |
| 724 | -C "ssl_handshake returned" \ |
| 725 | -s "Protocol is TLSv1.2" \ |
| 726 | -c "Protocol is TLSv1.2" |
| 727 | |
| 728 | run_test "Version check #2 (cli max 1.1 -> 1.1)" \ |
| 729 | "$P_SRV" \ |
| 730 | "$P_CLI max_version=tls1_1" \ |
| 731 | 0 \ |
| 732 | -S "ssl_handshake returned" \ |
| 733 | -C "ssl_handshake returned" \ |
| 734 | -s "Protocol is TLSv1.1" \ |
| 735 | -c "Protocol is TLSv1.1" |
| 736 | |
| 737 | run_test "Version check #3 (srv max 1.1 -> 1.1)" \ |
| 738 | "$P_SRV max_version=tls1_1" \ |
| 739 | "$P_CLI" \ |
| 740 | 0 \ |
| 741 | -S "ssl_handshake returned" \ |
| 742 | -C "ssl_handshake returned" \ |
| 743 | -s "Protocol is TLSv1.1" \ |
| 744 | -c "Protocol is TLSv1.1" |
| 745 | |
| 746 | run_test "Version check #4 (cli+srv max 1.1 -> 1.1)" \ |
| 747 | "$P_SRV max_version=tls1_1" \ |
| 748 | "$P_CLI max_version=tls1_1" \ |
| 749 | 0 \ |
| 750 | -S "ssl_handshake returned" \ |
| 751 | -C "ssl_handshake returned" \ |
| 752 | -s "Protocol is TLSv1.1" \ |
| 753 | -c "Protocol is TLSv1.1" |
| 754 | |
| 755 | run_test "Version check #5 (cli max 1.1, srv min 1.1 -> 1.1)" \ |
| 756 | "$P_SRV min_version=tls1_1" \ |
| 757 | "$P_CLI max_version=tls1_1" \ |
| 758 | 0 \ |
| 759 | -S "ssl_handshake returned" \ |
| 760 | -C "ssl_handshake returned" \ |
| 761 | -s "Protocol is TLSv1.1" \ |
| 762 | -c "Protocol is TLSv1.1" |
| 763 | |
| 764 | run_test "Version check #6 (cli min 1.1, srv max 1.1 -> 1.1)" \ |
| 765 | "$P_SRV max_version=tls1_1" \ |
| 766 | "$P_CLI min_version=tls1_1" \ |
| 767 | 0 \ |
| 768 | -S "ssl_handshake returned" \ |
| 769 | -C "ssl_handshake returned" \ |
| 770 | -s "Protocol is TLSv1.1" \ |
| 771 | -c "Protocol is TLSv1.1" |
| 772 | |
| 773 | run_test "Version check #7 (cli min 1.2, srv max 1.1 -> fail)" \ |
| 774 | "$P_SRV max_version=tls1_1" \ |
| 775 | "$P_CLI min_version=tls1_2" \ |
| 776 | 1 \ |
| 777 | -s "ssl_handshake returned" \ |
| 778 | -c "ssl_handshake returned" \ |
| 779 | -c "SSL - Handshake protocol not within min/max boundaries" |
| 780 | |
| 781 | run_test "Version check #8 (srv min 1.2, cli max 1.1 -> fail)" \ |
| 782 | "$P_SRV min_version=tls1_2" \ |
| 783 | "$P_CLI max_version=tls1_1" \ |
| 784 | 1 \ |
| 785 | -s "ssl_handshake returned" \ |
| 786 | -c "ssl_handshake returned" \ |
| 787 | -s "SSL - Handshake protocol not within min/max boundaries" |
| 788 | |
Manuel Pégourié-Gonnard | 8520dac | 2014-02-21 12:12:23 +0100 | [diff] [blame] | 789 | # Final report |
| 790 | |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 791 | echo "------------------------------------------------------------------------" |
| 792 | |
| 793 | if [ $FAILS = 0 ]; then |
| 794 | echo -n "PASSED" |
| 795 | else |
| 796 | echo -n "FAILED" |
| 797 | fi |
| 798 | PASSES=`echo $TESTS - $FAILS | bc` |
Manuel Pégourié-Gonnard | 4145b89 | 2014-02-24 13:20:14 +0100 | [diff] [blame] | 799 | echo " ($PASSES / $TESTS tests)" |
Manuel Pégourié-Gonnard | 33a752e | 2014-02-21 09:47:37 +0100 | [diff] [blame] | 800 | |
| 801 | exit $FAILS |