diff --git a/testssl.sh b/testssl.sh index 40c3bd3..84dade6 100755 --- a/testssl.sh +++ b/testssl.sh @@ -3968,13 +3968,12 @@ run_prototest_openssl() { # idempotent function to add SSL/TLS protocols. It should ease testing # PROTOS_OFFERED's content is in openssl terminology add_tls_offered() { - grep -qw "$1" <<< "$PROTOS_OFFERED" || PROTOS_OFFERED+="$1 " + [[ "$PROTOS_OFFERED" =~ "$1 " ]] || PROTOS_OFFERED+="$1 " } # function which checks whether SSLv2 - TLS 1.2 is being offereed has_server_protocol() { - [[ -z "$PROTOS_OFFERED" ]] && return 1 # if empty return 1, hinting to the caller to check at additional cost/connect - if grep -qw "$1" <<< "$PROTOS_OFFERED"; then + if [[ "$PROTOS_OFFERED" =~ "$1 " ]]; then return 0 fi return 1 @@ -4848,6 +4847,7 @@ run_server_preference() { cipher[i]="" fi fi + [[ -n "${cipher[i]}" ]] && add_tls_offered "$proto" i=$((i + 1)) done @@ -4964,7 +4964,7 @@ cipher_pref_check() { pr_bold " Cipher order" - tm_out " ssl3 00 SSLv3\n tls1 01 TLSv1\n tls1_1 02 TLSv1.1\n tls1_2 03 TLSv1.2\n" | while read p proto_hex proto; do + while read p proto_hex proto; do order=""; ciphers_found_with_sockets=false if [[ $p == ssl3 ]] && ! "$HAS_SSL3" && ! "$using_sockets"; then out "\n SSLv3: "; pr_local_problem "$OPENSSL doesn't support \"s_client -ssl3\""; @@ -5135,12 +5135,13 @@ cipher_pref_check() { fi if [[ -n "$order" ]]; then + add_tls_offered "$p" outln out "$(printf " %-10s " "$proto: ")" out "$(out_row_aligned_max_width "$order" " " $TERM_WIDTH)" fileout "order_$p" "INFO" "Default cipher order for protocol $p: $order" fi - done + done <<< "$(tm_out " ssl3 00 SSLv3\n tls1 01 TLSv1\n tls1_1 02 TLSv1.1\n tls1_2 03 TLSv1.2\n")" outln outln @@ -10775,9 +10776,17 @@ run_beast(){ # first determine whether it's mitigated by higher protocols for proto in tls1_1 tls1_2; do - $OPENSSL s_client -state -"$proto" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI 2>>$ERRFILE >$TMPFILE >$ERRFILE >$TMPFILE $TMPFILE 2>>$ERRFILE