From 83b212f581bba5ab9b69355c2d6a8074224c5e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Ribeiro?= Date: Thu, 10 Oct 2019 04:10:57 +0100 Subject: [PATCH] Add argument --connect-timeout. Defaults to 3 min This default value should not affect users not currently using the timeout (Linux's default seems to be currently around 2 min). --- testssl.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 3118dfb..94b6003 100755 --- a/testssl.sh +++ b/testssl.sh @@ -393,6 +393,7 @@ SERVER_COUNTER=0 # Counter for multiple servers TLS_LOW_BYTE="" # For "secret" development stuff, see -q below HEX_CIPHER="" # " +CONNECT_TIMEOUT=180 ########### Global variables for parallel mass testing @@ -10172,7 +10173,7 @@ fd_socket() { break fi done - elif ! timeout 2 bash -c "exec 3<>/dev/tcp/$nodeip/$PORT" || \ + elif ! timeout $CONNECT_TIMEOUT bash -c "exec 3<>/dev/tcp/$nodeip/$PORT" || \ ! exec 5<>/dev/tcp/$nodeip/$PORT; then # 2>/dev/null would remove an error message, but disables debugging ((NR_SOCKET_FAIL++)) connectivity_problem $NR_SOCKET_FAIL $MAX_SOCKET_FAIL "TCP connect problem" "repeated TCP connect problems, giving up" @@ -19461,6 +19462,10 @@ parse_cmd_line() { OPENSSL_TIMEOUT="$(parse_opt_equal_sign "$1" "$2")" [[ $? -eq 0 ]] && shift ;; + --connect-timeout|--connect-timeout=*) + CONNECT_TIMEOUT="$(parse_opt_equal_sign "$1" "$2")" + [[ $? -eq 0 ]] && shift + ;; --mapping|--mapping=*) cipher_mapping="$(parse_opt_equal_sign "$1" "$2")" [[ $? -eq 0 ]] && shift