diff --git a/make/DEBIAN/control b/make/DEBIAN/control index 49a778c92..fe1d3feef 100644 --- a/make/DEBIAN/control +++ b/make/DEBIAN/control @@ -1,5 +1,9 @@ Package: Testrun +<<<<<<< revert +Version: 2.3.4-beta.2 +======= Version: 2.4.0-beta.1 +>>>>>>> dev Architecture: amd64 Maintainer: Google Homepage: https://github.com/google/testrun diff --git a/modules/test/tls/python/src/tls_util.py b/modules/test/tls/python/src/tls_util.py index 7859b6629..8047c5020 100644 --- a/modules/test/tls/python/src/tls_util.py +++ b/modules/test/tls/python/src/tls_util.py @@ -148,27 +148,22 @@ def get_public_certificate(self, cert_pem = ssl.DER_cert_to_PEM_cert(secure_sock.getpeercert(True)) except ConnectionRefusedError: - error_msg = f'Connection to {host}:{port} was refused.' - LOGGER.info(error_msg) - return None, error_msg + LOGGER.info(f'Connection to {host}:{port} was refused.') + return None except socket.gaierror: - error_msg = f'Failed to resolve the hostname {host}.' - LOGGER.info(error_msg) - return None, error_msg + LOGGER.info(f'Failed to resolve the hostname {host}.') + return None except ssl.SSLError as e: - error_msg = f'SSL error occurred: {e}' - LOGGER.info(error_msg) - return None, error_msg + LOGGER.info(f'SSL error occurred: {e}') + return None except socket.timeout: - error_msg = 'Socket timeout error' - LOGGER.info(error_msg) - return None, error_msg + LOGGER.info('Socket timeout error') + return None except OSError as e: - error_msg = e - LOGGER.info(error_msg) - return None, error_msg + LOGGER.error(e) + return None - return cert_pem, None + return cert_pem def get_public_key(self, public_cert): # Extract and return the public key from the certificate @@ -341,7 +336,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') @@ -510,7 +505,7 @@ def validate_tls_server(self, tls_version: str, port: int=443 ) -> tuple[bool| None, list| str]: - cert_pem, error_reason = self.get_public_certificate(host=host, + cert_pem = self.get_public_certificate(host=host, port=port, validate_cert=False, tls_version=tls_version) @@ -545,10 +540,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' - LOGGER.info(final_msg) - return None, [final_msg] + LOGGER.info('Failed to resolve public certificate') + return None, ['Failed to resolve public certificate'] def write_cert_to_file(self, cert_name, cert): try: