Skip to content

Commit 37c6d78

Browse files
committed
Fix Darwin / LibreSSL startup problem (3.0)
This PR addresses a bug where a user encountered the question "The results might look ok but they could be nonsense. Really proceed". That happened under Darwin and probably some LibreSSL versions when checking some hosts. sclient_auth() returned 1 indicating no SSL/TLS handshake could be established. This PR modifies sclient_auth() so that in those cases 0 is returned by skipping the check for the session ID. As NO_SSL_SESSIONID needs to be set when there's no session ID. This is done separately. This fixes #2052 for 3.0
1 parent 1809595 commit 37c6d78

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

testssl.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18317,26 +18317,30 @@ check_proxy() {
1831718317
}
1831818318

1831918319

18320-
# this is only being called from determine_optimal_proto in order to check whether we have a server
18321-
# with client authentication, a server with no SSL session ID switched off
18320+
# This is only being called from determine_optimal_proto() in order to check whether we have a server with
18321+
# client authentication, a server with no SSL session ID switched off -- and as the name indicates a protocol.
18322+
# ARG1 is the return value of openssl s_client connect. (Darwin or LibreSSL may return 1 here)
18323+
# ARG2 is the file name containing the server hello
1832218324
#
1832318325
sclient_auth() {
18324-
[[ $1 -eq 0 ]] && return 0 # no client auth (CLIENT_AUTH=false is preset globally)
18325-
if [[ -n $(awk '/Master-Key: / { print $2 }' "$2") ]]; then # connect succeeded
18326-
if grep -q '^<<< .*CertificateRequest' "$2"; then # CertificateRequest message in -msg
18327-
CLIENT_AUTH=true
18328-
return 0
18329-
fi
18330-
if [[ -z $(awk '/Session-ID: / { print $2 }' "$2") ]]; then # probably no SSL session
18331-
if [[ 2 -eq $(grep -c CERTIFICATE "$2") ]]; then # do another sanity check to be sure
18326+
local -i ret=1
18327+
18328+
if [[ $1 -eq 0 ]] ; then
18329+
ret=0 # no client auth (CLIENT_AUTH=false is preset globally)
18330+
else
18331+
if [[ -n $(awk '/Master-Key: / { print $2 }' "$2") ]]; then # connect succeeded
18332+
if grep -q '^<<< .*CertificateRequest' "$2"; then # CertificateRequest message in -msg
18333+
CLIENT_AUTH=true
18334+
ret=0
18335+
elif [[ 2 -eq $(grep -c CERTIFICATE "$2") ]]; then # do another sanity check to be sure
1833218336
CLIENT_AUTH=false
18333-
NO_SSL_SESSIONID=true # NO_SSL_SESSIONID is preset globally to false for all other cases
18334-
return 0
18337+
ret=0
1833518338
fi
1833618339
fi
1833718340
fi
18338-
# what's left now is: master key empty, handshake returned not successful, session ID empty --> not successful
18339-
return 1
18341+
[[ $ret -eq 0 ]] && \
18342+
[[ -z $(awk '/Session-ID: / { print $2 }' "$2") ]] && NO_SSL_SESSIONID=true # NO_SSL_SESSIONID is preset globally first
18343+
return $ret
1834018344
}
1834118345

1834218346
# Determine the best parameters to use with tls_sockets():

0 commit comments

Comments
 (0)