diff --git a/tests/Test.py b/tests/Test.py index 811938271..8e4d7e415 100644 --- a/tests/Test.py +++ b/tests/Test.py @@ -142,15 +142,20 @@ class Test(ABC): r = get(ex_url, timeout=10, verify=False) ok = test["status"] == r.status_code if ok and "tls" in test: + ex_tls = test["tls"] + for ex_domain, test_domain in self._domains.items(): + if search(ex_domain, ex_tls): + ex_tls = sub(ex_domain, test_domain, ex_tls) connection = create_connection((urlparse(ex_url).netloc, 443)) context = SSLContext() sock = context.wrap_socket(connection, server_hostname=urlparse(ex_url).netloc) cert = sock.getpeercert(True) sock.close() x509 = crypto.load_certificate(crypto.FILETYPE_ASN1, cert) - if x509.get_subject().CN != test["tls"]: + if x509.get_subject().CN != ex_tls: ok = False log("TEST", "⚠️", f"wrong cert CN : {x509.get_subject().CN}") + return ok except: return False raise (Exception(f"unknown test type {test['type']}"))