From 8103bcd7b0f29a3badedc47553800ae02318cf2c Mon Sep 17 00:00:00 2001 From: Alban Diquet Date: Fri, 1 May 2020 20:30:06 -0700 Subject: [PATCH] [#434] Make error handling language agnostic for reneg --- sslyze/plugins/session_renegotiation_plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sslyze/plugins/session_renegotiation_plugin.py b/sslyze/plugins/session_renegotiation_plugin.py index 2775f1f6..94fd2347 100755 --- a/sslyze/plugins/session_renegotiation_plugin.py +++ b/sslyze/plugins/session_renegotiation_plugin.py @@ -152,12 +152,12 @@ def _test_client_renegotiation( except socket.timeout: # This is how Netty rejects a renegotiation - https://github.com/nabla-c0d3/sslyze/issues/114 accepts_client_renegotiation = False - except socket.error as e: - if "connection was forcibly closed" in str(e.args): - accepts_client_renegotiation = False - elif "reset by peer" in str(e.args): - accepts_client_renegotiation = False - elif "Nassl SSL handshake failed" in str(e.args): + except ConnectionError: + accepts_client_renegotiation = False + except OSError as e: + # OSError is the parent of all (non-TLS) socket/connection errors so it should be last + if "Nassl SSL handshake failed" in e.args[0]: + # Special error returned by nassl accepts_client_renegotiation = False else: raise