From 5584a69747aa5f1b01210855e43f3c2d37149b1d Mon Sep 17 00:00:00 2001 From: Hossam <74155898+hossam1522@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:22:13 +0200 Subject: [PATCH] Changed agent start from install test to registration test --- deployability/modules/testing/tests/helpers/agent.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/deployability/modules/testing/tests/helpers/agent.py b/deployability/modules/testing/tests/helpers/agent.py index 671303cadc..c82f0aecd0 100644 --- a/deployability/modules/testing/tests/helpers/agent.py +++ b/deployability/modules/testing/tests/helpers/agent.py @@ -62,7 +62,6 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv system_commands = [ "systemctl daemon-reload", "systemctl enable wazuh-agent", - "systemctl start wazuh-agent", "systemctl status wazuh-agent" ] @@ -78,7 +77,6 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv f"WAZUH_AGENT_NAME='{agent_name}' " f"WAZUH_REGISTRATION_SERVER='MANAGER_IP' " ]) - commands.extend(["NET START WazuhSvc"]) elif os_type == 'macos': if architecture == 'amd64': @@ -90,7 +88,6 @@ def install_agent(inventory_path, agent_name, wazuh_version, wazuh_revision, liv f'curl -so wazuh-agent.pkg https://{s3_url}.wazuh.com/{release}/macos/wazuh-agent-{wazuh_version}-1.arm64.pkg && echo "WAZUH_MANAGER=\'MANAGER_IP\' && WAZUH_AGENT_NAME=\'{agent_name}\'" > /tmp/wazuh_envs && sudo installer -pkg ./wazuh-agent.pkg -target /' ]) system_commands = [ - '/Library/Ossec/bin/wazuh-control start', '/Library/Ossec/bin/wazuh-control status' ] commands.extend(system_commands) @@ -124,7 +121,8 @@ def register_agent(inventory_path, manager_path): host_ip = HostInformation.get_internal_ip_from_aws_dns(manager_host) if 'amazonaws' in manager_host else manager_host commands = [ f"sed -i 's/
MANAGER_IP<\/address>/{host_ip}<\/address>/g' {WAZUH_CONF}", - "systemctl restart wazuh-agent" + "systemctl start wazuh-agent", + "systemctl status wazuh-agent" ] ConnectionManager.execute_commands(inventory_path, commands) except Exception as e: @@ -141,7 +139,8 @@ def register_agent(inventory_path, manager_path): host_ip = HostInformation.get_public_ip_from_aws_dns(manager_host) commands = [ f"sed -i '.bak' 's/MANAGER_IP<\/address>/{host_ip}<\/address>/g' {WAZUH_MACOS_CONF}", - "/Library/Ossec/bin/wazuh-control restart" + "/Library/Ossec/bin/wazuh-control start", + "/Library/Ossec/bin/wazuh-control status" ] ConnectionManager.execute_commands(inventory_path, commands) except Exception as e: