Configuration
The Wazuh manager API takes its general settings from a configuration file and its security settings from API endpoints. Proper configuration and hardening are essential for production environments to prevent unauthorized access and make sure reliable operation.
Wazuh manager API configuration file
The Wazuh manager API configuration file is located at /var/wazuh-manager/api/configuration/api.yaml on the Wazuh manager. By default, most settings are commented out. To apply a different configuration, uncomment and edit the desired line. The file owner is root:wazuh-manager, with mode 0660. An unknown option or a value of the wrong type stops the Wazuh manager API with error 2000. To check the file before you restart the Wazuh manager, run /var/wazuh-manager/bin/wazuh-manager-apid -t -c /var/wazuh-manager/api/configuration/api.yaml.
The following block is the shipped template of the /var/wazuh-manager/api/configuration/api.yaml configuration file, with every setting commented out. For more information on each of the settings, check the configuration options:
# USE THIS FILE AS A TEMPLATE. UNCOMMENT LINES TO APPLY CUSTOM CONFIGURATION
# host: ['0.0.0.0', '::']
# port: 55000
# Advanced configuration
# https:
# enabled: yes
# key: "apid-key.pem"
# cert: "apid.pem"
# use_ca: False
# ca: "root-ca.pem"
# ssl_ciphers: "" # Passed to OpenSSL as written (case-sensitive); empty = ECDHE+AESGCM:ECDHE+CHACHA20
# Modify API's intervals (time in seconds)
# intervals:
# request_timeout: 10
# Logging configuration
# Values for API log level: critical, error, warning, info, debug, debug2 (each level includes the previous levels).
# Values for API log max_size: <value><unit>. Valid units: K (kilobytes), M (megabytes)
# Enabling the API log max_size will disable the time based rotation (on midnight)
# logs:
# level: "info"
# format: "plain"
# max_size:
# enabled: False
# size: "1M"
# Cross-origin resource sharing: https://www.starlette.io/middleware/#corsmiddleware
# cors:
# enabled: no
# source_route: "*"
# expose_headers: "*"
# allow_headers: "*"
# allow_credentials: no
# Access parameters
# access:
# max_login_attempts: 50
# block_time: 300
# max_request_per_minute: 300
# max_unauthenticated_request_per_minute: 10
# Drop privileges (Run as wazuh-manager user)
# drop_privileges: yes
# Maximum body size that the API can accept, in bytes (0 -> limitless)
# max_upload_size: 10485760
# Maximum size, in bytes, of the run_as authentication context payload
# (POST /security/user/authenticate/run_as). AD/LDAP/SSO logins with large
# group memberships may need to raise this. Independent of max_upload_size,
# which still bounds the overall request body for every endpoint.
# auth_context_max_payload_size: 65536
# Number of processes dedicated to processing authentication requests.
# authentication_pool_size: 2
# Uploadable Wazuh configuration sections
# upload_configuration:
# agents:
# allow_higher_versions:
# allow: yes
# indexer:
# allow: yes
Note
In a Wazuh manager cluster, the Wazuh manager API runs only on the master node. It forwards requests that concern a worker node to that worker. Edit /var/wazuh-manager/api/configuration/api.yaml on the master node, and send every Wazuh manager API request to the master node.
Make sure to restart the Wazuh manager API using the Wazuh manager service after editing the configuration file:
# systemctl restart wazuh-manager
# service wazuh-manager restart
API configuration options
General options
Option |
Allowed values |
Default value |
Description |
|
|---|---|---|---|---|
|
List of IP addresses or hostnames |
['0.0.0.0', '::'] |
IP address or hostname of the Wazuh manager where the Wazuh manager API is running. |
|
|
Any value between 1 and 65535 |
55000 |
Port where the Wazuh manager API listens. |
|
|
yes, true, no, false |
true |
Run the wazuh-manager-apid process as the |
|
|
Any integer from 1024 to 1048576 |
65536 |
Maximum size, in bytes, of the authorization context body that |
|
|
0 (no limit) or any positive integer |
10485760 |
Set the maximum body size that the API can accept, in bytes (0 -> limitless). |
|
|
Any integer between 1 and 50 |
2 |
Number of processes dedicated to processing authentication requests. |
|
|
request_timeout |
Any non-negative number |
10 |
Set the maximum response time (in seconds) for each API request. |
|
enabled |
yes, true, no, false |
true |
Enable or disable SSL (https) in the Wazuh manager API. |
key |
Any text string |
|
Name of the private key. Stored in |
|
cert |
Any text string |
|
Name of the certificate. Stored in |
|
use_ca |
yes, true, no, false |
false |
Require a client certificate signed by the ca certificate. The Wazuh dashboard doesn't present a client certificate in Wazuh 5.0. Setting |
|
ca |
Any text string |
|
Name of the certificate authority (CA) certificate. Stored in |
|
ssl_ciphers |
Any text string |
"" |
OpenSSL cipher list for TLS 1.2. The Wazuh manager API passes it to OpenSSL as written, so keywords are case-sensitive. An empty value allows only |
|
|
level |
critical, error, warning, info, debug, debug2 (each level includes the previous levels) |
info |
Set the verbosity level of the Wazuh manager API logs. |
format |
plain, json or both (plain,json) |
plain |
Set the format of the Wazuh manager API logs. |
|
|
enabled |
yes, true, no, false |
false |
Toggle between time-based and size-based Wazuh manager API log rotation. Enabling this option disables time-based rotation, enabling rotation based on file size instead. |
size |
Any positive number followed by a valid unit. K/k for kilobytes, M/m for megabytes. |
1M |
Set the log file size that triggers size-based log rotation. The minimum is 1M. A lower value stops the Wazuh manager API from starting with error |
|
|
enabled |
yes, true, no, false |
false |
Enable or disable the use of CORS in the Wazuh manager API. |
source_route |
Any text string |
|
Sources for which the resources are available. For example |
|
expose_headers |
Any text string |
|
Which headers can be exposed as part of the response. |
|
allow_headers |
Any text string |
|
Which HTTP headers can be used during the actual request. |
|
allow_credentials |
yes, true, no, false |
false |
Tell browsers whether to expose the response to frontend JavaScript or not. |
|
|
max_login_attempts |
Any positive integer |
50 |
Maximum number of failed login attempts from an IP address before the Wazuh manager API blocks its login requests. See |
block_time |
Any positive integer |
300 |
Time, in seconds, after which the count of failed login attempts from an IP address, and any block on it, are cleared. The period starts at the first counted failed attempt and does not restart with later attempts. An address that reaches |
|
max_request_per_minute |
0 (no limit) or any positive integer |
300 |
The maximum number of requests allowed per minute from each client address. It applies to all Wazuh manager API endpoints, including authentication requests. A client address that reaches this limit gets HTTP |
|
max_unauthenticated_request_per_minute |
0 (no limit) or any positive integer |
10 |
The maximum number of unauthenticated and failed requests allowed per minute from each client address. A client address that reaches this limit gets HTTP |
upload_configuration
These options control which sections of wazuh-manager.conf a PUT /cluster/{node_id}/configuration request can change. With indexer.allow set to true, the change also requires the cluster:read_secrets permission. The Wazuh manager API still accepts the upload_configuration.remote_commands and upload_configuration.limits.eps options and the cache section, but they have no effect. The logcollector.remote_commands and wazuh_command.remote_commands internal options of the Wazuh agent control remote commands.
agents |
||||
allow_higher_versions |
allow |
yes, true, no, false |
true |
Allow uploading configurations that accept higher Wazuh agent versions through the Wazuh manager API. Setting this option to |
indexer |
allow |
yes, true, no, false |
true |
Allows uploading an updated indexer configuration section through the Wazuh manager API. Setting this option to |
Wazuh manager API security configuration
Security-related settings such as token expiration auth_token_exp_timeout, and RBAC behavior rbac_mode are managed exclusively through the Wazuh manager API, not through a configuration file.
GET /security/config: View current security configuration
PUT /security/config: Update security settings
DELETE /security/config: Reset to default values
The auth_token_exp_timeout defines the duration in seconds before an authentication token expires and requires renewal. The rbac_mode determines the default behavior of the Role-Based Access Control system. It either permits or denies access to any resource that no policy explicitly covers. Refer to the Role-Based Access Control documentation for more details. In a cluster, the configuration applies to the Wazuh manager API on the master node, the only node that runs it.
For more information on each of the settings, see the security configuration options.
Example security configuration settings
Use the following API endpoints (requires administrator privileges and a valid JWT).
All examples assume you have $TOKEN set from authentication steps. Each PUT or DELETE request to /security/config revokes all JWTs, including the one in $TOKEN. Obtain a new token before you run the next example.
View current settings (GET /security/config)
# curl -k -X GET "https://<WAZUH_MANAGER_IP_ADDRESS>:55000/security/config?pretty=true" \
-H "Authorization: Bearer $TOKEN"
The command output looks similar to this:
{
"data": {
"auth_token_exp_timeout": 900,
"rbac_mode": "white"
},
"error": 0
}
Update settings (PUT /security/config)
For
auth_token_exp_timeout: Set the token expiration time in seconds (for example,1800for 30 minutes).For
rbac_mode: Choosewhite(allow only permitted resources, the more secure option) orblack(deny only restricted resources).
Example: Update token expiration to 30 minutes
# curl -k -X PUT "https://<WAZUH_MANAGER_IP_ADDRESS>:55000/security/config" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"auth_token_exp_timeout": 1800}'
The command output looks similar to this:
{"message": "Configuration was successfully updated", "error": 0}
Example: Change RBAC mode to black
# curl -k -X PUT "https://<WAZUH_MANAGER_IP_ADDRESS>:55000/security/config" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"rbac_mode": "black"}'
The command output looks similar to this:
{"message": "Configuration was successfully updated", "error": 0}
Reset to defaults (DELETE /security/config)
This request resets both settings back to defaults (auth_token_exp_timeout: 900, rbac_mode: white).
# curl -k -X DELETE "https://<WAZUH_MANAGER_IP_ADDRESS>:55000/security/config?pretty=true" \
-H "Authorization: Bearer $TOKEN"
The command output looks similar to this:
{
"message": "Configuration was successfully updated",
"error": 0
}
For security reasons, changing the security configuration revokes all JWTs. You must log in and obtain a new token after the change.
Security configuration options
auth_token_exp_timeout
Allowed values |
Default value |
Description |
|---|---|---|
An integer of 30 or more |
900 |
Set how many seconds it takes for JWTs to expire. |
rbac_mode
Allowed values |
Default value |
Description |
|---|---|---|
black, white |
white |
Set the behavior of RBAC. By default, everything is allowed in black mode, while everything is denied in white mode. Choose the |
Configuration endpoints
The Wazuh manager API has several endpoints that allow querying its current configuration. To modify the general API configuration, edit the /var/wazuh-manager/api/configuration/api.yaml file as detailed in the Wazuh manager API configuration file section.
Get configuration
GET /cluster/api/config: Retrieve the complete Wazuh manager API configuration of all (or a list) of the cluster nodes.
GET /security/config: Retrieve the current security-related configuration.
GET /cluster/{node_id}/configuration/{component}/{configuration}: Retrieve the active configuration of a Wazuh manager node. In Wazuh 5.0, component is
auth,request,wazuh-manager-db, orwmodules, and configuration isglobal,auth,internal,remote,wdb, orwmodules.
Modify configuration
PUT /security/config: Update the security-related settings.
Restore configuration
DELETE /security/config: Restore the default security configuration.
SSL certificate
Note
The installation issues the Wazuh manager API certificate, signed by the Wazuh manager certificate authority (CA) in /etc/wazuh-manager/ca/.
The SSL certificate ensures secure communication between the Wazuh manager API and its clients. The certificate files are in the /etc/wazuh-manager/certs/ directory.
Take the following steps to issue a new certificate for the Wazuh manager API from the Wazuh manager CA:
Move the current key and certificate out of the
/etc/wazuh-manager/certsdirectory. Optionally, set the names that the new certificate must cover in theWAZUH_MANAGER_APID_CERT_SANSvariable of/etc/wazuh-manager/local.env. Then run the credential resolver to issue a new pair:# cd /etc/wazuh-manager/certs # mkdir -p /root/apid-certs-backup # mv apid-key.pem apid.pem /root/apid-certs-backup/ # /var/wazuh-manager/bin/wazuh-manager-resolve-credentials --install
The command issues
apid.pemandapid-key.pemfrom the Wazuh manager CA, with the owner and mode that the Wazuh manager requires.To use your own certificate instead, place the key and the certificate, followed by any intermediate certificates, directly in
/etc/wazuh-manager/certs. Set their owner toroot:wazuh-managerand their mode to0640, and sethttps.keyandhttps.certinapi.yamlto the filenames. The certificate must chain to the CA in/etc/wazuh-manager/ca/root-ca.pem, must not be a CA certificate, and must include the hostnames of the Wazuh manager as subject alternative names. Do not protect the key with a passphrase. Run/var/wazuh-manager/bin/wazuh-manager-resolve-credentials --checkto validate the files. If any check fails, the Wazuh manager does not start.Restart the Wazuh manager to load the new certificate:
# systemctl restart wazuh-manager