Step 1: Testing Connectivity to a Server

Basic Example

Before a server can be scanned, SSLyze must validate that it is able to connect to the server. This is done using the ServerConnectivityTester class:

def basic_example_connectivity_testing() -> None:
    # Define the server that you want to scan
    server_location = ServerNetworkLocationViaDirectConnection.with_ip_address_lookup("www.google.com", 443)

    # Do connectivity testing to ensure SSLyze is able to connect
    try:
        server_info = ServerConnectivityTester().perform(server_location)
    except ConnectionToServerFailed as e:
        # Could not connect to the server; abort
        print(f"Error connecting to {server_location}: {e.error_message}")
        return
    print(f"Connectivity testing completed: {server_info}")

If the call to perform() is successful, it returns a ServerConnectivityInfo object that can then be used for scanning the server.

This is described in Step 2: Running Scan Commands Against a Server.

Advanced Usage

When calling ServerConnectivityTester.perform(), a ServerNetworkConfiguration can be optionally provided as the second argument, in order to have more control on how SSLyze should connect to the server. This configuration object allows for example to configure StarTLS or a client certificate SSL/TLS client authentication.