Skip to content

Commit

Permalink
Changed agent start from install test to registration test
Browse files Browse the repository at this point in the history
  • Loading branch information
hossam1522 authored Sep 20, 2024
1 parent 86b9c8d commit 5584a69
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions deployability/modules/testing/tests/helpers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]

Expand All @@ -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':
Expand All @@ -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)
Expand Down Expand Up @@ -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/<address>MANAGER_IP<\/address>/<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:
Expand All @@ -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/<address>MANAGER_IP<\/address>/<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:
Expand Down

0 comments on commit 5584a69

Please sign in to comment.