manage_agents

The manage_agents tool imports a client key on a Wazuh agent. In Wazuh 5.0, only the Wazuh agent installs this tool.

The tool is located at /var/ossec/bin/manage_agents on Linux Wazuh agents, /Library/Ossec/bin/manage_agents on macOS Wazuh agents, and C:\Program Files (x86)\ossec-agent\manage_agents.exe on Windows Wazuh agents. On Linux and macOS, run it as root.

For the full procedure, see Importing the client key in the Wazuh agent documentation.

Usage

manage_agents -[Vhj] [-i id]

Options

Option

Description

-i <key>

Imports the authentication key generated by the Wazuh manager. The tool prints the agent ID, name, and IP address from the key and asks for confirmation before it writes the key to the client.keys file of the agent.

-j

Hides the menu banner and the exit message. The tool has no other JSON output.

-V

Displays the version and license information and exits.

-h

Displays the help message and exits.

Without -i, the tool opens a menu: I imports a key that you paste when prompted, and Q quits.

To answer the confirmation without a prompt, for example in a script, set the OSSEC_ACTION_CONFIRMED environment variable to y.

The exit code doesn't show whether the key was imported. The tool prints Added. when it writes the key, Not Adding. when you don't confirm, and ** Invalid authentication key. Starting over again. when it can't read the key.

Examples

Import a client key on a Linux Wazuh agent. Replace <KEY> with the key that the Wazuh manager generated for the agent:

# /var/ossec/bin/manage_agents -i <KEY>

The command prints the agent ID, name, and IP address from the key and asks Confirm adding it?(y/n):. Type y to import the key.