# Wazuh agent enrollment: enrollment, authd.pass and certificates

> How a Wazuh agent enrolls through the enrollment block and agent-auth: authd.pass, certificate checks on both sides, auth options with defaults, and errors.

Published: 2026-10-30. Updated: 2026-11-12. Category: Deployment. Tags: Wazuh 4. URL: https://wazuh.blog/en/blog/wazuh-agent-enrollment/ Polish original: https://wazuh.blog/blog/wazuh-agent-enrollment/

Enrolling a Wazuh agent means getting a key from the `wazuh-authd` service on the manager and storing it in `client.keys`. By default the service requires no authentication, so the password and certificate verification decide how secure enrollment is. Both are described below, together with the `<auth>` and `<enrollment>` options and the error messages. Addresses, names and passwords in the examples are synthetic.

## Two ways to enroll

The first way is agent configuration. The agent enrolls automatically when it has a manager address (IP or FQDN) set in `<client><server><address>`, passed as an environment variable during installation or written by hand in the configuration file. Enrollment parameters go into the `<client><enrollment>` block. The second way is the `agent-auth` program, a client that talks to `wazuh-authd`. The documentation notes that by default the transaction has no authentication or authorization, so it recommends running the service only when a new agent is being added. A third method, fetching the key through the server API, uses port 55000 and is not covered here.

| Purpose | TCP port | Enrollment port setting |
| --- | --- | --- |
| Agent communication with the manager | 1514 | not applicable |
| Enrollment through agent configuration | 1515 | `port` in the auth section on the manager, `port` in the enrollment block on the agent, `-p` in `agent-auth` |
| Enrollment through the server API | 55000 | not applicable |

All three ports must be reachable from the endpoint. You can check this from Linux or macOS (netcat is required), substituting the manager address:

```bash
nc -zv 192.0.2.10 1514 1515 55000
```

A correct result is three lines `Connection to 192.0.2.10 port 1514 [tcp] succeeded!` (the same for 1515 and 55000). On Windows the command `(new-object Net.Sockets.TcpClient).Connect("192.0.2.10", 1515)` returns nothing on success, and on a failed connection it returns the error `A connection attempt failed because the connected party did not properly respond`. The role of the ports in the whole architecture is covered in the post on [Wazuh architecture](/en/blog/wazuh-architecture/).

## agent-auth

Parameters of the `agent-auth` program:

| Option | Default | Meaning |
| --- | --- | --- |
| `-m` | none | Manager IP address |
| `-A` | hostname | Agent name |
| `-p` | `1515` | `wazuh-authd` port |
| `-P` | none | Password used instead of the `authd.pass` file |
| `-G` | none | Existing groups, comma-separated |
| `-a` | TLS v1.2 | Negotiation of the most secure common SSL/TLS method |
| `-c` | `HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH` | Cipher list |
| `-v` | none | Path to the CA certificate used to verify the server |
| `-x`, `-k` | none | Path to the agent certificate and key |
| `-n` | none | Network interface, only for an IPv6 link-local address |
| `-i`, `-I` | none | Agent IP address set by the connection to the manager or given explicitly |
| `-t` | none | Configuration test |

Without a password in the file or in `-P`, the client connects in insecure mode. An example with an agent name and a group:

```bash
/var/ossec/bin/agent-auth -A agent-01 -m 192.0.2.10 -G example-web
```

A successful call ends with the line `agent-auth: INFO: Valid key received`, and when no password was given, the log contains `No authentication password provided` before it. Without `-A`, the agent name is the hostname. Assigning agents to groups and its effects are covered in the post on [agent groups](/en/blog/wazuh-agent-groups/).

## The enrollment block in agent configuration

The `<client><enrollment>` block moves the enrollment parameters into the agent configuration file instead of passing them in the `agent-auth` call.

| Option | Default | Description |
| --- | --- | --- |
| `enabled` | `yes` | Enables or disables enrollment |
| `manager_address` | none | When empty, the agent enrolls with the manager it connects to |
| `port` | `1515` | Must match the manager listening port |
| `agent_name` | hostname | Letters, digits, `-`, `_`, `.`, at least two characters |
| `groups` | `NULL` | One or more existing groups |
| `agent_address` | `src` | When not set, the manager takes the source address from the message |
| `ssl_cipher` | `HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH` | Cipher override |
| `server_ca_path` | `NULL` | CA used to verify the manager. Without it the server is not verified |
| `agent_certificate_path`, `agent_key_path` | `NULL` | Required when the manager verifies agents |
| `authorization_pass_path` | `authd.pass` (Windows), `/etc/authd.pass` (Unix) | Required when a password is used |
| `auto_method` | `no` | `yes` negotiates the TLS method, `no` forces TLS v1.2 |
| `delay_after_enrollment` | `20` | Seconds to wait after a successful enrollment |
| `use_source_ip` | `no` | Forces the IP address to be computed from the agent message |

For an IPv6 link-local address there is `interface_index`, a positive number that you must change by hand after the interface number changes. The block below combines the most common settings:

```xml
<client>
  <server>
    <address>192.0.2.10</address>
  </server>
  <enrollment>
    <agent_name>agent-01</agent_name>
    <groups>example-web</groups>
    <authorization_pass_path>/var/ossec/etc/authd.pass</authorization_pass_path>
  </enrollment>
</client>
```

After a change, restart the agent (`systemctl restart wazuh-agent` on Linux, `Restart-Service -Name wazuh` on Windows). The result is visible on the dashboard under Agents management > Summary. The agent configuration path is `/var/ossec/etc/ossec.conf` on Linux, `/Library/Ossec/etc/ossec.conf` on macOS and `C:\Program Files (x86)\ossec-agent\ossec.conf` on Windows.

## Auth section options on the manager

The `<auth>` section in `/var/ossec/etc/ossec.conf` configures the enrollment service.

| Option | Default | Description |
| --- | --- | --- |
| `disabled` | `no` | Disables the Auth daemon |
| `remote_enrollment` | `yes` | Listens for new agents on the TLS port |
| `port` | `1515` | TCP port, 0 to 65535 |
| `ipv6` | `no` | IPv6 support |
| `use_source_ip` | `no` | The client source address instead of `any` when adding an agent |
| `purge` | `yes` | Removes keys of deleted agents. With `no` they stay marked as removed |
| `use_password` | `no` | Shared password from `/var/ossec/etc/authd.pass` |
| `ssl_agent_ca` | none | CA used to verify agents. Without it the manager does not verify agent certificates |
| `ssl_verify_host` | `no` | With a CA set, validates the client address against the Common Name field |
| `ssl_manager_cert` | `etc/sslmanager.cert` | Server certificate |
| `ssl_manager_key` | `etc/sslmanager.key` | Server key |
| `ssl_auto_negotiate` | `no` | By default only TLS v1.2, `yes` negotiates the most secure common method |
| `ciphers` | `HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH` | Connection ciphers |

### Replacing duplicates

The `force` block decides what happens when an agent enrolls with the name or IP address of an existing agent. All conditions must be met, and the replacement deletes the old agent.

```xml
<force>
  <enabled>yes</enabled>
  <disconnected_time enabled="yes">1h</disconnected_time>
  <after_registration_time>1h</after_registration_time>
  <key_mismatch>yes</key_mismatch>
</force>
```

The values in the example are also the defaults. `disconnected_time` limits replacement to agents disconnected for longer than the given time (suffixes s, m, h, d), `enabled="no"` allows replacing active agents too, and the value `0` allows any disconnected one. `after_registration_time` requires that the given time has passed since registration, and `0` means always. `key_mismatch` allows replacement when the agent key differs from the registered one. The causes of disconnections after enrollment are covered in the post on [agent disconnections](/en/blog/wazuh-agent-disconnections/).

## Password authentication

On the manager, enable the password in `<auth>`:

```xml
<auth>
  <use_password>yes</use_password>
</auth>
```

You can set the password in two ways. The recommended one is your own file:

```bash
echo "example-password" > /var/ossec/etc/authd.pass
chmod 640 /var/ossec/etc/authd.pass
chown root:wazuh /var/ossec/etc/authd.pass
systemctl restart wazuh-manager
```

The second way is a random password generated at every manager restart when the file is missing. You can read it from the log:

```bash
grep "Random password" /var/ossec/logs/ossec.log
```

The log shows the line `wazuh-authd: INFO: Accepting connections on port 1515. Random password chosen for agent authentication: ...`. In a cluster, enable the password on every node, because an unprotected node allows unauthorized enrollment. The documentation recommends the same password on all nodes.

The agent must have the same password in its `authd.pass` file: `/var/ossec/etc/authd.pass` on Linux (permissions 640, owner root, group `wazuh`), `/Library/Ossec/etc/authd.pass` on macOS and `authd.pass` in the `ossec-agent` directory on Windows (`C:\Program Files (x86)\ossec-agent` on a 64-bit system, `C:\Program Files\ossec-agent` on a 32-bit one). A different location is set with `authorization_pass_path` in `<enrollment>`.

## Certificate verification

Manager verification and agent verification are independent and can be combined. Both need a certificate authority. If you do not have one, the documentation shows how to generate it on the server:

```bash
openssl req -x509 -new -nodes -newkey rsa:4096 -keyout rootCA.key -out rootCA.pem -batch -subj "/C=US/ST=CA/O=Wazuh"
```

### Manager identity

The manager presents the agent with a certificate signed by the CA, and the agent checks it with the root certificate. The `req.conf` file requires a `CN` equal to the manager IP or FQDN (a mandatory field), while `subjectAltName` is optional and needed so that agents can enroll through alternative names.

```text
[req]
distinguished_name = req_distinguished_name
req_extensions = req_ext
prompt = no
[req_distinguished_name]
C = US
CN = manager.example.com
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.1 = manager
DNS.2 = manager.example.com
```

```bash
openssl req -new -nodes -newkey rsa:4096 -keyout sslmanager.key -out sslmanager.csr -config req.conf
openssl x509 -req -days 365 -in sslmanager.csr -CA rootCA.pem -CAkey rootCA.key -out sslmanager.cert -CAcreateserial -extfile req.conf -extensions req_ext
cp sslmanager.cert sslmanager.key /var/ossec/etc
systemctl restart wazuh-manager
```

The `-extfile` and `-extensions` options are required to carry the subject and extensions from the CSR into the certificate. The default `ssl_manager_cert` and `ssl_manager_key` point to `etc/sslmanager.cert` and `etc/sslmanager.key`, so files copied to `/var/ossec/etc` are used without changes in `<auth>`. On the agent, copy `rootCA.pem` and point to it:

```xml
<client>
  <enrollment>
    <server_ca_path>/var/ossec/etc/rootCA.pem</server_ca_path>
  </enrollment>
</client>
```

### Agent identity

The manager verifies the agent certificate with its own `rootCA.pem`. The documentation describes two variants. Without host validation the certificate is issued without a name and can be used on many agents. With host validation the `CN` holds the agent IP or name, and the certificate matches only that agent.

```bash
# without host validation
openssl req -new -nodes -newkey rsa:4096 -keyout sslagent.key -out sslagent.csr -batch
# with host validation
openssl req -new -nodes -newkey rsa:4096 -keyout sslagent.key -out sslagent.csr -subj '/C=US/CN=198.51.100.20'
openssl x509 -req -days 365 -in sslagent.csr -CA rootCA.pem -CAkey rootCA.key -out sslagent.cert -CAcreateserial
```

On the manager, put `rootCA.pem` in `/var/ossec/etc/`, set the CA and restart the service:

```xml
<auth>
  <ssl_agent_ca>/var/ossec/etc/rootCA.pem</ssl_agent_ca>
</auth>
```

The agent gets the certificate and key in the `<enrollment>` block:

```xml
<client>
  <enrollment>
    <agent_certificate_path>/var/ossec/etc/sslagent.cert</agent_certificate_path>
    <agent_key_path>/var/ossec/etc/sslagent.key</agent_key_path>
  </enrollment>
</client>
```

Checking the agent address against `CN` is enabled only by `ssl_verify_host` in `<auth>`.

## Diagnostics

Logs: manager `/var/ossec/logs/ossec.log`, agent `/var/ossec/logs/ossec.log` (Linux), `/Library/Ossec/logs/ossec.log` (macOS), `C:\Program Files (x86)\ossec-agent\ossec.log` (Windows 64-bit) or `C:\Program Files\ossec-agent\ossec.log` (32-bit).

| Message | Where | Cause and action |
| --- | --- | --- |
| `(1404): Authentication error. Wrong key or corrupt payload. Message received from agent '001' at 'any'.` | manager log (`wazuh-remoted`) | The agent and manager `client.keys` differ. Duplicate keys appear after deleting the agents with the highest IDs or copying `client.keys` between agents |
| `Invalid agent name: NAME (from manager)` and `Unable to add agent (from manager)` | agent log (`wazuh-agentd`) | The name is not unique because the hostname repeats. Set `agent_name` in `<enrollment>` |
| `Invalid password (from manager)` after `No authentication password provided` | agent log | The password is missing or differs from the manager password, the `authd.pass` file has wrong permissions (640, owner root), or the password must be disabled in `<auth>` |
| `Unable to read CA certificate file "/var/ossec/etc/rootCA.pem"` and `SSL error. Exiting.` | manager log (`wazuh-authd`) | The CA file is not at the path from `ssl_agent_ca`. On the agent side, check `server_ca_path` |
| `Unable to read private key file: PATH` and `Could not set up SSL connection! Check certification configuration.` | agent log | The key is not at the path from `agent_key_path` |
| `Unable to read certificate file (not found): PATH` | agent log | The certificate is not at the path from `agent_certificate_path` |

The agent key file is `/var/ossec/etc/client.keys` on the manager and on Linux, `/Library/Ossec/etc/client.keys` on macOS and `C:\Program Files (x86)\ossec-agent\client.keys` on Windows.

## What the documentation does not specify

The pages I checked give no enrollment timeout or retry rules, no key validity period, no limit on concurrent enrollments and no certificate pinning. The format of a `client.keys` entry and the limits of its fields are not described in them.

## Sources

- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/auth.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/client.html
- https://documentation.wazuh.com/current/user-manual/reference/tools/agent-auth.html
- https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/enrollment-methods/via-agent-configuration/index.html
- https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/security-options/using-password-authentication.html
- https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/security-options/manager-identity-verification.html
- https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/security-options/agent-identity-verification.html
- https://documentation.wazuh.com/current/user-manual/agent/agent-enrollment/troubleshooting.html
