2014-02-20 10:01:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Test various options that are not covered by compat.sh
|
|
|
|
#
|
|
|
|
# Here the goal is not to cover every ciphersuite/version, but
|
|
|
|
# rather specific options (max fragment length, truncated hmac, etc)
|
|
|
|
# or procedures (session resumption from cache or ticket, renego, etc).
|
|
|
|
#
|
2014-07-23 18:17:47 +00:00
|
|
|
# Assumes a build with default options.
|
2014-02-20 10:01:30 +00:00
|
|
|
|
2014-02-25 16:14:15 +00:00
|
|
|
set -u
|
|
|
|
|
2014-02-27 11:25:54 +00:00
|
|
|
# default values, can be overriden by the environment
|
|
|
|
: ${P_SRV:=../programs/ssl/ssl_server2}
|
|
|
|
: ${P_CLI:=../programs/ssl/ssl_client2}
|
2014-09-05 15:45:19 +00:00
|
|
|
: ${P_PXY:=../programs/test/udp_proxy}
|
2014-03-13 17:47:44 +00:00
|
|
|
: ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system
|
2014-08-20 18:15:53 +00:00
|
|
|
: ${GNUTLS_CLI:=gnutls-cli}
|
|
|
|
: ${GNUTLS_SERV:=gnutls-serv}
|
2014-02-20 10:01:30 +00:00
|
|
|
|
2014-09-26 14:07:29 +00:00
|
|
|
O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key"
|
2014-03-13 17:47:44 +00:00
|
|
|
O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client"
|
2014-08-20 18:15:53 +00:00
|
|
|
G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key"
|
|
|
|
G_CLI="$GNUTLS_CLI"
|
2014-02-25 16:14:15 +00:00
|
|
|
|
2014-02-21 08:47:37 +00:00
|
|
|
TESTS=0
|
|
|
|
FAILS=0
|
2014-08-14 12:31:29 +00:00
|
|
|
SKIPS=0
|
2014-02-21 08:47:37 +00:00
|
|
|
|
2014-04-07 11:24:21 +00:00
|
|
|
CONFIG_H='../include/polarssl/config.h'
|
|
|
|
|
2014-02-26 15:35:27 +00:00
|
|
|
MEMCHECK=0
|
2014-03-13 18:17:53 +00:00
|
|
|
FILTER='.*'
|
2014-08-14 12:31:29 +00:00
|
|
|
EXCLUDE='^$'
|
2014-02-26 15:35:27 +00:00
|
|
|
|
|
|
|
print_usage() {
|
|
|
|
echo "Usage: $0 [options]"
|
2014-03-13 18:17:53 +00:00
|
|
|
echo -e " -h|--help\tPrint this help."
|
|
|
|
echo -e " -m|--memcheck\tCheck memory leaks and errors."
|
|
|
|
echo -e " -f|--filter\tOnly matching tests are executed (default: '$FILTER')"
|
|
|
|
echo -e " -e|--exclude\tMatching tests are excluded (default: '$EXCLUDE')"
|
2014-02-26 15:35:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_options() {
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
2014-03-13 18:17:53 +00:00
|
|
|
-f|--filter)
|
|
|
|
shift; FILTER=$1
|
|
|
|
;;
|
|
|
|
-e|--exclude)
|
|
|
|
shift; EXCLUDE=$1
|
|
|
|
;;
|
2014-02-26 15:35:27 +00:00
|
|
|
-m|--memcheck)
|
|
|
|
MEMCHECK=1
|
|
|
|
;;
|
|
|
|
-h|--help)
|
|
|
|
print_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
2014-05-22 13:47:58 +00:00
|
|
|
echo "Unknown argument: '$1'"
|
2014-02-26 15:35:27 +00:00
|
|
|
print_usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2014-08-14 12:31:29 +00:00
|
|
|
# skip next test if OpenSSL can't send SSLv2 ClientHello
|
|
|
|
requires_openssl_with_sslv2() {
|
|
|
|
if [ -z "${OPENSSL_HAS_SSL2:-}" ]; then
|
2014-08-30 20:09:36 +00:00
|
|
|
if $OPENSSL_CMD ciphers -ssl2 >/dev/null 2>&1; then
|
2014-08-14 12:31:29 +00:00
|
|
|
OPENSSL_HAS_SSL2="YES"
|
|
|
|
else
|
|
|
|
OPENSSL_HAS_SSL2="NO"
|
|
|
|
fi
|
|
|
|
fi
|
2014-07-23 18:17:47 +00:00
|
|
|
|
2014-08-14 12:31:29 +00:00
|
|
|
if [ "$OPENSSL_HAS_SSL2" = "NO" ]; then
|
|
|
|
SKIP_NEXT="YES"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-08-20 18:15:53 +00:00
|
|
|
# skip next test if GnuTLS isn't available
|
|
|
|
requires_gnutls() {
|
|
|
|
if [ -z "${GNUTLS_AVAILABLE:-}" ]; then
|
|
|
|
if ( which "$GNUTLS_CLI" && which "$GNUTLS_SERV" ) >/dev/null; then
|
|
|
|
GNUTLS_AVAILABLE="YES"
|
|
|
|
else
|
|
|
|
GNUTLS_AVAILABLE="NO"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$GNUTLS_AVAILABLE" = "NO" ]; then
|
|
|
|
SKIP_NEXT="YES"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-07-23 18:17:47 +00:00
|
|
|
# skip next test if IPv6 isn't available on this host
|
|
|
|
requires_ipv6() {
|
|
|
|
if [ -z "${HAS_IPV6:-}" ]; then
|
|
|
|
$P_SRV server_addr='::1' > $SRV_OUT 2>&1 &
|
|
|
|
SRV_PID=$!
|
|
|
|
sleep 1
|
|
|
|
kill $SRV_PID >/dev/null 2>&1
|
|
|
|
if grep "NET - Binding of the socket failed" $SRV_OUT >/dev/null; then
|
|
|
|
HAS_IPV6="NO"
|
|
|
|
else
|
|
|
|
HAS_IPV6="YES"
|
|
|
|
fi
|
|
|
|
rm -r $SRV_OUT
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$HAS_IPV6" = "NO" ]; then
|
|
|
|
SKIP_NEXT="YES"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-09-24 13:17:31 +00:00
|
|
|
# skip the next test if valgrind is in use
|
|
|
|
not_with_valgrind() {
|
|
|
|
if [ "$MEMCHECK" -gt 0 ]; then
|
|
|
|
SKIP_NEXT="YES"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-09-20 10:46:27 +00:00
|
|
|
# multiply the client timeout delay by the given factor for the next test
|
|
|
|
needs_more_time() {
|
|
|
|
CLI_DELAY_FACTOR=$1
|
|
|
|
}
|
|
|
|
|
2014-02-21 08:20:14 +00:00
|
|
|
# print_name <name>
|
|
|
|
print_name() {
|
|
|
|
echo -n "$1 "
|
2014-08-31 08:22:11 +00:00
|
|
|
LEN=$(( 72 - `echo "$1" | wc -c` ))
|
2014-02-21 08:20:14 +00:00
|
|
|
for i in `seq 1 $LEN`; do echo -n '.'; done
|
|
|
|
echo -n ' '
|
2014-02-21 08:47:37 +00:00
|
|
|
|
2014-08-31 08:22:11 +00:00
|
|
|
TESTS=$(( $TESTS + 1 ))
|
2014-02-21 08:20:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# fail <message>
|
|
|
|
fail() {
|
|
|
|
echo "FAIL"
|
2014-02-27 14:37:24 +00:00
|
|
|
echo " ! $1"
|
2014-02-21 08:47:37 +00:00
|
|
|
|
2014-08-31 14:46:04 +00:00
|
|
|
mv $SRV_OUT o-srv-${TESTS}.log
|
|
|
|
mv $CLI_OUT o-cli-${TESTS}.log
|
2014-09-05 15:45:19 +00:00
|
|
|
if [ -n "$PXY_CMD" ]; then
|
|
|
|
mv $PXY_OUT o-pxy-${TESTS}.log
|
|
|
|
fi
|
|
|
|
echo " ! outputs saved to o-XXX-${TESTS}.log"
|
2014-02-21 08:47:37 +00:00
|
|
|
|
2014-08-31 15:42:53 +00:00
|
|
|
if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot ]; then
|
|
|
|
echo " ! server output:"
|
|
|
|
cat o-srv-${TESTS}.log
|
2014-09-05 15:45:19 +00:00
|
|
|
echo " ! ========================================================"
|
2014-08-31 15:42:53 +00:00
|
|
|
echo " ! client output:"
|
|
|
|
cat o-cli-${TESTS}.log
|
2014-09-05 15:45:19 +00:00
|
|
|
if [ -n "$PXY_CMD" ]; then
|
|
|
|
echo " ! ========================================================"
|
|
|
|
echo " ! proxy output:"
|
|
|
|
cat o-pxy-${TESTS}.log
|
|
|
|
fi
|
|
|
|
echo ""
|
2014-08-31 15:42:53 +00:00
|
|
|
fi
|
|
|
|
|
2014-08-31 08:22:11 +00:00
|
|
|
FAILS=$(( $FAILS + 1 ))
|
2014-02-21 08:20:14 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 15:42:31 +00:00
|
|
|
# is_polar <cmd_line>
|
|
|
|
is_polar() {
|
|
|
|
echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null
|
|
|
|
}
|
|
|
|
|
2014-09-26 14:07:29 +00:00
|
|
|
# openssl s_server doesn't have -www with DTLS
|
|
|
|
check_osrv_dtls() {
|
|
|
|
if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then
|
|
|
|
NEEDS_INPUT=1
|
|
|
|
SRV_CMD="$( echo $SRV_CMD | sed s/-www// )"
|
|
|
|
else
|
|
|
|
NEEDS_INPUT=0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# provide input to commands that need it
|
|
|
|
provide_input() {
|
|
|
|
if [ $NEEDS_INPUT -eq 0 ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
echo "HTTP/1.0 200 OK"
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2014-02-26 15:35:27 +00:00
|
|
|
# has_mem_err <log_file_name>
|
|
|
|
has_mem_err() {
|
|
|
|
if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" &&
|
|
|
|
grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$1" ) > /dev/null
|
|
|
|
then
|
|
|
|
return 1 # false: does not have errors
|
|
|
|
else
|
|
|
|
return 0 # true: has errors
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-06-20 16:41:11 +00:00
|
|
|
# wait for server to start: two versions depending on lsof availability
|
|
|
|
wait_server_start() {
|
|
|
|
if which lsof >/dev/null; then
|
|
|
|
# make sure we don't loop forever
|
|
|
|
( sleep "$DOG_DELAY"; echo "SERVERSTART TIMEOUT"; kill $MAIN_PID ) &
|
2014-09-20 11:15:43 +00:00
|
|
|
DOG_PID=$!
|
2014-06-20 16:41:11 +00:00
|
|
|
|
|
|
|
# make a tight loop, server usually takes less than 1 sec to start
|
2014-07-23 18:17:47 +00:00
|
|
|
if [ "$DTLS" -eq 1 ]; then
|
2014-09-05 15:45:19 +00:00
|
|
|
until lsof -nbi UDP:"$SRV_PORT" | grep UDP >/dev/null; do :; done
|
2014-07-23 18:17:47 +00:00
|
|
|
else
|
2014-09-05 15:45:19 +00:00
|
|
|
until lsof -nbi TCP:"$SRV_PORT" | grep LISTEN >/dev/null; do :; done
|
2014-07-23 18:17:47 +00:00
|
|
|
fi
|
2014-06-20 16:41:11 +00:00
|
|
|
|
2014-09-20 11:15:43 +00:00
|
|
|
kill $DOG_PID >/dev/null 2>&1
|
|
|
|
wait $DOG_PID
|
2014-06-20 16:41:11 +00:00
|
|
|
else
|
|
|
|
sleep "$START_DELAY"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-08-30 20:41:47 +00:00
|
|
|
# wait for client to terminate and set CLI_EXIT
|
|
|
|
# must be called right after starting the client
|
|
|
|
wait_client_done() {
|
|
|
|
CLI_PID=$!
|
|
|
|
|
2014-09-20 10:46:27 +00:00
|
|
|
CLI_DELAY=$(( $DOG_DELAY * $CLI_DELAY_FACTOR ))
|
|
|
|
CLI_DELAY_FACTOR=1
|
|
|
|
|
|
|
|
( sleep $CLI_DELAY; echo "TIMEOUT" >> $CLI_OUT; kill $CLI_PID ) &
|
2014-09-20 11:15:43 +00:00
|
|
|
DOG_PID=$!
|
2014-08-30 20:41:47 +00:00
|
|
|
|
|
|
|
wait $CLI_PID
|
|
|
|
CLI_EXIT=$?
|
|
|
|
|
2014-09-20 11:15:43 +00:00
|
|
|
kill $DOG_PID >/dev/null 2>&1
|
|
|
|
wait $DOG_PID
|
2014-08-30 20:41:47 +00:00
|
|
|
|
|
|
|
echo "EXIT: $CLI_EXIT" >> $CLI_OUT
|
|
|
|
}
|
|
|
|
|
2014-07-23 18:17:47 +00:00
|
|
|
# check if the given command uses dtls and sets global variable DTLS
|
|
|
|
detect_dtls() {
|
2014-09-05 15:45:19 +00:00
|
|
|
if echo "$1" | grep 'dtls=1\|-dtls1\|-u' >/dev/null; then
|
2014-07-23 18:17:47 +00:00
|
|
|
DTLS=1
|
|
|
|
else
|
|
|
|
DTLS=0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-09-05 15:45:19 +00:00
|
|
|
# Usage: run_test name [-p proxy_cmd] srv_cmd cli_cmd cli_exit [option [...]]
|
2014-02-20 10:01:30 +00:00
|
|
|
# Options: -s pattern pattern that must be present in server output
|
|
|
|
# -c pattern pattern that must be present in client output
|
|
|
|
# -S pattern pattern that must be absent in server output
|
|
|
|
# -C pattern pattern that must be absent in client output
|
|
|
|
run_test() {
|
2014-02-25 16:14:15 +00:00
|
|
|
NAME="$1"
|
2014-09-05 15:45:19 +00:00
|
|
|
shift 1
|
2014-02-25 16:14:15 +00:00
|
|
|
|
2014-03-13 18:17:53 +00:00
|
|
|
if echo "$NAME" | grep "$FILTER" | grep -v "$EXCLUDE" >/dev/null; then :
|
|
|
|
else
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-02-25 16:14:15 +00:00
|
|
|
print_name "$NAME"
|
2014-02-20 10:01:30 +00:00
|
|
|
|
2014-08-14 12:31:29 +00:00
|
|
|
# should we skip?
|
|
|
|
if [ "X$SKIP_NEXT" = "XYES" ]; then
|
|
|
|
SKIP_NEXT="NO"
|
|
|
|
echo "SKIP"
|
2014-08-31 08:22:11 +00:00
|
|
|
SKIPS=$(( $SKIPS + 1 ))
|
2014-08-14 12:31:29 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-09-05 15:45:19 +00:00
|
|
|
# does this test use a proxy?
|
|
|
|
if [ "X$1" = "X-p" ]; then
|
|
|
|
PXY_CMD="$2"
|
|
|
|
shift 2
|
|
|
|
else
|
|
|
|
PXY_CMD=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get commands and client output
|
|
|
|
SRV_CMD="$1"
|
|
|
|
CLI_CMD="$2"
|
|
|
|
CLI_EXPECT="$3"
|
|
|
|
shift 3
|
|
|
|
|
|
|
|
# fix client port
|
|
|
|
if [ -n "$PXY_CMD" ]; then
|
|
|
|
CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g )
|
|
|
|
else
|
|
|
|
CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g )
|
|
|
|
fi
|
|
|
|
|
2014-07-23 18:17:47 +00:00
|
|
|
# update DTLS variable
|
|
|
|
detect_dtls "$SRV_CMD"
|
|
|
|
|
2014-02-26 15:35:27 +00:00
|
|
|
# prepend valgrind to our commands if active
|
|
|
|
if [ "$MEMCHECK" -gt 0 ]; then
|
|
|
|
if is_polar "$SRV_CMD"; then
|
|
|
|
SRV_CMD="valgrind --leak-check=full $SRV_CMD"
|
|
|
|
fi
|
|
|
|
if is_polar "$CLI_CMD"; then
|
|
|
|
CLI_CMD="valgrind --leak-check=full $CLI_CMD"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-02-20 10:01:30 +00:00
|
|
|
# run the commands
|
2014-09-05 15:45:19 +00:00
|
|
|
if [ -n "$PXY_CMD" ]; then
|
|
|
|
echo "$PXY_CMD" > $PXY_OUT
|
2014-09-20 11:15:43 +00:00
|
|
|
$PXY_CMD >> $PXY_OUT 2>&1 &
|
2014-09-05 15:45:19 +00:00
|
|
|
PXY_PID=$!
|
|
|
|
# assume proxy starts faster than server
|
|
|
|
fi
|
|
|
|
|
2014-09-26 14:07:29 +00:00
|
|
|
check_osrv_dtls
|
2014-05-28 21:06:50 +00:00
|
|
|
echo "$SRV_CMD" > $SRV_OUT
|
2014-09-26 14:07:29 +00:00
|
|
|
provide_input | $SRV_CMD >> $SRV_OUT 2>&1 &
|
2014-02-20 10:01:30 +00:00
|
|
|
SRV_PID=$!
|
2014-06-20 16:41:11 +00:00
|
|
|
wait_server_start
|
2014-08-30 20:41:47 +00:00
|
|
|
|
2014-05-28 21:06:50 +00:00
|
|
|
echo "$CLI_CMD" > $CLI_OUT
|
2014-08-30 20:41:47 +00:00
|
|
|
eval "$CLI_CMD" >> $CLI_OUT 2>&1 &
|
|
|
|
wait_client_done
|
2014-03-25 13:16:44 +00:00
|
|
|
|
2014-09-05 15:45:19 +00:00
|
|
|
# terminate the server (and the proxy)
|
2014-08-14 13:47:33 +00:00
|
|
|
kill $SRV_PID
|
|
|
|
wait $SRV_PID
|
2014-09-05 15:45:19 +00:00
|
|
|
if [ -n "$PXY_CMD" ]; then
|
2014-09-20 10:46:27 +00:00
|
|
|
kill $PXY_PID >/dev/null 2>&1
|
2014-09-05 15:45:19 +00:00
|
|
|
wait $PXY_PID
|
|
|
|
fi
|
2014-02-25 15:42:31 +00:00
|
|
|
|
|
|
|
# check if the client and server went at least to the handshake stage
|
2014-05-22 13:47:58 +00:00
|
|
|
# (useful to avoid tests with only negative assertions and non-zero
|
2014-02-25 15:42:31 +00:00
|
|
|
# expected client exit to incorrectly succeed in case of catastrophic
|
|
|
|
# failure)
|
2014-02-25 16:14:15 +00:00
|
|
|
if is_polar "$SRV_CMD"; then
|
2014-05-28 21:06:50 +00:00
|
|
|
if grep "Performing the SSL/TLS handshake" $SRV_OUT >/dev/null; then :;
|
2014-02-25 15:42:31 +00:00
|
|
|
else
|
|
|
|
fail "server failed to start"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
2014-02-25 16:14:15 +00:00
|
|
|
if is_polar "$CLI_CMD"; then
|
2014-05-28 21:06:50 +00:00
|
|
|
if grep "Performing the SSL/TLS handshake" $CLI_OUT >/dev/null; then :;
|
2014-02-25 15:42:31 +00:00
|
|
|
else
|
|
|
|
fail "client failed to start"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-02-21 08:20:14 +00:00
|
|
|
# check server exit code
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
fail "server fail"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-02-20 10:01:30 +00:00
|
|
|
# check client exit code
|
2014-02-25 16:14:15 +00:00
|
|
|
if [ \( "$CLI_EXPECT" = 0 -a "$CLI_EXIT" != 0 \) -o \
|
|
|
|
\( "$CLI_EXPECT" != 0 -a "$CLI_EXIT" = 0 \) ]
|
2014-02-20 16:19:59 +00:00
|
|
|
then
|
2014-09-05 15:45:19 +00:00
|
|
|
fail "bad client exit code (expected $CLI_EXPECT, got $CLI_EXIT)"
|
2014-02-20 10:01:30 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-02-26 15:35:27 +00:00
|
|
|
# check other assertions
|
2014-08-21 17:38:32 +00:00
|
|
|
# lines beginning with == are added by valgrind, ignore them
|
2014-02-20 10:01:30 +00:00
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case $1 in
|
|
|
|
"-s")
|
2014-08-21 17:38:32 +00:00
|
|
|
if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then :; else
|
2014-02-21 08:20:14 +00:00
|
|
|
fail "-s $2"
|
2014-02-20 10:01:30 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
"-c")
|
2014-08-21 17:38:32 +00:00
|
|
|
if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then :; else
|
2014-02-21 08:20:14 +00:00
|
|
|
fail "-c $2"
|
2014-02-20 10:01:30 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
"-S")
|
2014-08-21 17:38:32 +00:00
|
|
|
if grep -v '^==' $SRV_OUT | grep "$2" >/dev/null; then
|
2014-02-21 08:20:14 +00:00
|
|
|
fail "-S $2"
|
2014-02-20 10:01:30 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
"-C")
|
2014-08-21 17:38:32 +00:00
|
|
|
if grep -v '^==' $CLI_OUT | grep "$2" >/dev/null; then
|
2014-02-21 08:20:14 +00:00
|
|
|
fail "-C $2"
|
2014-02-20 10:01:30 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2014-05-22 13:47:58 +00:00
|
|
|
echo "Unknown test: $1" >&2
|
2014-02-20 10:01:30 +00:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
shift 2
|
|
|
|
done
|
|
|
|
|
2014-02-26 15:35:27 +00:00
|
|
|
# check valgrind's results
|
|
|
|
if [ "$MEMCHECK" -gt 0 ]; then
|
2014-05-28 21:06:50 +00:00
|
|
|
if is_polar "$SRV_CMD" && has_mem_err $SRV_OUT; then
|
2014-02-26 15:35:27 +00:00
|
|
|
fail "Server has memory errors"
|
|
|
|
return
|
|
|
|
fi
|
2014-05-28 21:06:50 +00:00
|
|
|
if is_polar "$CLI_CMD" && has_mem_err $CLI_OUT; then
|
2014-02-26 15:35:27 +00:00
|
|
|
fail "Client has memory errors"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-02-20 10:01:30 +00:00
|
|
|
# if we're here, everything is ok
|
|
|
|
echo "PASS"
|
2014-09-05 15:45:19 +00:00
|
|
|
rm -f $SRV_OUT $CLI_OUT $PXY_OUT
|
2014-02-20 10:01:30 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 15:21:22 +00:00
|
|
|
cleanup() {
|
2014-09-05 15:45:19 +00:00
|
|
|
rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION
|
2014-09-20 11:15:43 +00:00
|
|
|
test -n "${SRV_PID:-}" && kill $SRV_PID >/dev/null 2>&1
|
|
|
|
test -n "${PXY_PID:-}" && kill $PXY_PID >/dev/null 2>&1
|
|
|
|
test -n "${CLI_PID:-}" && kill $CLI_PID >/dev/null 2>&1
|
|
|
|
test -n "${DOG_PID:-}" && kill $DOG_PID >/dev/null 2>&1
|
2014-02-25 15:21:22 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2014-02-26 17:21:02 +00:00
|
|
|
#
|
|
|
|
# MAIN
|
|
|
|
#
|
|
|
|
|
2014-03-28 09:12:38 +00:00
|
|
|
get_options "$@"
|
|
|
|
|
2014-02-27 11:25:54 +00:00
|
|
|
# sanity checks, avoid an avalanche of errors
|
|
|
|
if [ ! -x "$P_SRV" ]; then
|
|
|
|
echo "Command '$P_SRV' is not an executable file"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -x "$P_CLI" ]; then
|
|
|
|
echo "Command '$P_CLI' is not an executable file"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-09-05 15:45:19 +00:00
|
|
|
if [ ! -x "$P_PXY" ]; then
|
|
|
|
echo "Command '$P_PXY' is not an executable file"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-13 17:47:44 +00:00
|
|
|
if which $OPENSSL_CMD >/dev/null 2>&1; then :; else
|
|
|
|
echo "Command '$OPENSSL_CMD' not found"
|
2014-02-27 11:25:54 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-05-29 09:31:20 +00:00
|
|
|
# used by watchdog
|
|
|
|
MAIN_PID="$$"
|
|
|
|
|
2014-06-20 16:41:11 +00:00
|
|
|
# be more patient with valgrind
|
|
|
|
if [ "$MEMCHECK" -gt 0 ]; then
|
|
|
|
START_DELAY=3
|
|
|
|
DOG_DELAY=30
|
|
|
|
else
|
|
|
|
START_DELAY=1
|
|
|
|
DOG_DELAY=10
|
|
|
|
fi
|
2014-09-20 10:46:27 +00:00
|
|
|
CLI_DELAY_FACTOR=1
|
2014-06-20 16:41:11 +00:00
|
|
|
|
2014-09-05 15:45:19 +00:00
|
|
|
# Pick a "unique" server port in the range 10000-19999, and a proxy port
|
|
|
|
PORT_BASE="0000$$"
|
|
|
|
PORT_BASE="$( echo -n $PORT_BASE | tail -c 4 )"
|
|
|
|
SRV_PORT="1$PORT_BASE"
|
|
|
|
PXY_PORT="2$PORT_BASE"
|
|
|
|
unset PORT_BASE
|
2014-05-28 20:59:30 +00:00
|
|
|
|
2014-07-23 18:17:47 +00:00
|
|
|
# fix commands to use this port, force IPv4 while at it
|
2014-09-05 15:45:19 +00:00
|
|
|
P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT"
|
|
|
|
P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT"
|
|
|
|
P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT"
|
|
|
|
O_SRV="$O_SRV -accept $SRV_PORT"
|
|
|
|
O_CLI="$O_CLI -connect localhost:+SRV_PORT"
|
|
|
|
G_SRV="$G_SRV -p $SRV_PORT"
|
|
|
|
G_CLI="$G_CLI -p +SRV_PORT"
|
2014-05-28 20:59:30 +00:00
|
|
|
|
2014-05-28 21:06:50 +00:00
|
|
|
# Also pick a unique name for intermediate files
|
|
|
|
SRV_OUT="srv_out.$$"
|
|
|
|
CLI_OUT="cli_out.$$"
|
2014-09-05 15:45:19 +00:00
|
|
|
PXY_OUT="pxy_out.$$"
|
2014-05-28 21:06:50 +00:00
|
|
|
SESSION="session.$$"
|
|
|
|
|
2014-08-14 12:31:29 +00:00
|
|
|
SKIP_NEXT="NO"
|
|
|
|
|
2014-02-25 15:21:22 +00:00
|
|
|
trap cleanup INT TERM HUP
|
2014-02-20 10:01:30 +00:00
|
|
|
|
2014-07-12 02:00:00 +00:00
|
|
|
# Basic test
|
|
|
|
|
2014-08-21 17:38:32 +00:00
|
|
|
# Checks that:
|
|
|
|
# - things work with all ciphersuites active (used with config-full in all.sh)
|
|
|
|
# - the expected (highest security) parameters are selected
|
|
|
|
# ("signature_algorithm ext: 6" means SHA-512 (highest common hash))
|
2014-07-12 02:00:00 +00:00
|
|
|
run_test "Default" \
|
2014-08-21 17:38:32 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
2014-07-12 02:00:00 +00:00
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
2014-08-21 17:38:32 +00:00
|
|
|
-s "Protocol is TLSv1.2" \
|
|
|
|
-s "Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" \
|
|
|
|
-s "client hello v3, signature_algorithm ext: 6" \
|
|
|
|
-s "ECDHE curve: secp521r1" \
|
|
|
|
-S "error" \
|
|
|
|
-C "error"
|
2014-07-12 02:00:00 +00:00
|
|
|
|
2014-02-25 13:18:30 +00:00
|
|
|
# Test for SSLv2 ClientHello
|
|
|
|
|
2014-08-14 12:31:29 +00:00
|
|
|
requires_openssl_with_sslv2
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SSLv2 ClientHello: reference" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$O_CLI -no_ssl2" \
|
2014-02-25 13:18:30 +00:00
|
|
|
0 \
|
|
|
|
-S "parse client hello v2" \
|
|
|
|
-S "ssl_handshake returned"
|
|
|
|
|
|
|
|
# Adding a SSL2-only suite makes OpenSSL client send SSLv2 ClientHello
|
2014-08-14 12:31:29 +00:00
|
|
|
requires_openssl_with_sslv2
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SSLv2 ClientHello: actual test" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=2" \
|
2014-02-25 16:14:15 +00:00
|
|
|
"$O_CLI -cipher 'DES-CBC-MD5:ALL'" \
|
2014-02-25 13:18:30 +00:00
|
|
|
0 \
|
|
|
|
-s "parse client hello v2" \
|
|
|
|
-S "ssl_handshake returned"
|
|
|
|
|
2014-02-20 16:19:59 +00:00
|
|
|
# Tests for Truncated HMAC extension
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Truncated HMAC: reference" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=4" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_CLI trunc_hmac=0 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-s "dumping 'computed mac' (20 bytes)"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Truncated HMAC: actual test" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=4" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_CLI trunc_hmac=1 force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
2014-02-20 10:01:30 +00:00
|
|
|
0 \
|
2014-02-20 10:43:46 +00:00
|
|
|
-s "dumping 'computed mac' (10 bytes)"
|
|
|
|
|
2014-02-20 16:19:59 +00:00
|
|
|
# Tests for Session Tickets
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using tickets: basic" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=1" \
|
|
|
|
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
2014-02-20 10:43:46 +00:00
|
|
|
0 \
|
2014-02-20 21:50:56 +00:00
|
|
|
-c "client hello, adding session ticket extension" \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-s "server hello, adding session ticket extension" \
|
|
|
|
-c "found session_ticket extension" \
|
|
|
|
-c "parse new session ticket" \
|
2014-02-20 10:43:46 +00:00
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-s "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using tickets: cache disabled" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=1 cache_max=0" \
|
|
|
|
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
2014-02-21 08:18:13 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding session ticket extension" \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-s "server hello, adding session ticket extension" \
|
|
|
|
-c "found session_ticket extension" \
|
|
|
|
-c "parse new session ticket" \
|
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-s "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using tickets: timeout" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=1 cache_max=0 ticket_timeout=1" \
|
|
|
|
"$P_CLI debug_level=3 tickets=1 reconnect=1 reco_delay=2" \
|
2014-02-21 08:18:13 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding session ticket extension" \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-s "server hello, adding session ticket extension" \
|
|
|
|
-c "found session_ticket extension" \
|
|
|
|
-c "parse new session ticket" \
|
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-S "a session has been resumed" \
|
|
|
|
-C "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using tickets: openssl server" \
|
2014-02-27 11:25:54 +00:00
|
|
|
"$O_SRV" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
2014-02-25 16:14:15 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding session ticket extension" \
|
|
|
|
-c "found session_ticket extension" \
|
|
|
|
-c "parse new session ticket" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using tickets: openssl client" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=1" \
|
2014-05-28 21:06:50 +00:00
|
|
|
"( $O_CLI -sess_out $SESSION; \
|
|
|
|
$O_CLI -sess_in $SESSION; \
|
|
|
|
rm -f $SESSION )" \
|
2014-02-25 16:14:15 +00:00
|
|
|
0 \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-s "server hello, adding session ticket extension" \
|
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-s "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed"
|
|
|
|
|
2014-02-20 21:50:56 +00:00
|
|
|
# Tests for Session Resume based on session-ID and cache
|
2014-02-20 16:19:59 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: tickets enabled on client" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0" \
|
|
|
|
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
2014-02-20 10:43:46 +00:00
|
|
|
0 \
|
2014-02-20 21:50:56 +00:00
|
|
|
-c "client hello, adding session ticket extension" \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-S "server hello, adding session ticket extension" \
|
|
|
|
-C "found session_ticket extension" \
|
|
|
|
-C "parse new session ticket" \
|
2014-02-20 10:43:46 +00:00
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: tickets enabled on server" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=1" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1" \
|
2014-02-20 10:43:46 +00:00
|
|
|
0 \
|
2014-02-20 21:50:56 +00:00
|
|
|
-C "client hello, adding session ticket extension" \
|
|
|
|
-S "found session ticket extension" \
|
|
|
|
-S "server hello, adding session ticket extension" \
|
|
|
|
-C "found session_ticket extension" \
|
|
|
|
-C "parse new session ticket" \
|
2014-02-20 10:43:46 +00:00
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
2014-02-20 13:50:42 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: cache_max=0" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0 cache_max=0" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1" \
|
2014-02-20 21:50:56 +00:00
|
|
|
0 \
|
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-S "a session has been resumed" \
|
|
|
|
-C "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: cache_max=1" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0 cache_max=1" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1" \
|
2014-02-20 21:50:56 +00:00
|
|
|
0 \
|
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: timemout > delay" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=0" \
|
2014-02-20 21:50:56 +00:00
|
|
|
0 \
|
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: timeout < delay" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0 cache_timeout=1" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
|
2014-02-20 20:32:41 +00:00
|
|
|
0 \
|
|
|
|
-S "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
2014-02-20 21:50:56 +00:00
|
|
|
-S "a session has been resumed" \
|
|
|
|
-C "a session has been resumed"
|
2014-02-20 20:32:41 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: no timeout" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0 cache_timeout=0" \
|
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1 reco_delay=2" \
|
2014-02-20 20:32:41 +00:00
|
|
|
0 \
|
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: openssl client" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 tickets=0" \
|
2014-05-28 21:06:50 +00:00
|
|
|
"( $O_CLI -sess_out $SESSION; \
|
|
|
|
$O_CLI -sess_in $SESSION; \
|
|
|
|
rm -f $SESSION )" \
|
2014-02-25 16:57:59 +00:00
|
|
|
0 \
|
|
|
|
-s "found session ticket extension" \
|
|
|
|
-S "server hello, adding session ticket extension" \
|
|
|
|
-s "session successfully restored from cache" \
|
|
|
|
-S "session successfully restored from ticket" \
|
|
|
|
-s "a session has been resumed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Session resume using cache: openssl server" \
|
2014-02-27 11:25:54 +00:00
|
|
|
"$O_SRV" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 tickets=0 reconnect=1" \
|
2014-02-25 16:57:59 +00:00
|
|
|
0 \
|
|
|
|
-C "found session_ticket extension" \
|
|
|
|
-C "parse new session ticket" \
|
|
|
|
-c "a session has been resumed"
|
|
|
|
|
2014-02-20 16:19:59 +00:00
|
|
|
# Tests for Max Fragment Length extension
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Max fragment length: not used, reference" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
|
|
|
"$P_CLI debug_level=3" \
|
2014-02-20 13:50:42 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding max_fragment_length extension" \
|
|
|
|
-S "found max fragment length extension" \
|
|
|
|
-S "server hello, max_fragment_length extension" \
|
|
|
|
-C "found max_fragment_length extension"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Max fragment length: used by client" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
|
|
|
"$P_CLI debug_level=3 max_frag_len=4096" \
|
2014-02-20 13:50:42 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding max_fragment_length extension" \
|
|
|
|
-s "found max fragment length extension" \
|
|
|
|
-s "server hello, max_fragment_length extension" \
|
|
|
|
-c "found max_fragment_length extension"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Max fragment length: used by server" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 max_frag_len=4096" \
|
|
|
|
"$P_CLI debug_level=3" \
|
2014-02-20 13:50:42 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding max_fragment_length extension" \
|
|
|
|
-S "found max fragment length extension" \
|
|
|
|
-S "server hello, max_fragment_length extension" \
|
|
|
|
-C "found max_fragment_length extension"
|
2014-02-20 16:19:59 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
requires_gnutls
|
|
|
|
run_test "Max fragment length: gnutls server" \
|
2014-08-20 18:15:53 +00:00
|
|
|
"$G_SRV" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 max_frag_len=4096" \
|
2014-08-20 18:15:53 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding max_fragment_length extension" \
|
|
|
|
-c "found max_fragment_length extension"
|
|
|
|
|
2014-02-20 16:19:59 +00:00
|
|
|
# Tests for renegotiation
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: none, for reference" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-C "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
2014-02-20 16:19:59 +00:00
|
|
|
-S "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: client-initiated" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
2014-02-20 16:19:59 +00:00
|
|
|
-S "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
2014-02-20 16:19:59 +00:00
|
|
|
-s "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: double" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
2014-02-20 16:19:59 +00:00
|
|
|
-s "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: client-initiated, server-rejected" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=0" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
2014-02-20 16:19:59 +00:00
|
|
|
1 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-c "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
2014-07-04 12:32:27 +00:00
|
|
|
-S "write hello request" \
|
2014-08-19 10:50:30 +00:00
|
|
|
-c "SSL - Unexpected message at ServerHello in renegotiation" \
|
2014-07-04 12:32:27 +00:00
|
|
|
-c "failed"
|
2014-02-20 16:19:59 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated, client-rejected, default" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1" \
|
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
|
2014-02-20 16:19:59 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
2014-02-26 15:35:27 +00:00
|
|
|
-C "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
2014-02-20 16:19:59 +00:00
|
|
|
-s "write hello request" \
|
2014-07-03 17:29:16 +00:00
|
|
|
-S "SSL - An unexpected message was received from our peer" \
|
|
|
|
-S "failed"
|
2014-02-21 08:47:37 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated, client-rejected, not enforced" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
|
2014-07-04 12:32:27 +00:00
|
|
|
renego_delay=-1" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
|
2014-07-04 12:32:27 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-C "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
|
|
|
-s "write hello request" \
|
|
|
|
-S "SSL - An unexpected message was received from our peer" \
|
|
|
|
-S "failed"
|
|
|
|
|
2014-08-15 10:07:38 +00:00
|
|
|
# delay 2 for 1 alert record + 1 application data record
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated, client-rejected, delay 2" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
|
2014-08-15 10:07:38 +00:00
|
|
|
renego_delay=2" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
|
2014-07-04 12:32:27 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-C "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
|
|
|
-s "write hello request" \
|
|
|
|
-S "SSL - An unexpected message was received from our peer" \
|
|
|
|
-S "failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated, client-rejected, delay 0" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
|
2014-07-04 12:32:27 +00:00
|
|
|
renego_delay=0" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=0" \
|
2014-07-04 12:32:27 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-S "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-C "=> renegotiate" \
|
|
|
|
-S "=> renegotiate" \
|
|
|
|
-s "write hello request" \
|
2014-08-15 10:07:38 +00:00
|
|
|
-s "SSL - An unexpected message was received from our peer"
|
2014-07-04 12:32:27 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: server-initiated, client-accepted, delay 0" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 exchanges=2 renegotiation=1 renegotiate=1 \
|
2014-07-04 12:32:27 +00:00
|
|
|
renego_delay=0" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=2 renegotiation=1" \
|
2014-07-04 12:32:27 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-s "write hello request" \
|
|
|
|
-S "SSL - An unexpected message was received from our peer" \
|
|
|
|
-S "failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: nbio, client-initiated" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1" \
|
|
|
|
"$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \
|
2014-08-15 17:04:47 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-S "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: nbio, server-initiated" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 nbio=2 exchanges=2 renegotiation=1 renegotiate=1" \
|
|
|
|
"$P_CLI debug_level=3 nbio=2 exchanges=2 renegotiation=1" \
|
2014-08-15 17:04:47 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-s "write hello request"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: openssl server, client-initiated" \
|
2014-08-31 16:37:01 +00:00
|
|
|
"$O_SRV -www" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
|
2014-08-30 19:22:47 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-C "error" \
|
|
|
|
-c "HTTP/1.0 200 [Oo][Kk]"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Renegotiation: gnutls server, client-initiated" \
|
2014-08-30 19:22:47 +00:00
|
|
|
"$G_SRV" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
|
2014-08-30 19:22:47 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-C "error" \
|
|
|
|
-c "HTTP/1.0 200 [Oo][Kk]"
|
|
|
|
|
2014-08-19 15:43:50 +00:00
|
|
|
run_test "Renegotiation: DTLS, client-initiated" \
|
|
|
|
"$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1" \
|
|
|
|
"$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
|
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-S "write hello request"
|
|
|
|
|
2014-08-19 15:53:11 +00:00
|
|
|
run_test "Renegotiation: DTLS, server-initiated" \
|
|
|
|
"$P_SRV debug_level=3 dtls=1 exchanges=2 renegotiation=1 renegotiate=1" \
|
2014-10-02 12:17:18 +00:00
|
|
|
"$P_CLI debug_level=3 dtls=1 exchanges=2 renegotiation=1 \
|
|
|
|
read_timeout=1000 max_resend=2" \
|
2014-08-19 15:53:11 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-s "received TLS_EMPTY_RENEGOTIATION_INFO" \
|
|
|
|
-s "found renegotiation extension" \
|
|
|
|
-s "server hello, secure renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-s "write hello request"
|
|
|
|
|
2014-08-31 15:13:13 +00:00
|
|
|
run_test "Renegotiation: DTLS, gnutls server, client-initiated" \
|
|
|
|
"$G_SRV -u --mtu 4096" \
|
|
|
|
"$P_CLI debug_level=3 dtls=1 exchanges=1 renegotiation=1 renegotiate=1" \
|
|
|
|
0 \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-C "error" \
|
|
|
|
-s "Extra-header:"
|
|
|
|
|
2014-02-21 11:12:23 +00:00
|
|
|
# Tests for auth_mode
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: server badcert, client required" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_SRV crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 auth_mode=required" \
|
2014-02-21 11:12:23 +00:00
|
|
|
1 \
|
|
|
|
-c "x509_verify_cert() returned" \
|
|
|
|
-c "! self-signed or not signed by a trusted CA" \
|
|
|
|
-c "! ssl_handshake returned" \
|
|
|
|
-c "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: server badcert, client optional" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_SRV crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 auth_mode=optional" \
|
2014-02-21 11:12:23 +00:00
|
|
|
0 \
|
|
|
|
-c "x509_verify_cert() returned" \
|
|
|
|
-c "! self-signed or not signed by a trusted CA" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-C "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: server badcert, client none" \
|
2014-02-25 13:18:30 +00:00
|
|
|
"$P_SRV crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 auth_mode=none" \
|
2014-02-21 11:12:23 +00:00
|
|
|
0 \
|
|
|
|
-C "x509_verify_cert() returned" \
|
|
|
|
-C "! self-signed or not signed by a trusted CA" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-C "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client badcert, server required" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=required" \
|
|
|
|
"$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
|
|
|
1 \
|
|
|
|
-S "skip write certificate request" \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got a certificate request" \
|
|
|
|
-C "skip write certificate" \
|
|
|
|
-C "skip write certificate verify" \
|
|
|
|
-S "skip parse certificate verify" \
|
|
|
|
-s "x509_verify_cert() returned" \
|
|
|
|
-S "! self-signed or not signed by a trusted CA" \
|
|
|
|
-s "! ssl_handshake returned" \
|
|
|
|
-c "! ssl_handshake returned" \
|
|
|
|
-s "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client badcert, server optional" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=optional" \
|
|
|
|
"$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
|
|
|
0 \
|
|
|
|
-S "skip write certificate request" \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got a certificate request" \
|
|
|
|
-C "skip write certificate" \
|
|
|
|
-C "skip write certificate verify" \
|
|
|
|
-S "skip parse certificate verify" \
|
|
|
|
-s "x509_verify_cert() returned" \
|
|
|
|
-s "! self-signed or not signed by a trusted CA" \
|
|
|
|
-S "! ssl_handshake returned" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-S "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client badcert, server none" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=none" \
|
|
|
|
"$P_CLI debug_level=3 crt_file=data_files/server5-badsign.crt \
|
2014-02-21 11:12:23 +00:00
|
|
|
key_file=data_files/server5.key" \
|
|
|
|
0 \
|
|
|
|
-s "skip write certificate request" \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got no certificate request" \
|
|
|
|
-c "skip write certificate" \
|
|
|
|
-c "skip write certificate verify" \
|
|
|
|
-s "skip parse certificate verify" \
|
|
|
|
-S "x509_verify_cert() returned" \
|
|
|
|
-S "! self-signed or not signed by a trusted CA" \
|
|
|
|
-S "! ssl_handshake returned" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-S "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client no cert, server optional" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=optional" \
|
|
|
|
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
2014-02-27 13:58:26 +00:00
|
|
|
0 \
|
|
|
|
-S "skip write certificate request" \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got a certificate request" \
|
|
|
|
-C "skip write certificate$" \
|
|
|
|
-C "got no certificate to send" \
|
|
|
|
-S "SSLv3 client has no certificate" \
|
|
|
|
-c "skip write certificate verify" \
|
|
|
|
-s "skip parse certificate verify" \
|
|
|
|
-s "! no client certificate sent" \
|
|
|
|
-S "! ssl_handshake returned" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-S "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: openssl client no cert, server optional" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=optional" \
|
2014-02-27 13:58:26 +00:00
|
|
|
"$O_CLI" \
|
|
|
|
0 \
|
|
|
|
-S "skip write certificate request" \
|
|
|
|
-s "skip parse certificate verify" \
|
|
|
|
-s "! no client certificate sent" \
|
|
|
|
-S "! ssl_handshake returned" \
|
|
|
|
-S "X509 - Certificate verification failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client no cert, openssl server optional" \
|
2014-02-27 13:58:26 +00:00
|
|
|
"$O_SRV -verify 10" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
2014-02-27 13:58:26 +00:00
|
|
|
0 \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got a certificate request" \
|
|
|
|
-C "skip write certificate$" \
|
|
|
|
-c "skip write certificate verify" \
|
|
|
|
-C "! ssl_handshake returned"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Authentication: client no cert, ssl3" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 auth_mode=optional force_version=ssl3" \
|
|
|
|
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
2014-02-27 13:58:26 +00:00
|
|
|
0 \
|
|
|
|
-S "skip write certificate request" \
|
|
|
|
-C "skip parse certificate request" \
|
|
|
|
-c "got a certificate request" \
|
|
|
|
-C "skip write certificate$" \
|
|
|
|
-c "skip write certificate verify" \
|
|
|
|
-c "got no certificate to send" \
|
|
|
|
-s "SSLv3 client has no certificate" \
|
|
|
|
-s "skip parse certificate verify" \
|
|
|
|
-s "! no client certificate sent" \
|
|
|
|
-S "! ssl_handshake returned" \
|
|
|
|
-C "! ssl_handshake returned" \
|
|
|
|
-S "X509 - Certificate verification failed"
|
|
|
|
|
2014-02-25 11:26:29 +00:00
|
|
|
# tests for SNI
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SNI: no SNI callback" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_SRV debug_level=3 \
|
2014-02-25 11:26:29 +00:00
|
|
|
crt_file=data_files/server5.crt key_file=data_files/server5.key" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_CLI server_name=localhost" \
|
2014-02-25 11:26:29 +00:00
|
|
|
0 \
|
|
|
|
-S "parse ServerName extension" \
|
|
|
|
-c "issuer name *: C=NL, O=PolarSSL, CN=Polarssl Test EC CA" \
|
|
|
|
-c "subject name *: C=NL, O=PolarSSL, CN=localhost"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SNI: matching cert 1" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_SRV debug_level=3 \
|
2014-02-25 11:26:29 +00:00
|
|
|
crt_file=data_files/server5.crt key_file=data_files/server5.key \
|
2014-03-26 08:31:35 +00:00
|
|
|
sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_CLI server_name=localhost" \
|
2014-02-25 11:26:29 +00:00
|
|
|
0 \
|
|
|
|
-s "parse ServerName extension" \
|
|
|
|
-c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
|
|
|
|
-c "subject name *: C=NL, O=PolarSSL, CN=localhost"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SNI: matching cert 2" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_SRV debug_level=3 \
|
2014-02-25 11:26:29 +00:00
|
|
|
crt_file=data_files/server5.crt key_file=data_files/server5.key \
|
2014-03-26 08:31:35 +00:00
|
|
|
sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_CLI server_name=polarssl.example" \
|
2014-02-25 11:26:29 +00:00
|
|
|
0 \
|
|
|
|
-s "parse ServerName extension" \
|
|
|
|
-c "issuer name *: C=NL, O=PolarSSL, CN=PolarSSL Test CA" \
|
2014-03-26 08:31:35 +00:00
|
|
|
-c "subject name *: C=NL, O=PolarSSL, CN=polarssl.example"
|
2014-02-25 11:26:29 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "SNI: no matching cert" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_SRV debug_level=3 \
|
2014-02-25 11:26:29 +00:00
|
|
|
crt_file=data_files/server5.crt key_file=data_files/server5.key \
|
2014-03-26 08:31:35 +00:00
|
|
|
sni=localhost,data_files/server2.crt,data_files/server2.key,polarssl.example,data_files/server1-nospace.crt,data_files/server1.key" \
|
2014-07-23 18:17:47 +00:00
|
|
|
"$P_CLI server_name=nonesuch.example" \
|
2014-02-25 11:26:29 +00:00
|
|
|
1 \
|
|
|
|
-s "parse ServerName extension" \
|
|
|
|
-s "ssl_sni_wrapper() returned" \
|
|
|
|
-s "ssl_handshake returned" \
|
|
|
|
-c "ssl_handshake returned" \
|
|
|
|
-c "SSL - A fatal alert message was received from our peer"
|
|
|
|
|
2014-02-26 13:45:12 +00:00
|
|
|
# Tests for non-blocking I/O: exercise a variety of handshake flows
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: basic handshake" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=0 auth_mode=none" \
|
|
|
|
"$P_CLI nbio=2 tickets=0" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: client auth" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=0 auth_mode=required" \
|
|
|
|
"$P_CLI nbio=2 tickets=0" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: ticket" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=1 auth_mode=none" \
|
|
|
|
"$P_CLI nbio=2 tickets=1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: ticket + client auth" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=1 auth_mode=required" \
|
|
|
|
"$P_CLI nbio=2 tickets=1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: ticket + client auth + resume" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=1 auth_mode=required" \
|
|
|
|
"$P_CLI nbio=2 tickets=1 reconnect=1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: ticket + resume" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=1 auth_mode=none" \
|
|
|
|
"$P_CLI nbio=2 tickets=1 reconnect=1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Non-blocking I/O: session-id resume" \
|
2014-02-26 13:45:12 +00:00
|
|
|
"$P_SRV nbio=2 tickets=0 auth_mode=none" \
|
|
|
|
"$P_CLI nbio=2 tickets=0 reconnect=1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-c "Read from server: .* bytes read"
|
|
|
|
|
2014-04-07 10:42:04 +00:00
|
|
|
# Tests for version negotiation
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: all -> 1.2" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.2" \
|
|
|
|
-c "Protocol is TLSv1.2"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: cli max 1.1 -> 1.1" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI max_version=tls1_1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.1" \
|
|
|
|
-c "Protocol is TLSv1.1"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: srv max 1.1 -> 1.1" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV max_version=tls1_1" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.1" \
|
|
|
|
-c "Protocol is TLSv1.1"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: cli+srv max 1.1 -> 1.1" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV max_version=tls1_1" \
|
|
|
|
"$P_CLI max_version=tls1_1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.1" \
|
|
|
|
-c "Protocol is TLSv1.1"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: cli max 1.1, srv min 1.1 -> 1.1" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV min_version=tls1_1" \
|
|
|
|
"$P_CLI max_version=tls1_1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.1" \
|
|
|
|
-c "Protocol is TLSv1.1"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: cli min 1.1, srv max 1.1 -> 1.1" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV max_version=tls1_1" \
|
|
|
|
"$P_CLI min_version=tls1_1" \
|
|
|
|
0 \
|
|
|
|
-S "ssl_handshake returned" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-s "Protocol is TLSv1.1" \
|
|
|
|
-c "Protocol is TLSv1.1"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: cli min 1.2, srv max 1.1 -> fail" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV max_version=tls1_1" \
|
|
|
|
"$P_CLI min_version=tls1_2" \
|
|
|
|
1 \
|
|
|
|
-s "ssl_handshake returned" \
|
|
|
|
-c "ssl_handshake returned" \
|
|
|
|
-c "SSL - Handshake protocol not within min/max boundaries"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Version check: srv min 1.2, cli max 1.1 -> fail" \
|
2014-02-26 15:33:03 +00:00
|
|
|
"$P_SRV min_version=tls1_2" \
|
|
|
|
"$P_CLI max_version=tls1_1" \
|
|
|
|
1 \
|
|
|
|
-s "ssl_handshake returned" \
|
|
|
|
-c "ssl_handshake returned" \
|
|
|
|
-s "SSL - Handshake protocol not within min/max boundaries"
|
|
|
|
|
2014-04-07 10:42:04 +00:00
|
|
|
# Tests for ALPN extension
|
|
|
|
|
2014-04-07 11:24:21 +00:00
|
|
|
if grep '^#define POLARSSL_SSL_ALPN' $CONFIG_H >/dev/null; then
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: none" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
|
|
|
"$P_CLI debug_level=3" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding alpn extension" \
|
|
|
|
-S "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-S "server hello, adding alpn extension" \
|
|
|
|
-C "found alpn extension " \
|
|
|
|
-C "Application Layer Protocol is" \
|
|
|
|
-S "Application Layer Protocol is"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: client only" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3" \
|
|
|
|
"$P_CLI debug_level=3 alpn=abc,1234" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding alpn extension" \
|
|
|
|
-s "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-S "server hello, adding alpn extension" \
|
|
|
|
-C "found alpn extension " \
|
|
|
|
-c "Application Layer Protocol is (none)" \
|
|
|
|
-S "Application Layer Protocol is"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: server only" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 alpn=abc,1234" \
|
|
|
|
"$P_CLI debug_level=3" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-C "client hello, adding alpn extension" \
|
|
|
|
-S "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-S "server hello, adding alpn extension" \
|
|
|
|
-C "found alpn extension " \
|
|
|
|
-C "Application Layer Protocol is" \
|
|
|
|
-s "Application Layer Protocol is (none)"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: both, common cli1-srv1" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 alpn=abc,1234" \
|
|
|
|
"$P_CLI debug_level=3 alpn=abc,1234" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding alpn extension" \
|
|
|
|
-s "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-s "server hello, adding alpn extension" \
|
|
|
|
-c "found alpn extension" \
|
|
|
|
-c "Application Layer Protocol is abc" \
|
|
|
|
-s "Application Layer Protocol is abc"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: both, common cli2-srv1" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 alpn=abc,1234" \
|
|
|
|
"$P_CLI debug_level=3 alpn=1234,abc" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding alpn extension" \
|
|
|
|
-s "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-s "server hello, adding alpn extension" \
|
|
|
|
-c "found alpn extension" \
|
|
|
|
-c "Application Layer Protocol is abc" \
|
|
|
|
-s "Application Layer Protocol is abc"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: both, common cli1-srv2" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 alpn=abc,1234" \
|
|
|
|
"$P_CLI debug_level=3 alpn=1234,abcde" \
|
2014-04-07 10:42:04 +00:00
|
|
|
0 \
|
|
|
|
-c "client hello, adding alpn extension" \
|
|
|
|
-s "found alpn extension" \
|
|
|
|
-C "got an alert message, type: \\[2:120]" \
|
|
|
|
-s "server hello, adding alpn extension" \
|
|
|
|
-c "found alpn extension" \
|
|
|
|
-c "Application Layer Protocol is 1234" \
|
|
|
|
-s "Application Layer Protocol is 1234"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ALPN: both, no common" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=3 alpn=abc,123" \
|
|
|
|
"$P_CLI debug_level=3 alpn=1234,abcde" \
|
2014-04-07 10:42:04 +00:00
|
|
|
1 \
|
|
|
|
-c "client hello, adding alpn extension" \
|
|
|
|
-s "found alpn extension" \
|
|
|
|
-c "got an alert message, type: \\[2:120]" \
|
|
|
|
-S "server hello, adding alpn extension" \
|
|
|
|
-C "found alpn extension" \
|
|
|
|
-C "Application Layer Protocol is 1234" \
|
|
|
|
-S "Application Layer Protocol is 1234"
|
|
|
|
|
2014-04-07 11:24:21 +00:00
|
|
|
fi
|
|
|
|
|
2014-04-09 07:50:57 +00:00
|
|
|
# Tests for keyUsage in leaf certificates, part 1:
|
|
|
|
# server-side certificate/suite selection
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: RSA, digitalSignature -> (EC)DHE-RSA" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$P_SRV key_file=data_files/server2.key \
|
|
|
|
crt_file=data_files/server2.ku-ds.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
2014-05-22 12:42:39 +00:00
|
|
|
-c "Ciphersuite is TLS-[EC]*DHE-RSA-WITH-"
|
2014-04-09 07:50:57 +00:00
|
|
|
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: RSA, keyEncipherment -> RSA" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$P_SRV key_file=data_files/server2.key \
|
|
|
|
crt_file=data_files/server2.ku-ke.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-RSA-WITH-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: RSA, keyAgreement -> fail" \
|
2014-08-30 12:20:14 +00:00
|
|
|
"$P_SRV key_file=data_files/server2.key \
|
2014-04-09 07:50:57 +00:00
|
|
|
crt_file=data_files/server2.ku-ka.crt" \
|
2014-08-30 12:20:14 +00:00
|
|
|
"$P_CLI" \
|
2014-04-09 07:50:57 +00:00
|
|
|
1 \
|
|
|
|
-C "Ciphersuite is "
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: ECDSA, digitalSignature -> ECDHE-ECDSA" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.ku-ds.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-ECDHE-ECDSA-WITH-"
|
|
|
|
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: ECDSA, keyAgreement -> ECDH-" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.ku-ka.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-ECDH-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \
|
2014-08-30 12:20:14 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
2014-04-09 07:50:57 +00:00
|
|
|
crt_file=data_files/server5.ku-ke.crt" \
|
2014-08-30 12:20:14 +00:00
|
|
|
"$P_CLI" \
|
2014-04-09 07:50:57 +00:00
|
|
|
1 \
|
|
|
|
-C "Ciphersuite is "
|
|
|
|
|
|
|
|
# Tests for keyUsage in leaf certificates, part 2:
|
2014-04-09 12:53:05 +00:00
|
|
|
# client-side checking of server cert
|
2014-04-09 07:50:57 +00:00
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ds_ke.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
0 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-C "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ds_ke.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
0 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-C "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: KeyEncipherment, RSA: OK" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ke.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
0 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-C "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ke.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
1 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-c "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-c "Processing of the Certificate handshake message failed" \
|
|
|
|
-C "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ds.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
0 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-C "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli: DigitalSignature, RSA: fail" \
|
2014-04-09 07:50:57 +00:00
|
|
|
"$O_SRV -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ds.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1 \
|
2014-04-09 07:50:57 +00:00
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
|
|
|
1 \
|
2014-04-09 12:53:05 +00:00
|
|
|
-c "bad certificate (usage extensions)" \
|
2014-04-09 07:50:57 +00:00
|
|
|
-c "Processing of the Certificate handshake message failed" \
|
|
|
|
-C "Ciphersuite is TLS-"
|
|
|
|
|
2014-04-09 12:53:05 +00:00
|
|
|
# Tests for keyUsage in leaf certificates, part 3:
|
|
|
|
# server-side checking of client cert
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli-auth: RSA, DigitalSignature: OK" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-09 12:53:05 +00:00
|
|
|
"$O_CLI -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ds.crt" \
|
|
|
|
0 \
|
|
|
|
-S "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (soft)" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-09 12:53:05 +00:00
|
|
|
"$O_CLI -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ke.crt" \
|
|
|
|
0 \
|
|
|
|
-s "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli-auth: RSA, KeyEncipherment: fail (hard)" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=required" \
|
2014-04-09 12:53:05 +00:00
|
|
|
"$O_CLI -key data_files/server2.key \
|
|
|
|
-cert data_files/server2.ku-ke.crt" \
|
|
|
|
1 \
|
|
|
|
-s "bad certificate (usage extensions)" \
|
|
|
|
-s "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli-auth: ECDSA, DigitalSignature: OK" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-09 12:53:05 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.ku-ds.crt" \
|
|
|
|
0 \
|
|
|
|
-S "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "keyUsage cli-auth: ECDSA, KeyAgreement: fail (soft)" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-09 12:53:05 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.ku-ka.crt" \
|
|
|
|
0 \
|
|
|
|
-s "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-04-11 09:06:22 +00:00
|
|
|
# Tests for extendedKeyUsage, part 1: server-side certificate/suite selection
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage srv: serverAuth -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.eku-srv.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage srv: serverAuth,clientAuth -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.eku-srv.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage srv: codeSign,anyEKU -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$P_SRV key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.eku-cs_any.crt" \
|
|
|
|
"$P_CLI" \
|
|
|
|
0
|
|
|
|
|
|
|
|
# add psk to leave an option for client to send SERVERQUIT
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage srv: codeSign -> fail" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$P_SRV psk=abc123 key_file=data_files/server5.key \
|
|
|
|
crt_file=data_files/server5.eku-cli.crt" \
|
|
|
|
"$P_CLI psk=badbad" \
|
|
|
|
1
|
|
|
|
|
|
|
|
# Tests for extendedKeyUsage, part 2: client-side checking of server cert
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli: serverAuth -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_SRV -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-srv.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1" \
|
2014-04-11 09:06:22 +00:00
|
|
|
0 \
|
|
|
|
-C "bad certificate (usage extensions)" \
|
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_SRV -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-srv_cli.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1" \
|
2014-04-11 09:06:22 +00:00
|
|
|
0 \
|
|
|
|
-C "bad certificate (usage extensions)" \
|
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_SRV -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cs_any.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1" \
|
2014-04-11 09:06:22 +00:00
|
|
|
0 \
|
|
|
|
-C "bad certificate (usage extensions)" \
|
|
|
|
-C "Processing of the Certificate handshake message failed" \
|
|
|
|
-c "Ciphersuite is TLS-"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli: codeSign -> fail" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_SRV -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cs.crt" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_CLI debug_level=1" \
|
2014-04-11 09:06:22 +00:00
|
|
|
1 \
|
|
|
|
-c "bad certificate (usage extensions)" \
|
|
|
|
-c "Processing of the Certificate handshake message failed" \
|
|
|
|
-C "Ciphersuite is TLS-"
|
|
|
|
|
|
|
|
# Tests for extendedKeyUsage, part 3: server-side checking of client cert
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli-auth: clientAuth -> OK" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cli.crt" \
|
|
|
|
0 \
|
|
|
|
-S "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli-auth: serverAuth,clientAuth -> OK" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-srv_cli.crt" \
|
|
|
|
0 \
|
|
|
|
-S "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli-auth: codeSign,anyEKU -> OK" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cs_any.crt" \
|
|
|
|
0 \
|
|
|
|
-S "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli-auth: codeSign -> fail (soft)" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=optional" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cs.crt" \
|
|
|
|
0 \
|
|
|
|
-s "bad certificate (usage extensions)" \
|
|
|
|
-S "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "extKeyUsage cli-auth: codeSign -> fail (hard)" \
|
2014-08-30 19:59:31 +00:00
|
|
|
"$P_SRV debug_level=1 auth_mode=required" \
|
2014-04-11 09:06:22 +00:00
|
|
|
"$O_CLI -key data_files/server5.key \
|
|
|
|
-cert data_files/server5.eku-cs.crt" \
|
|
|
|
1 \
|
|
|
|
-s "bad certificate (usage extensions)" \
|
|
|
|
-s "Processing of the Certificate handshake message failed"
|
|
|
|
|
2014-06-09 09:36:47 +00:00
|
|
|
# Tests for DHM parameters loading
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "DHM parameters: reference" \
|
2014-06-09 09:36:47 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
|
|
|
|
debug_level=3" \
|
|
|
|
0 \
|
|
|
|
-c "value of 'DHM: P ' (2048 bits)" \
|
|
|
|
-c "value of 'DHM: G ' (2048 bits)"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "DHM parameters: other parameters" \
|
2014-06-09 09:36:47 +00:00
|
|
|
"$P_SRV dhm_file=data_files/dhparams.pem" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA \
|
|
|
|
debug_level=3" \
|
|
|
|
0 \
|
|
|
|
-c "value of 'DHM: P ' (1024 bits)" \
|
|
|
|
-c "value of 'DHM: G ' (2 bits)"
|
|
|
|
|
2014-06-10 13:00:46 +00:00
|
|
|
# Tests for PSK callback
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: psk, no callback" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk=abc123 psk_identity=foo" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=foo psk=abc123" \
|
|
|
|
0 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
|
|
|
-S "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: no psk, no callback" \
|
2014-06-10 13:28:52 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=foo psk=abc123" \
|
|
|
|
1 \
|
|
|
|
-s "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-S "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: callback overrides other settings" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk=abc123 psk_identity=foo psk_list=abc,dead,def,beef" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=foo psk=abc123" \
|
|
|
|
1 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-s "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: first id matches" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk_list=abc,dead,def,beef" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=abc psk=dead" \
|
|
|
|
0 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-S "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: second id matches" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk_list=abc,dead,def,beef" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=def psk=beef" \
|
|
|
|
0 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-S "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: no match" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk_list=abc,dead,def,beef" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=ghi psk=beef" \
|
|
|
|
1 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-s "SSL - Unknown identity received" \
|
|
|
|
-S "SSL - Verification of the message MAC failed"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "PSK callback: wrong key" \
|
2014-06-10 13:00:46 +00:00
|
|
|
"$P_SRV psk_list=abc,dead,def,beef" \
|
|
|
|
"$P_CLI force_ciphersuite=TLS-PSK-WITH-AES-128-CBC-SHA \
|
|
|
|
psk_identity=abc psk=beef" \
|
|
|
|
1 \
|
2014-06-10 13:28:52 +00:00
|
|
|
-S "SSL - The server has no ciphersuites in common" \
|
2014-06-10 13:00:46 +00:00
|
|
|
-S "SSL - Unknown identity received" \
|
|
|
|
-s "SSL - Verification of the message MAC failed"
|
2014-06-09 09:36:47 +00:00
|
|
|
|
2014-06-11 12:06:01 +00:00
|
|
|
# Tests for ciphersuites per version
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Per-version suites: SSL3" \
|
2014-06-11 12:06:01 +00:00
|
|
|
"$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
|
|
|
|
"$P_CLI force_version=ssl3" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-RSA-WITH-3DES-EDE-CBC-SHA"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Per-version suites: TLS 1.0" \
|
2014-06-11 12:06:01 +00:00
|
|
|
"$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
|
|
|
|
"$P_CLI force_version=tls1" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-RSA-WITH-RC4-128-SHA"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Per-version suites: TLS 1.1" \
|
2014-06-11 12:06:01 +00:00
|
|
|
"$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
|
|
|
|
"$P_CLI force_version=tls1_1" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-RSA-WITH-AES-128-CBC-SHA"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "Per-version suites: TLS 1.2" \
|
2014-06-11 12:06:01 +00:00
|
|
|
"$P_SRV version_suites=TLS-RSA-WITH-3DES-EDE-CBC-SHA,TLS-RSA-WITH-RC4-128-SHA,TLS-RSA-WITH-AES-128-CBC-SHA,TLS-RSA-WITH-AES-128-GCM-SHA256" \
|
|
|
|
"$P_CLI force_version=tls1_2" \
|
|
|
|
0 \
|
|
|
|
-c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256"
|
|
|
|
|
2014-06-11 16:32:36 +00:00
|
|
|
# Tests for ssl_get_bytes_avail()
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ssl_get_bytes_avail: no extra data" \
|
2014-06-11 16:32:36 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=100" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 100 bytes read$"
|
|
|
|
|
2014-08-30 19:42:40 +00:00
|
|
|
run_test "ssl_get_bytes_avail: extra data" \
|
2014-06-11 16:32:36 +00:00
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=500" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 500 bytes read (.*+.*)"
|
2014-06-11 12:06:01 +00:00
|
|
|
|
2014-06-18 13:08:56 +00:00
|
|
|
# Tests for small packets
|
|
|
|
|
|
|
|
run_test "Small packet SSLv3 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=ssl3 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet SSLv3 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=ssl3 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.0 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.0 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.0 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.1 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.1 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.1 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.1 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 BlockCipher larger MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 AEAD" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
|
|
|
run_test "Small packet TLS 1.2 AEAD shorter tag" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=1 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 1 bytes read"
|
|
|
|
|
2014-06-18 20:05:08 +00:00
|
|
|
# Test for large packets
|
|
|
|
|
|
|
|
run_test "Large packet SSLv3 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=ssl3 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet SSLv3 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=ssl3 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.0 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.0 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.0 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.1 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.1 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.1 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.1 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_1 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 BlockCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 BlockCipher larger MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 BlockCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 StreamCipher" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 StreamCipher truncated MAC" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-RC4-128-SHA \
|
|
|
|
trunc_hmac=1" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 AEAD" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
|
|
|
run_test "Large packet TLS 1.2 AEAD shorter tag" \
|
|
|
|
"$P_SRV" \
|
|
|
|
"$P_CLI request_size=16384 force_version=tls1_2 \
|
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
|
|
|
0 \
|
|
|
|
-s "Read from client: 16384 bytes read"
|
|
|
|
|
2014-07-23 18:17:47 +00:00
|
|
|
# Tests for DTLS HelloVerifyRequest
|
|
|
|
|
|
|
|
run_test "DTLS cookie: enabled" \
|
|
|
|
"$P_SRV dtls=1 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-s "cookie verification failed" \
|
|
|
|
-s "cookie verification passed" \
|
|
|
|
-S "cookie verification skipped" \
|
|
|
|
-c "received hello verify request" \
|
|
|
|
-S "SSL - The requested feature is not available"
|
|
|
|
|
|
|
|
run_test "DTLS cookie: disabled" \
|
|
|
|
"$P_SRV dtls=1 debug_level=2 cookies=0" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-S "cookie verification failed" \
|
|
|
|
-S "cookie verification passed" \
|
|
|
|
-s "cookie verification skipped" \
|
|
|
|
-C "received hello verify request" \
|
|
|
|
-S "SSL - The requested feature is not available"
|
|
|
|
|
|
|
|
# wait for client having a timeout, or server sending an alert
|
|
|
|
#run_test "DTLS cookie: default (failing)" \
|
|
|
|
# "$P_SRV dtls=1 debug_level=2 cookies=-1" \
|
|
|
|
# "$P_CLI dtls=1 debug_level=2" \
|
|
|
|
# 0 \
|
|
|
|
# -S "cookie verification failed" \
|
|
|
|
# -S "cookie verification passed" \
|
|
|
|
# -S "cookie verification skipped" \
|
|
|
|
# -C "received hello verify request" \
|
|
|
|
# -s "SSL - The requested feature is not available"
|
|
|
|
|
|
|
|
requires_ipv6
|
|
|
|
run_test "DTLS cookie: enabled, IPv6" \
|
|
|
|
"$P_SRV dtls=1 debug_level=2 server_addr=::1" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2 server_addr=::1" \
|
|
|
|
0 \
|
|
|
|
-s "cookie verification failed" \
|
|
|
|
-s "cookie verification passed" \
|
|
|
|
-S "cookie verification skipped" \
|
|
|
|
-c "received hello verify request" \
|
|
|
|
-S "SSL - The requested feature is not available"
|
|
|
|
|
2014-09-29 15:47:33 +00:00
|
|
|
run_test "DTLS cookie: enabled, nbio" \
|
|
|
|
"$P_SRV dtls=1 nbio=2 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 nbio=2 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-s "cookie verification failed" \
|
|
|
|
-s "cookie verification passed" \
|
|
|
|
-S "cookie verification skipped" \
|
|
|
|
-c "received hello verify request" \
|
|
|
|
-S "SSL - The requested feature is not available"
|
|
|
|
|
2014-09-26 08:35:50 +00:00
|
|
|
# Tests for various cases of client authentication with DTLS
|
|
|
|
# (focused on handshake flows and message parsing)
|
|
|
|
|
|
|
|
run_test "DTLS client auth: required" \
|
|
|
|
"$P_SRV dtls=1 auth_mode=required" \
|
|
|
|
"$P_CLI dtls=1" \
|
|
|
|
0 \
|
|
|
|
-s "Verifying peer X.509 certificate... ok"
|
|
|
|
|
|
|
|
run_test "DTLS client auth: optional, client has no cert" \
|
|
|
|
"$P_SRV dtls=1 auth_mode=optional" \
|
|
|
|
"$P_CLI dtls=1 crt_file=none key_file=none" \
|
|
|
|
0 \
|
|
|
|
-s "! no client certificate sent"
|
|
|
|
|
|
|
|
run_test "DTLS client auth: optional, client has no cert" \
|
|
|
|
"$P_SRV dtls=1 auth_mode=none" \
|
|
|
|
"$P_CLI dtls=1 crt_file=none key_file=none debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "skip write certificate$" \
|
|
|
|
-s "! no client certificate sent"
|
|
|
|
|
2014-08-20 11:12:58 +00:00
|
|
|
# Tests for receiving fragmented handshake messages with DTLS
|
|
|
|
|
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: no fragmentation (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 2048 -a" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-C "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: some fragmentation (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 512" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: more fragmentation (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 128" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: more fragmentation, nbio (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 128" \
|
|
|
|
"$P_CLI dtls=1 nbio=2 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
2014-09-02 12:47:31 +00:00
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: fragmentation, renego (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 256" \
|
|
|
|
"$P_CLI debug_level=3 dtls=1 renegotiation=1 renegotiate=1" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-C "error" \
|
|
|
|
-s "Extra-header:"
|
|
|
|
|
|
|
|
requires_gnutls
|
|
|
|
run_test "DTLS reassembly: fragmentation, nbio, renego (gnutls server)" \
|
|
|
|
"$G_SRV -u --mtu 256" \
|
|
|
|
"$P_CLI debug_level=3 nbio=2 dtls=1 renegotiation=1 renegotiate=1" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-c "client hello, adding renegotiation extension" \
|
|
|
|
-c "found renegotiation extension" \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-C "ssl_handshake returned" \
|
|
|
|
-C "error" \
|
|
|
|
-s "Extra-header:"
|
|
|
|
|
2014-08-31 16:37:01 +00:00
|
|
|
run_test "DTLS reassembly: no fragmentation (openssl server)" \
|
|
|
|
"$O_SRV -dtls1 -mtu 2048" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-C "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
2014-09-23 09:00:37 +00:00
|
|
|
run_test "DTLS reassembly: some fragmentation (openssl server)" \
|
|
|
|
"$O_SRV -dtls1 -mtu 768" \
|
2014-09-02 11:39:16 +00:00
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
2014-09-23 09:00:37 +00:00
|
|
|
run_test "DTLS reassembly: more fragmentation (openssl server)" \
|
2014-09-02 11:39:16 +00:00
|
|
|
"$O_SRV -dtls1 -mtu 256" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
|
|
|
|
|
|
|
run_test "DTLS reassembly: fragmentation, nbio (openssl server)" \
|
|
|
|
"$O_SRV -dtls1 -mtu 256" \
|
|
|
|
"$P_CLI dtls=1 nbio=2 debug_level=2" \
|
|
|
|
0 \
|
|
|
|
-c "found fragmented DTLS handshake message" \
|
|
|
|
-C "error"
|
2014-08-31 16:37:01 +00:00
|
|
|
|
2014-09-26 14:31:46 +00:00
|
|
|
# Tests for specific things with "unreliable" UDP connection
|
2014-09-05 15:45:19 +00:00
|
|
|
|
2014-09-24 13:17:31 +00:00
|
|
|
not_with_valgrind # spurious resend due to timeout
|
2014-09-06 10:27:02 +00:00
|
|
|
run_test "DTLS proxy: reference" \
|
2014-09-05 15:45:19 +00:00
|
|
|
-p "$P_PXY" \
|
2014-09-24 13:17:31 +00:00
|
|
|
"$P_SRV dtls=1 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
2014-09-06 10:27:02 +00:00
|
|
|
0 \
|
2014-09-24 11:56:09 +00:00
|
|
|
-C "replayed record" \
|
|
|
|
-S "replayed record" \
|
|
|
|
-C "record from another epoch" \
|
|
|
|
-S "record from another epoch" \
|
|
|
|
-C "discarding invalid record" \
|
|
|
|
-S "discarding invalid record" \
|
2014-09-24 13:17:31 +00:00
|
|
|
-S "resend" \
|
2014-09-08 14:39:08 +00:00
|
|
|
-s "Extra-header:" \
|
2014-09-06 10:27:02 +00:00
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-24 13:17:31 +00:00
|
|
|
not_with_valgrind # spurious resend due to timeout
|
2014-09-24 11:29:58 +00:00
|
|
|
run_test "DTLS proxy: duplicate every packet" \
|
2014-09-06 10:27:02 +00:00
|
|
|
-p "$P_PXY duplicate=1" \
|
2014-09-24 13:17:31 +00:00
|
|
|
"$P_SRV dtls=1 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
2014-09-06 10:27:02 +00:00
|
|
|
0 \
|
2014-09-24 11:29:58 +00:00
|
|
|
-c "replayed record" \
|
|
|
|
-s "replayed record" \
|
2014-09-24 11:56:09 +00:00
|
|
|
-c "discarding invalid record" \
|
|
|
|
-s "discarding invalid record" \
|
2014-09-24 13:17:31 +00:00
|
|
|
-S "resend" \
|
2014-09-08 14:39:08 +00:00
|
|
|
-s "Extra-header:" \
|
2014-09-24 12:41:11 +00:00
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
|
|
|
run_test "DTLS proxy: duplicate every packet, server anti-replay off" \
|
|
|
|
-p "$P_PXY duplicate=1" \
|
2014-09-24 13:17:31 +00:00
|
|
|
"$P_SRV dtls=1 debug_level=2 anti_replay=0" \
|
|
|
|
"$P_CLI dtls=1 debug_level=2" \
|
2014-09-24 12:41:11 +00:00
|
|
|
0 \
|
|
|
|
-c "replayed record" \
|
|
|
|
-S "replayed record" \
|
|
|
|
-c "discarding invalid record" \
|
|
|
|
-s "discarding invalid record" \
|
2014-09-24 13:17:31 +00:00
|
|
|
-c "resend" \
|
|
|
|
-s "resend" \
|
2014-09-24 12:41:11 +00:00
|
|
|
-s "Extra-header:" \
|
2014-09-08 14:39:08 +00:00
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
|
|
|
run_test "DTLS proxy: inject invalid AD record" \
|
|
|
|
-p "$P_PXY bad_ad=1" \
|
2014-09-24 11:56:09 +00:00
|
|
|
"$P_SRV dtls=1 debug_level=1" \
|
|
|
|
"$P_CLI dtls=1 debug_level=1" \
|
2014-09-23 09:00:37 +00:00
|
|
|
0 \
|
|
|
|
-c "discarding invalid record" \
|
2014-09-24 11:56:09 +00:00
|
|
|
-s "discarding invalid record" \
|
2014-09-23 09:00:37 +00:00
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
|
|
|
run_test "DTLS proxy: delay ChangeCipherSpec" \
|
2014-09-24 11:56:09 +00:00
|
|
|
-p "$P_PXY delay_ccs=1" \
|
|
|
|
"$P_SRV dtls=1 debug_level=1" \
|
|
|
|
"$P_CLI dtls=1 debug_level=1" \
|
2014-09-23 09:00:37 +00:00
|
|
|
0 \
|
2014-09-24 11:56:09 +00:00
|
|
|
-c "record from another epoch" \
|
|
|
|
-s "record from another epoch" \
|
2014-09-23 09:00:37 +00:00
|
|
|
-c "discarding invalid record" \
|
2014-09-24 11:56:09 +00:00
|
|
|
-s "discarding invalid record" \
|
2014-09-23 09:00:37 +00:00
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-26 14:31:46 +00:00
|
|
|
# Tests for "randomly unreliable connection": try a variety of flows and peers
|
2014-09-24 17:09:17 +00:00
|
|
|
|
2014-09-24 11:29:58 +00:00
|
|
|
needs_more_time 2
|
2014-09-24 17:09:17 +00:00
|
|
|
run_test "DTLS proxy: 3d (drop, delay, duplicate), \"short\" PSK handshake" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
|
|
|
|
psk=abc123" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
|
2014-09-24 17:09:17 +00:00
|
|
|
force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
|
2014-09-08 14:39:08 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
2014-09-06 10:27:02 +00:00
|
|
|
-c "HTTP/1.0 200 OK"
|
2014-09-05 15:45:19 +00:00
|
|
|
|
2014-09-24 17:09:17 +00:00
|
|
|
needs_more_time 2
|
|
|
|
run_test "DTLS proxy: 3d, \"short\" RSA handshake" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 \
|
2014-09-24 17:09:17 +00:00
|
|
|
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
2014-09-20 10:46:27 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
|
|
|
needs_more_time 2
|
2014-09-24 17:09:17 +00:00
|
|
|
run_test "DTLS proxy: 3d, \"short\" (no ticket, no cli_auth) FS handshake" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \
|
2014-09-20 10:46:27 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-24 17:09:17 +00:00
|
|
|
needs_more_time 2
|
|
|
|
run_test "DTLS proxy: 3d, FS, client auth" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=required" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0" \
|
2014-09-20 10:46:27 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-23 09:00:37 +00:00
|
|
|
needs_more_time 2
|
2014-09-24 17:09:17 +00:00
|
|
|
run_test "DTLS proxy: 3d, FS, ticket" \
|
2014-09-23 09:00:37 +00:00
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=none" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \
|
2014-09-24 17:09:17 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
|
|
|
needs_more_time 2
|
|
|
|
run_test "DTLS proxy: 3d, max handshake (FS, ticket + client auth)" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=1 auth_mode=required" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=1" \
|
2014-09-23 09:00:37 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-29 15:52:57 +00:00
|
|
|
needs_more_time 2
|
|
|
|
run_test "DTLS proxy: 3d, max handshake, nbio" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 nbio=2 tickets=1 \
|
|
|
|
auth_mode=required" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 nbio=2 tickets=1" \
|
2014-09-29 15:52:57 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-10-02 12:50:46 +00:00
|
|
|
needs_more_time 4
|
|
|
|
run_test "DTLS proxy: 3d, min handshake, resumption" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
|
|
|
|
psk=abc123 debug_level=3" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
|
|
|
|
debug_level=3 reconnect=1 read_timeout=1000 max_resend=10 \
|
|
|
|
force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
|
|
|
|
0 \
|
|
|
|
-s "a session has been resumed" \
|
|
|
|
-c "a session has been resumed" \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-25 14:09:36 +00:00
|
|
|
needs_more_time 4
|
2014-09-29 15:52:57 +00:00
|
|
|
run_test "DTLS proxy: 3d, min handshake, client-initiated renego" \
|
2014-09-25 14:09:36 +00:00
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
|
|
|
|
psk=abc123 renegotiation=1 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
|
|
|
|
renegotiate=1 debug_level=2 \
|
2014-09-25 14:09:36 +00:00
|
|
|
force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
|
|
|
|
0 \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-09-29 15:52:57 +00:00
|
|
|
needs_more_time 4
|
|
|
|
run_test "DTLS proxy: 3d, min handshake, client-initiated renego, nbio" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_SRV dtls=1 hs_timeout=250-10000 tickets=0 auth_mode=none \
|
|
|
|
psk=abc123 renegotiation=1 debug_level=2" \
|
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 tickets=0 psk=abc123 \
|
|
|
|
renegotiate=1 debug_level=2 \
|
2014-09-29 15:52:57 +00:00
|
|
|
force_ciphersuite=TLS-PSK-WITH-AES-128-CCM-8" \
|
|
|
|
0 \
|
|
|
|
-c "=> renegotiate" \
|
|
|
|
-s "=> renegotiate" \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 3
|
2014-09-26 14:27:59 +00:00
|
|
|
run_test "DTLS proxy: 3d, openssl server" \
|
2014-09-25 15:00:27 +00:00
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
|
|
|
|
"$O_SRV -dtls1 -mtu 2048" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000" \
|
2014-09-25 15:00:27 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 4
|
2014-09-26 14:27:59 +00:00
|
|
|
run_test "DTLS proxy: 3d, openssl server, fragmentation" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
|
|
|
|
"$O_SRV -dtls1 -mtu 768" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000" \
|
2014-09-26 14:27:59 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 4
|
2014-09-29 15:52:57 +00:00
|
|
|
run_test "DTLS proxy: 3d, openssl server, fragmentation, nbio" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5 protect_hvr=1" \
|
|
|
|
"$O_SRV -dtls1 -mtu 768" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 nbio=2" \
|
2014-09-29 15:52:57 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "HTTP/1.0 200 OK"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 3
|
2014-09-26 14:27:59 +00:00
|
|
|
run_test "DTLS proxy: 3d, gnutls server" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
|
|
|
"$G_SRV -u --mtu 2048 -a" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000" \
|
2014-09-26 14:27:59 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "Extra-header:"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 4
|
2014-09-26 14:27:59 +00:00
|
|
|
run_test "DTLS proxy: 3d, gnutls server, fragmentation" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
|
|
|
"$G_SRV -u --mtu 512" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000" \
|
2014-09-26 14:27:59 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "Extra-header:"
|
|
|
|
|
2014-10-02 15:07:09 +00:00
|
|
|
needs_more_time 4
|
2014-09-29 15:52:57 +00:00
|
|
|
run_test "DTLS proxy: 3d, gnutls server, fragmentation, nbio" \
|
|
|
|
-p "$P_PXY drop=5 delay=5 duplicate=5" \
|
|
|
|
"$G_SRV -u --mtu 512" \
|
2014-10-01 14:38:03 +00:00
|
|
|
"$P_CLI dtls=1 hs_timeout=250-10000 nbio=2" \
|
2014-09-29 15:52:57 +00:00
|
|
|
0 \
|
|
|
|
-s "Extra-header:" \
|
|
|
|
-c "Extra-header:"
|
|
|
|
|
2014-02-21 11:12:23 +00:00
|
|
|
# Final report
|
|
|
|
|
2014-02-21 08:47:37 +00:00
|
|
|
echo "------------------------------------------------------------------------"
|
|
|
|
|
|
|
|
if [ $FAILS = 0 ]; then
|
|
|
|
echo -n "PASSED"
|
|
|
|
else
|
|
|
|
echo -n "FAILED"
|
|
|
|
fi
|
2014-08-31 08:22:11 +00:00
|
|
|
PASSES=$(( $TESTS - $FAILS ))
|
2014-08-14 12:31:29 +00:00
|
|
|
echo " ($PASSES / $TESTS tests ($SKIPS skipped))"
|
2014-02-21 08:47:37 +00:00
|
|
|
|
|
|
|
exit $FAILS
|