Linux and UNIX hosts

Open a session in your Linux/Unix agent host as root user. Then, follow these steps:

  1. Add the agent to the manager.

# curl -u foo:bar -k -X POST -d '{"name":"ubuntu-ag","ip":"10.0.0.8"}' -H 'Content-Type:application/json' "https://192.168.1.2:55000/agents?pretty"
{
  "error": 0,
  "data": {
      "id": "001",
      "key": "MDAxIE5ld0FnZW50IDEwLjAuMC44IDM0MGQ1NjNkODQyNjcxMWIyYzUzZTE1MGIzYjEyYWVlMTU1ODgxMzVhNDE3MWQ1Y2IzZDY4M2Y0YjA0ZWVjYzM="
  }
}
  1. Import the key to the agent:

# /var/ossec/bin/manage_agents -i MDAxIE5ld0FnZW50IDEwLjAuMC44IDM0MGQ1NjNkODQyNjcxMWIyYzUzZTE1MGIzYjEyYWVlMTU1ODgxMzVhNDE3MWQ1Y2IzZDY4M2Y0YjA0ZWVjYzM=

Warning

If you paste the command directly into the terminal, the agent key will be saved in the bash history. Use manage_agents without arguments or from a script.

  1. Edit the Wazuh agent configuration in /var/ossec/etc/ossec.conf to add the Wazuh server IP address. In the <client><server> section, change the MANAGER_IP value to the Wazuh server address:

<client>
  <server>
    <address>MANAGER_IP</address>
    ...
  </server>
</client>
  1. Start the agent.

  1. For Systemd:

# systemctl start wazuh-agent
  1. For SysV Init:

# service wazuh-agent start
  1. Other cases:

# /var/ossec/bin/ossec-control start