示例#1
0
    def create(
        server_location: Optional[ServerNetworkLocation] = None,
        tls_probing_result: Optional[ServerTlsProbingResult] = None,
    ) -> ServerConnectivityInfo:
        if server_location:
            final_server_location = server_location
        else:
            final_server_location = ServerNetworkLocationViaDirectConnectionFactory.create(
            )

        if tls_probing_result:
            final_tls_probing_result = tls_probing_result
        else:
            final_tls_probing_result = ServerTlsProbingResult(
                highest_tls_version_supported=TlsVersionEnum.TLS_1_2,
                cipher_suite_supported="AES",
                client_auth_requirement=ClientAuthRequirementEnum.DISABLED,
            )

        return ServerConnectivityInfo(
            server_location=final_server_location,
            network_configuration=ServerNetworkConfiguration(
                tls_server_name_indication=final_server_location.hostname),
            tls_probing_result=final_tls_probing_result,
        )
示例#2
0
 def create(
     client_auth_requirement:
     ClientAuthRequirementEnum = ClientAuthRequirementEnum.DISABLED,
 ) -> ServerTlsProbingResult:
     return ServerTlsProbingResult(
         highest_tls_version_supported=TlsVersionEnum.TLS_1_2,
         cipher_suite_supported="AES",
         client_auth_requirement=client_auth_requirement,
         supports_ecdh_key_exchange=True,
     )
示例#3
0
    def test_server_connectivity_test_succeeded_with_required_client_auth(
            self):
        # Given a server to scan to which sslyze was able to connect
        server_info = ServerConnectivityInfoFactory.create(
            tls_probing_result=ServerTlsProbingResult(
                highest_tls_version_supported=TlsVersionEnum.TLS_1_2,
                cipher_suite_supported="AES",
                # And the server requires client authentication
                client_auth_requirement=ClientAuthRequirementEnum.REQUIRED,
            ))

        # When generating the console output for this
        with StringIO() as file_out:
            console_gen = ConsoleOutputGenerator(file_to=file_out)
            console_gen.server_connectivity_test_succeeded(server_info)
            final_output = file_out.getvalue()

        # It succeeds and the fact that the server requires client auth was displayed
        assert final_output
        assert "Server REQUIRED client authentication" in final_output