PL EN
WB-9D3F7DF1TLP:CLEARWazuh 5

Wazuh 5 in Docker: single-node, multi-node and images

Wazuh 5.0-rc in Docker: single-node vs multi-node, certificates and wazuh-ca, password changes, volumes, backup, upgrade, building images and removal.

A Wazuh 5 stack in Docker starts with a few commands, but the difficulty lies in certificates, volumes and the order of steps. The short installation flow is in the article on installing Wazuh 5. This post is the sequel: multi-node topology, certificates, passwords, persistent data, upgrade, custom images and removal.

This covers release candidate 5.0.0-rc2 (repository tag v5.0.0-rc2). Every documentation page carries a banner saying the release is under development, so names and settings may change. The overall picture of the version 5 changes is in Wazuh 5 as a next-gen SIEM.

What the documentation calls a Docker deployment

The documentation describes three things, all on a single Docker host:

DeploymentCompositionMinimum
single-nodeone indexer, one manager and one dashboard container4 cores, 8 GB RAM, 50 GB
multi-nodethree indexers, two managers (master and worker), dashboard, Nginx4 cores, 16 GB RAM, 100 GB
agent containeran agent for syslog and integrations2 cores, 1 GB RAM, 10 GB

Multi-node is several containers on one host that share its disk. It is not a cluster across several machines. The documentation does not describe a variant spread over several Docker hosts. Host requirements, including vm.max_map_count, are in the installation article.

Nginx in front of two managers

In multi-node, agents connect to an Nginx container that forwards connections on ports 1517 and 1514 to the master or the worker. The choice of node depends on the source address Nginx sees, so agents spread across the two nodes only when they connect from different addresses. Agents in containers on the host, and agents behind a single NAT, appear under one address, so each such group lands on one node. You can check which node processes an agent’s data in the wazuh.cluster.node field of its events.

Nginx does not decrypt the traffic, and each manager presents its own certificate with the address that agents connect to. When one manager stops, new connections go to the other. Stopping the master, however, disables the API on port 55000 and the dashboard pages that use it. The master keeps the agent registry, the enrollment tokens and the group configuration.

Ports differ between the stacks. In multi-node, Nginx exposes 1517 and 1514, and the master exposes 1515 and 55000. Neither stack publishes the indexer API on 9200, and the remaining ports listen on all interfaces of the host. If no other host needs 55000 or the 4.x agent ports 1514 and 1515, the documentation says to remove that line from the ports section of docker-compose.yml or narrow it, for example to "127.0.0.1:55000:55000".

Certificates: config.yml, wazuh-ca and the --agent-san option

You download the certificate tool from the pre-release repository, and the documentation requires the 5.0.0-rc2 version, because earlier ones do not create the manager API certificates (apid):

curl -fsS -o wazuh-certs-tool.sh https://packages-staging.xdrsiem.wazuh.info/pre-release/5.x/installation-assistant/wazuh-certs-tool-5.0.0-rc2.sh

The config.yml file describes the nodes. For multi-node:

nodes:
  indexer:
    - name: wazuh1.indexer
      dns: "wazuh1.indexer"
    - name: wazuh2.indexer
      dns: "wazuh2.indexer"
    - name: wazuh3.indexer
      dns: "wazuh3.indexer"
  manager:
    - name: wazuh.master
      dns: "wazuh.master"
      node_type: master
    - name: wazuh.worker
      dns: "wazuh.worker"
      node_type: worker
  dashboard:
    - name: wazuh.dashboard
      dns: "wazuh.dashboard"

The node_type field is needed only with more than one manager, and in single-node the file has one entry each: wazuh.indexer, wazuh.manager and wazuh.dashboard. You do not put the address for agents in config.yml. You pass it in the call to the certificates-conf.sh script with the --agent-san option. In multi-node, the script adds it to the listener certificate of both managers, so an agent can verify either of them, and it rejects the same address repeated in config.yml for several managers. You repeat the option for each address, including DNS names. A second option, --api-san, adds an address to the Server API certificate (apid) for clients that reach port 55000 through a name not in config.yml.

Root CA and rerunning the script

The tool keeps the root CA certificate and its private key in the wazuh-ca/ directory, next to wazuh-certs-tool.sh. Only config/root-ca/certs/root-ca.pem goes into the containers. Back up wazuh-ca/: without it you cannot issue certificates for new nodes or agent addresses. The directory is not ignored by git, so git clean -fd in the clone will delete it.

Always run the script from the stack directory. From another location it creates a new CA, and agents enrolled against the previous one will reject it. The WAZUH_CA_DIR variable with an absolute path points to a different directory for the CA.

On my 5.0.0-rc1 lab stack the tool had no wazuh-ca/ directory. Without WAZUH_CA_DIR it reads the CA from /etc/wazuh/ca on the host, and on regeneration the log showed Using the existing root CA in /etc/wazuh/ca.. In this release you back up that directory.

The script does not overwrite existing certificates. Rerunning it without removing wazuh-certificates/ ends with the message Error: wazuh-certs-tool.sh failed (exit code 1). No certificates were copied.. In 5.0.0-rc1 the tool reports only ERROR: Directory wazuh-certificates already exists in the same path as the script., and the script still copies the old certificates and ends with Process completed., so the new address does not reach the certificate. That is why you add a new address for agents after removing wazuh-certificates/. Give all the addresses again, because the certificates are regenerated from config.yml and the --agent-san values. They are signed by the CA from wazuh-ca/, so registered agents still trust the manager:

rm -rf wazuh-certificates/
bash ../tools/utils/deployment/certificates-conf.sh --cert --copy --priv --agent-san 192.0.2.20 --agent-san agents.example.com
docker compose up -d --force-recreate --no-deps wazuh.manager

In multi-node, the last command applies to wazuh.master wazuh.worker. The addresses in the text are examples.

I ran this procedure on a 5.0.0-rc1 stack with an extra DNS name. The SHA-256 fingerprint of the CA certificate stayed the same, the certificate on port 1515 showed the new name in the SAN, and the registered agents reconnected with no change on their side.

The error of mounting an empty directory instead of a file

If the manager certificate did not exist in config/ when the container started, Docker creates an empty directory in its place. The symptoms: docker compose logs wazuh.manager shows UNSAFE /etc/wazuh-manager/certs/apid.pem: not a regular file and the container restarts in a loop, or docker compose up -d ends with the message Are you trying to mount a directory onto a file (or vice-versa)?. The documentation says to stop the manager, remove the directories config/wazuh_manager/certs/wazuh.manager-apid.pem and wazuh.manager-apid-key.pem, remove wazuh-certificates/, rerun certificates-conf.sh and start the stack. If the error comes back, the same directories sit in the manager volume, and a one-off container removes them:

docker run --rm -v single-node_wazuh_etc:/v --entrypoint rmdir wazuh/wazuh-manager:5.0.0-rc2 /v/certs/apid.pem /v/certs/apid-key.pem

In multi-node you do this separately for wazuh.master and wazuh.worker (volumes multi-node_master-wazuh-etc and multi-node_worker-wazuh-etc).

Startup, readiness and configuration changes

After docker compose up -d, the stack is ready when the Wazuh containers show (healthy): on a host with minimal resources, after about 2 minutes in single-node and about 4 minutes in multi-node, including image downloads. Nginx has no health check and shows only Up. You confirm that the multi-node clusters formed with these commands:

docker compose exec wazuh.master /var/wazuh-manager/bin/cluster_control -l
docker compose exec wazuh1.indexer curl -sk -u "admin:$(grep '^WAZUH_INDEXER_ADMIN_PASSWORD=' config/credentials/indexer.env | cut -d= -f2-)" "https://localhost:9200/_cluster/health?pretty"

The first lists the master and worker01 nodes, and the second should show "status" : "green" and "number_of_nodes" : 3.

The components do not reload configuration while running. After changing a file in a container, use docker compose restart <SERVICE>. The exception is settings that the manager overwrites at every start from the environment section of docker-compose.yml: indexer hosts, cluster settings and listen addresses in /etc/wazuh-manager/wazuh-manager.conf. You change them in the compose file and apply them with docker compose up -d, because restart does not read changes from that file.

Passwords: password-tool instead of editing files

Where the startup passwords come from is described in the installation article. Editing the config/credentials/*.env files later changes nothing. You change a password with the tool in the container:

docker compose exec wazuh.indexer /password-tool.sh --user admin
docker compose exec wazuh.manager /password-tool.sh --user wazuh

The first command handles the indexer accounts admin, kibanaserver and wazuh-manager, and the second handles the API accounts wazuh and wazuh-internal-client. On my 5.0.0-rc1 stack the manager tool also lists the accounts wazuh and wazuh-wui, so the name of the second account depends on the release. In multi-node you use wazuh1.indexer and wazuh.master. You pass your own password on standard input with the --stdin option. It must be 12 to 64 characters from the set A-Z, a-z, 0-9 and . , _ + : @ % ^ = ~ -, and contain a lowercase letter, an uppercase letter, a digit and a symbol.

The tool changes the account in the running deployment and prints the commands that update the credential files and the keystores of the components that use the account. For the wazuh-manager account, that means stopping the manager, writing the password to its keystore with the wazuh-manager-keystore command and starting it again, separately for the master and the worker in multi-node.

Persistent data, custom configuration and backup

Changes persist only in paths mounted as volumes, for example /etc/wazuh-manager in the manager container. Everything outside them disappears when Docker recreates the container, for example after docker compose down or an upgrade. The single-node volumes (prefix single-node_) are wazuh-dashboard-config, wazuh-dashboard-custom, wazuh-indexer-data, wazuh_api_configuration, wazuh_data, wazuh_etc, wazuh_logs, wazuh_queue and wazuh_var_multigroups. Multi-node adds wazuh-cluster-key, the key shared by the manager nodes. You persist a custom path by adding a volume to the service and to the top-level volumes section:

services:
  wazuh.manager:
    volumes:
      - wazuh_api_configuration:/var/wazuh-manager/api/configuration
volumes:
  wazuh_api_configuration:

Custom opensearch.yml

Start your own file from a copy taken from a running container, because a file written from scratch would strip the container of the settings it needs, such as TLS paths and security plugin settings:

docker compose cp wazuh.indexer:/usr/share/wazuh-indexer/config/opensearch.yml ./opensearch.yml

You mount it with the line - ./opensearch.yml:/usr/share/wazuh-indexer/config/opensearch.yml in the service’s volumes section. The file must be owned by root with group 101 and have mode 0640 (chown 0:101 <FILE>, chmod 640 <FILE>). Otherwise the container does not start, restarts in a loop, and docker compose logs shows UNSAFE <PATH>: <REASON>. Settings from the environment section take precedence over the file. At every start the dashboard overwrites in its file, among others, server.host and opensearch.hosts from environment variables, so you change those values with a service variable.

Single-node backup

Stop the stack so the databases are consistent. The backup covers the volumes, config/credentials/, config/*/certs/ and wazuh-ca/ (in 5.0.0-rc1, /etc/wazuh/ca). The Wazuh images have no tar, so the documentation uses one-off ubuntu:24.04 containers:

docker compose stop
mkdir -p /root/wazuh-backup
for v in $(docker volume ls -q --filter label=com.docker.compose.project=single-node); do docker run --rm -v $v:/source:ro -v /root/wazuh-backup:/backup ubuntu:24.04 tar -C /source --numeric-owner -czpf /backup/$v.tar.gz . ; done
tar -czpf /root/wazuh-backup/files.tar.gz config/credentials config/*/certs wazuh-ca
chmod 700 /root/wazuh-backup
docker compose start

For wazuh_queue, tar reports socket ignored, because the manager recreates the sockets at startup. Restoring means tar -xzpf of the files.tar.gz file, docker compose create, a loop with tar -xzpf into the volumes mounted as /target, and docker compose start. On a new host, first clone the same release of the repository. The label filter skips the agent container volume.

Agent container

The agent in a container serves integrations and syslog, but it does not monitor the host. You create the token on the stack host, and the address must be one of those given in --agent-san:

docker compose exec wazuh.manager /var/wazuh-manager/bin/wazuh-manager-authd --create-enrollment-token --address 192.0.2.20

In multi-node use wazuh.master. The first line of the output is the token, and the installation article describes the lifetime and the usage limit. On the 5.0.0-rc1 stack the token was the only line on standard output, while the identifier, address, expiry date and pin went to stderr, so TOKEN=$(...) captures the token alone. The agent rejects a value with the metadata appended, with the error invalid enrollment token: malformed token. The error ERROR 9025: Enrollment token refused: address not in certificate SAN (this is how it looks on the 5.0.0-rc1 stack) means an address outside the certificate: add it with the procedure from the certificates section. The docker-compose.yml file from wazuh-docker/wazuh-agent:

services:
  wazuh.agent:
    image: wazuh/wazuh-agent:5.0.0-rc2
    restart: always
    environment:
      - WAZUH_ENROLLMENT_TOKEN=<ENROLLMENT_TOKEN>
      #- WAZUH_AGENT_NAME=<WAZUH_AGENT_NAME>
    volumes:
      - wazuh_agent_etc:/var/ossec/etc
volumes:
  wazuh_agent_etc:

The token carries the manager address and identifies its CA, so no other connection settings are needed. Do not set WAZUH_MANAGER_SERVER or WAZUH_MANAGER_ENDPOINT together with it: at the first start the container exits with an error, and Docker restarts it in a loop. On 5.0.0-rc1 the log shows ERROR: WAZUH_ENROLLMENT_TOKEN and WAZUH_MANAGER_ENDPOINT/WAZUH_MANAGER_SERVER are mutually exclusive.. The wazuh_agent_etc volume keeps the registration after the container is recreated, and after the first start the container ignores WAZUH_ENROLLMENT_TOKEN and WAZUH_MANAGER_SERVER. After docker compose up -d --force-recreate, my test agent came back with the same ID, and the token usage counter did not change.

Upgrade within 5.0.x

The procedure covers only moving to a later 5.0.x release, and the documentation does not cover 4.x deployments. You replace the images, and the data and configuration stay in the volumes. Do not rerun certificates-conf.sh or credentials-conf.sh.

This path does not cover moving from 5.0.0-rc1 to rc2. Release rc2 moves the manager configuration to /etc/wazuh-manager, and the upgrade guide says to deploy an rc1 stack again, with new volumes. I described the procedure in the article on moving to rc2.

  1. In the stack directory run docker compose down. Never with -v, because that removes the indexer data volumes.
  2. In docker-compose.yml, change the tag in the image field of each Wazuh service (wazuh/wazuh-manager, wazuh/wazuh-indexer, wazuh/wazuh-dashboard) to the tag of the new release. In multi-node that is six services: wazuh.master, wazuh.worker, three indexers and the dashboard.
  3. Run docker compose up -d, which pulls the new images.

If the new release also changes other lines of the compose files, the documentation says to take its files and reapply your own changes. The procedure does not require a backup, but make one before step one.

Custom images

You build images only when you need to add packages or configuration files. The sources are in wazuh-docker/build-docker-images/, one directory per image (wazuh-manager, wazuh-indexer, wazuh-dashboard, wazuh-agent). Each Dockerfile removes the passwords, CA and certificates created when the package was installed on the build host. Keep this step, otherwise containers from your image share the build host’s CA key.

You need Docker Engine with the Buildx plugin (the script calls docker buildx bake), git, curl and jq, and at least 20 GB of free space. Without jq the script ends with the error curl: (22) The requested URL returned error: 403. The build takes about 13 GB, of which about 5 GB is the four images.

cd wazuh-docker/build-docker-images
./build-images.sh -d rc2

The -d rc2 option tags the images 5.0.0-rc2, as the compose files of this release expect. Without it the tag is 5.0.0 and you must replace it in every image: line of the stack and agent compose files. Run only one variant, because a second build adds about 9 GB of cache.

OptionEffect
-c, --componentbuilds one component instead of four
-a, --artifact-urlsyour own package list instead of the downloaded one
-v, --versionversion in the X.Y.Z format, you build another one from a cloned tag
--skip-signature-checkonly with --dev, installs unsigned packages

The image installs a package only if it is signed with the Wazuh key. On every run the script downloads the package list to artifact_urls.yaml and overwrites the previous one.

If the host already runs a Wazuh deployment, do not create a second one from the same clone, because the stack directories use the same volume names. Change the tags in the existing deployment, or stop the second stack and set a different project name: echo COMPOSE_PROJECT_NAME=wazuh-custom > .env.

Removing the deployment

docker compose down keeps the volumes, and docker compose down -v deletes them permanently, together with any custom volumes you added to the volumes section. The generated files are removed with:

rm -rf wazuh-certificates/ wazuh-certificates-tool.log config.yml wazuh-certs-tool.sh config/*/certs config/credentials

If you keep the volumes, skip config/credentials: the volumes hold the passwords from those files, and the files are the only record. Delete the wazuh-ca/ directory only after removing the volumes, and only if no other deployment uses that CA. Images are removed with docker image rm using the tags from the compose file (multi-node also uses nginx:stable), and the cache from your own builds with docker builder prune -a.

You remove the agent container from the wazuh-docker/wazuh-agent directory with docker compose down -v, which deletes the wazuh_agent_etc volume with the registration. Then git checkout docker-compose.yml restores the file, which still contains the token.

What the documentation does not specify

The documentation does not describe upgrading a 4.x deployment in Docker, certificate rotation and renewal, using an external CA instead of the CA generated by the tool, container resource limits and JVM memory settings, a multi-node backup, or changes to tag names after the stable release.

Sources

↑↓ select Enter open Esc close