From 19d59c6844595485c1ec586588fad541635c56b1 Mon Sep 17 00:00:00 2001 From: kurilova Date: Tue, 5 May 2026 08:50:57 +0000 Subject: [PATCH 1/3] Improve error message --- modules/test/tls/python/src/tls_util.py | 36 ++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/modules/test/tls/python/src/tls_util.py b/modules/test/tls/python/src/tls_util.py index 8047c5020..ab2a9da78 100644 --- a/modules/test/tls/python/src/tls_util.py +++ b/modules/test/tls/python/src/tls_util.py @@ -148,22 +148,27 @@ def get_public_certificate(self, cert_pem = ssl.DER_cert_to_PEM_cert(secure_sock.getpeercert(True)) except ConnectionRefusedError: - LOGGER.info(f'Connection to {host}:{port} was refused.') - return None + error_msg = f'Connection to {host}:{port} was refused.' + LOGGER.info(error_msg) + return None, error_msg except socket.gaierror: - LOGGER.info(f'Failed to resolve the hostname {host}.') - return None + error_msg = f'Failed to resolve the hostname {host}.' + LOGGER.info(error_msg) + return None, error_msg except ssl.SSLError as e: - LOGGER.info(f'SSL error occurred: {e}') - return None + error_msg = f'SSL error occurred: {e}' + LOGGER.info(error_msg) + return None, error_msg except socket.timeout: - LOGGER.info('Socket timeout error') - return None + error_msg = 'Socket timeout error' + LOGGER.info(error_msg) + return None, error_msg except OSError as e: - LOGGER.error(e) - return None + error_msg = e + LOGGER.info(error_msg) + return None, error_msg - return cert_pem + return cert_pem, None def get_public_key(self, public_cert): # Extract and return the public key from the certificate @@ -336,7 +341,7 @@ def validate_trusted_ca_signature(self, host, port): # within the valid CA root certs stored on the server LOGGER.info( 'Checking for valid signature from authorized Certificate Authorities') - public_cert = self.get_public_certificate(host=host, + public_cert, _ = self.get_public_certificate(host=host, port=port, validate_cert=True, tls_version='1.2') @@ -505,7 +510,7 @@ def validate_tls_server(self, tls_version: str, port: int=443 ) -> tuple[bool| None, list| str]: - cert_pem = self.get_public_certificate(host=host, + cert_pem, error_reason = self.get_public_certificate(host=host, port=port, validate_cert=False, tls_version=tls_version) @@ -540,8 +545,9 @@ def validate_tls_server(self, LOGGER.info('Certificate validated: ' + str(cert_valid)) return cert_valid, details else: - LOGGER.info('Failed to resolve public certificate') - return None, ['Failed to resolve public certificate'] + final_msg = error_reason or f"No TLS {tls_version} server functionality found" + LOGGER.info(final_msg) + return None, [final_msg] def write_cert_to_file(self, cert_name, cert): try: From bb90fe4d04442b89d63ba4e4801496bf1afc6599 Mon Sep 17 00:00:00 2001 From: kurilova Date: Tue, 5 May 2026 09:05:50 +0000 Subject: [PATCH 2/3] Fix lint --- modules/test/tls/python/src/tls_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/test/tls/python/src/tls_util.py b/modules/test/tls/python/src/tls_util.py index ab2a9da78..7859b6629 100644 --- a/modules/test/tls/python/src/tls_util.py +++ b/modules/test/tls/python/src/tls_util.py @@ -545,7 +545,8 @@ def validate_tls_server(self, LOGGER.info('Certificate validated: ' + str(cert_valid)) return cert_valid, details else: - final_msg = error_reason or f"No TLS {tls_version} server functionality found" + final_msg = error_reason \ + or f'No TLS {tls_version} server functionality found' LOGGER.info(final_msg) return None, [final_msg] From 69e9c83c8639303c599e8127f63c00055ac0d0eb Mon Sep 17 00:00:00 2001 From: kurilova Date: Tue, 5 May 2026 09:37:01 +0000 Subject: [PATCH 3/3] Update version --- make/DEBIAN/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/DEBIAN/control b/make/DEBIAN/control index c9b25857f..87735691f 100644 --- a/make/DEBIAN/control +++ b/make/DEBIAN/control @@ -1,5 +1,5 @@ Package: Testrun -Version: 2.3.4-beta.1 +Version: 2.3.4-beta.3 Architecture: amd64 Maintainer: Google Homepage: https://github.com/google/testrun