diff --git a/tests/integration/test_authd/test_authd_agents_ctx.py b/tests/integration/test_authd/test_authd_agents_ctx.py index ba2096bd49..10da0fe738 100644 --- a/tests/integration/test_authd/test_authd_agents_ctx.py +++ b/tests/integration/test_authd/test_authd_agents_ctx.py @@ -289,7 +289,7 @@ def register_agent_main_server(Name, Group=None, IP=None): def register_agent_local_server(Name, Group=None, IP=None): message = ('{"arguments":{"force":{"enabled":true,"disconnected_time":{"enabled":true,"value":"0"},' - '"key_mismatch":true,"after_registration_time":"0"}') + '"key_mismatch":true,"after_registration_time":"0"}') message += ',"name":"{}"'.format(Name) if Group: message += ',"groups":"{}"'.format(Group) diff --git a/tests/integration/test_authd/test_authd_ssl_certs.py b/tests/integration/test_authd/test_authd_ssl_certs.py index 229fa9ee87..3c4029249a 100644 --- a/tests/integration/test_authd/test_authd_ssl_certs.py +++ b/tests/integration/test_authd/test_authd_ssl_certs.py @@ -165,7 +165,7 @@ def callback_agentd_startup(line): time.sleep(1) -def test_authd_ssl_certs(get_configuration, generate_ca_certificate): +def test_authd_ssl_certs(get_configuration, generate_ca_certificate, tear_down): ''' description: Check if the 'wazuh-authd' daemon can manage 'SSL' connections with agents and the 'host verification' feature is working properly. For this purpose, diff --git a/tests/integration/test_authd/test_remote_enrollment.py b/tests/integration/test_authd/test_remote_enrollment.py index c9683a3c67..725a5f96d3 100644 --- a/tests/integration/test_authd/test_remote_enrollment.py +++ b/tests/integration/test_authd/test_remote_enrollment.py @@ -103,6 +103,10 @@ cluster_socket_address = ('localhost', 1516) remote_enrollment_address = ('localhost', 1515) +AGENT_ID = 0 +AGENT_NAME = 'test_agent' +INPUT_MESSAGE = "OSSEC A:'{}_{}'" + @pytest.fixture(scope="module", params=configurations, ids=[f"{x['id']}" for x in metadata]) def get_configuration(request): @@ -118,7 +122,7 @@ def not_raises(exception): raise pytest.fail("DID RAISE {0}".format(exception)) -def test_remote_enrollment(get_configuration, configure_environment, restart_authd): +def test_remote_enrollment(get_configuration, configure_environment, restart_authd, tear_down): ''' description: Check if the 'wazuh-authd' daemon remote enrollment is enabled/disabled according to the configuration. By default, remote enrollment is enabled. When disabled, @@ -137,6 +141,9 @@ def test_remote_enrollment(get_configuration, configure_environment, restart_aut - restart_authd: type: fixture brief: Restart the 'wazuh-authd' daemon, clear the 'ossec.log' file and start a new file monitor. + - tear_down: + type: fixture + brief: cleans the client.keys file assertions: - Verify that the port '1515' opens or closes depending on the value of the 'remote_enrollment' option. @@ -180,8 +187,9 @@ def test_remote_enrollment(get_configuration, configure_environment, restart_aut if test_metadata['node_type'] == 'worker': expected_answer = 'ERROR: Cannot comunicate with master' - - ssl_socket.send("OSSEC A:'user1'", size=False) + global AGENT_ID + ssl_socket.send(INPUT_MESSAGE.format(AGENT_NAME, AGENT_ID), size=False) + AGENT_ID = AGENT_ID + 1 response = ssl_socket.receive().decode() assert expected_answer in response