Skip to content

Commit ed147f7

Browse files
committed
Ref #1130 - Partial revert of c5ba541 / #904 to allow cert detection in bad ssl
While using a standard HTTP client is good, it does mean we can't connect to some very obscure setups with it anymore. In the case of cert detection, the HTTP client was exclusively used for guessing if there even is any SSL, while the rest of the code can still handle very bad configs. As we needed our legacy clients in a few places anyways until finishing #714, this commit reverts the cert check back to the legacy client, allowing cert checks in these very bad configs.
1 parent 9998bfd commit ed147f7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

checks/tasks/tls.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,10 +1642,14 @@ def cert_checks(url, mode, task, af_ip_pair=None, starttls_details=None, *args,
16421642
if mode == ChecksMode.WEB:
16431643
# First try to connect to HTTPS. We don't care for
16441644
# certificates in port 443 if there is no HTTPS there.
1645-
http_get_ip(
1646-
hostname=url,
1647-
ip=af_ip_pair[1],
1645+
http_fetch(
1646+
url,
1647+
af=af_ip_pair[0],
1648+
path="",
16481649
port=443,
1650+
ip_address=af_ip_pair[1],
1651+
depth=MAX_REDIRECT_DEPTH,
1652+
task=web_cert,
16491653
)
16501654
debug_cert_chain = DebugCertChain
16511655
conn_wrapper = HTTPSConnection
@@ -1681,7 +1685,7 @@ def cert_checks(url, mode, task, af_ip_pair=None, starttls_details=None, *args,
16811685
verify_score, verify_result = starttls_details.trusted_score
16821686
debug_chain = starttls_details.debug_chain
16831687
conn_port = starttls_details.conn_port
1684-
except (OSError, requests.RequestException, NoIpError, ConnectionHandshakeException, ConnectionSocketException):
1688+
except (OSError, http.client.BadStatusLine, NoIpError, ConnectionHandshakeException, ConnectionSocketException):
16851689
return dict(tls_cert=False)
16861690

16871691
if debug_chain is None:

0 commit comments

Comments
 (0)