What you will set up
Wazuh watches your servers for signs of attack and for weak settings. A small program on each server, the agent, reads its logs, notices changes to files and users, lists installed software, and checks the server's settings against the CIS benchmark, a public list of security recommendations. It sends everything to the Wazuh manager, which matches it against thousands of rules and raises an alert for failed logins, brute-force attempts, new users, changed system files and more. The alerts go into the Wazuh indexer, a search engine, and you read them in the Wazuh dashboard in your browser.
Wazuh is developed by Wazuh, Inc., a company in the United States, which sells support and a hosted version. It is open source: the manager and the agent under GPLv2, and the indexer and dashboard, which build on OpenSearch, under the Apache 2.0 licence.
Here the manager, indexer and dashboard run in a Compose project under a user of their own called siem, from Wazuh's official images, behind Caddy from the rootless Docker guide. The Docker setup follows that tested base; the app results below come from the tested Podman guide on a Melonslab server and were not re-measured under Docker. The agent runs as root on the server it watches, installed from Wazuh's package repository, because it needs to read the system's logs. In this guide the first agent goes on the same server, and the same commands enroll any other server.
The app-specific results below were recorded in the Podman test on a fresh Melonslab VC-P Titanium (4 vCPU, 16 GB) with Debian 13:
- Wazuh 4.14.7 started rootless, with its own passwords in place of the published defaults before it was put online. The default logins
adminwithSecretPasswordandkibanarowithkibanarowere refused. - An agent on the server enrolled with a password, over IPv6, and showed as active with Debian GNU/Linux 13.
- Failed SSH logins with an unknown user name gave the alert "sshd: Attempt to login using a non-existent user", and eight of them "sshd: brute force trying to get access to the system", level 10. Adding a user gave "New user added to the system". The CIS benchmark for Debian 13 ran by itself.
- An email channel sent a test message over STARTTLS with a password, and a monitor emailed every alert of level 10 or higher within five minutes.
- An update from Wazuh 4.14.7 to 4.14.8 kept the agent, the alerts and the email monitor. Wazuh was restored from a backup under a newly created user, the agent reconnected by itself, and everything came back by itself after a reboot.
In the Podman test, the pod used about 2.2 GB of memory: 1.6 GB for the indexer, 400 MB for the manager and 300 MB for the dashboard. On disk, the images take 4.5 GB, and the vulnerability database the manager downloads takes another 10 GB.
Wazuh can also run rootful, as root, which is how its own Docker instructions run it. It works rootless here without changes to the images, so this guide keeps it rootless like the other apps.
Before you start
You need:
- a server set up as in the rootless Docker guide, with Caddy running, and at least 8 GB of memory;
- an A record and an AAAA record for
wazuh.example.compointing at your server.
The examples use wazuh.example.com for Wazuh and web1 for the name of the server in Wazuh. Replace them throughout.
Agents connect to the server on ports 1514 and 1515. If you use ufw from the security guide, open them as root:
ufw allow 1514,1515/tcp
1. Create the user
As root:
apt install -y curl
useradd -m -s /bin/bash -U siem
loginctl enable-linger siem
Do not add the user to the docker group. The daemon is rootless and belongs to this user.
Everything up to step 7 runs as siem. The user is not called wazuh, because the agent in step 9 creates a system user with that name, which should stay separate from the one running the containers.
2. Create the certificates
The indexer, the manager and the dashboard talk to each other over TLS, with certificates from a small certificate authority of your own. Wazuh's certificate tool makes them:
mkdir -p /home/siem/wazuh/certs
cd /home/siem/wazuh
cat > certs.yml <<'EOF'
nodes:
indexer:
- name: wazuh.indexer
ip: wazuh.indexer
server:
- name: wazuh.manager
ip: wazuh.manager
dashboard:
- name: wazuh.dashboard
ip: wazuh.dashboard
EOF
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "docker run --rm -e CERT_TOOL_VERSION=4.14 -v ./certs.yml:/config/certs.yml -v ./certs:/certificates docker.io/wazuh/wazuh-certs-generator:0.0.4"
The names in certs.yml are the Compose service names in step 5. The tool prints find: command not found once, which does no harm, and ends with Setting UID for wazuh manager and worker. The certificate authority's key, root-ca.key, is in ~/wazuh/certs too; step 13 backs it up.
3. Create the passwords
As siem, write the four passwords to a private file:
umask 077
mkdir -p /home/siem/wazuh/secrets
{
printf 'INDEXER_PASSWORD=%s\n' "$(openssl rand -hex 16)"
printf 'DASHBOARD_PASSWORD=%s\n' "$(openssl rand -hex 16)"
printf 'API_PASSWORD=%sAa1.\n' "$(openssl rand -hex 16)"
printf 'ENROLLMENT_PASSWORD=%s\n' "$(openssl rand -hex 16)"
} > /home/siem/wazuh/secrets.env
chmod 600 /home/siem/wazuh/secrets.env
printf %s "$(sed -n 's/^ENROLLMENT_PASSWORD=//p' /home/siem/wazuh/secrets.env)" > /home/siem/wazuh/secrets/authd.pass
chmod 600 /home/siem/wazuh/secrets/authd.pass
They are, in turn: the password of admin, which you log in to the dashboard with; the dashboard's own password for the indexer; the password of wazuh-wui, the user the dashboard reaches the manager with, which must also contain a capital letter, a digit and a symbol, hence Aa1.; and the password agents need to enroll. Wazuh's own instructions ship fixed, published passwords for all of these; here every one is random and only readable by siem.
4. Write the configuration
Download the indexer's and the manager's configuration from Wazuh's repository, for the version you run:
mkdir -p /home/siem/wazuh/config
cd /home/siem/wazuh/config
base=https://raw.githubusercontent.com/wazuh/wazuh-docker/v4.14.8/single-node/config
curl -fsSLo wazuh.indexer.yml $base/wazuh_indexer/wazuh.indexer.yml
curl -fsSLo manager.conf $base/wazuh_cluster/wazuh_manager.conf
sed -i 's|<use_password>no</use_password>|<use_password>yes</use_password>|' manager.conf
sed -i 's|<port>151[45]</port>|&\n <ipv6>yes</ipv6>|' manager.conf
The two sed lines make agents give the enrollment password from step 3, and make the manager listen on IPv6 as well as IPv4. Without ipv6, agents that reach the server over IPv6, such as one on the server itself, fail with "Connection refused by the manager".
The indexer keeps its users in internal_users.yml, with each password stored as a hash. Make the hashes with the indexer's own tool, which reads the password from secrets.env:
cd /home/siem/wazuh
hash() {
pw=$(sed -n "s/^$1=//p" /home/siem/wazuh/secrets.env)
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
docker run --rm -e PW="$pw" -e JAVA_HOME=/usr/share/wazuh-indexer/jdk docker.io/wazuh/wazuh-indexer:4.14.8 bash plugins/opensearch-security/tools/hash.sh -env PW | tail -1
}
cat > config/internal_users.yml <<EOF
_meta:
type: "internalusers"
config_version: 2
admin:
hash: "$(hash INDEXER_PASSWORD)"
reserved: true
backend_roles:
- "admin"
kibanaserver:
hash: "$(hash DASHBOARD_PASSWORD)"
reserved: true
EOF
Wazuh's own file also has four demo users, among them kibanaro with the password kibanaro, who can read every alert. They are left out here.
Last, the dashboard's settings, /home/siem/wazuh/config/opensearch_dashboards.yml:
cat > /home/siem/wazuh/config/opensearch_dashboards.yml <<'EOF'
server.host: 0.0.0.0
server.port: 5601
opensearch.hosts: https://wazuh.indexer:9200
opensearch.ssl.verificationMode: certificate
opensearch.ssl.certificateAuthorities: ["/usr/share/wazuh-dashboard/certs/root-ca.pem"]
opensearch.requestHeadersAllowlist: ["securitytenant","Authorization"]
opensearch_security.multitenancy.enabled: false
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
opensearch_security.cookie.secure: true
uiSettings.overrides.defaultRoute: /app/wz-home
EOF
The dashboard serves plain HTTP inside the Compose network, and Caddy gives it HTTPS. cookie.secure makes the browser send the login cookie over HTTPS only.
5. Define the Compose services
As siem, create the Compose file:
cat > /home/siem/wazuh/compose.yaml <<'YAML'
services:
wazuh.indexer:
image: docker.io/wazuh/wazuh-indexer:4.14.8
env_file:
- ./secrets.env
environment:
OPENSEARCH_JAVA_OPTS: -Xms1g -Xmx1g
ulimits:
nofile:
soft: 65536
hard: 65536
volumes:
- ./data/indexer:/var/lib/wazuh-indexer
- ./config/wazuh.indexer.yml:/usr/share/wazuh-indexer/config/opensearch.yml:ro
- ./config/internal_users.yml:/usr/share/wazuh-indexer/config/opensearch-security/internal_users.yml:ro
- ./certs/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem:ro
- ./certs/wazuh.indexer.pem:/usr/share/wazuh-indexer/config/certs/wazuh.indexer.pem:ro
- ./certs/wazuh.indexer-key.pem:/usr/share/wazuh-indexer/config/certs/wazuh.indexer.key:ro
- ./certs/admin.pem:/usr/share/wazuh-indexer/config/certs/admin.pem:ro
- ./certs/admin-key.pem:/usr/share/wazuh-indexer/config/certs/admin-key.pem:ro
healthcheck:
test: ["CMD", "curl", "-sk", "-o", "/dev/null", "https://127.0.0.1:9200"]
interval: 10s
start_period: 2m
restart: always
wazuh.manager:
image: docker.io/wazuh/wazuh-manager:4.14.8
depends_on:
wazuh.indexer:
condition: service_healthy
env_file:
- ./secrets.env
environment:
INDEXER_URL: https://wazuh.indexer:9200
INDEXER_USERNAME: admin
FILEBEAT_SSL_VERIFICATION_MODE: full
SSL_CERTIFICATE_AUTHORITIES: /etc/ssl/root-ca.pem
SSL_CERTIFICATE: /etc/ssl/filebeat.pem
SSL_KEY: /etc/ssl/filebeat.key
API_USERNAME: wazuh-wui
secrets:
- source: enrollment
target: /var/ossec/etc/authd.pass
volumes:
- ./data/manager-etc:/var/ossec/etc
- ./data/manager-queue:/var/ossec/queue
- ./data/manager-logs:/var/ossec/logs
- ./data/manager-api:/var/ossec/api/configuration
- ./data/manager-multigroups:/var/ossec/var/multigroups
- ./data/manager-filebeat:/var/lib/filebeat
- ./config/manager.conf:/wazuh-config-mount/etc/ossec.conf:ro
- ./certs/root-ca-manager.pem:/etc/ssl/root-ca.pem:ro
- ./certs/wazuh.manager.pem:/etc/ssl/filebeat.pem:ro
- ./certs/wazuh.manager-key.pem:/etc/ssl/filebeat.key:ro
ports:
# Agents connect here: 1514 for their events, 1515 to enroll
- "1514:1514"
- "1515:1515"
restart: always
wazuh.dashboard:
image: docker.io/wazuh/wazuh-dashboard:4.14.8
depends_on:
wazuh.indexer:
condition: service_healthy
wazuh.manager:
condition: service_started
env_file:
- ./secrets.env
environment:
WAZUH_API_URL: https://wazuh.manager
API_USERNAME: wazuh-wui
DASHBOARD_USERNAME: kibanaserver
volumes:
- ./data/dashboard:/usr/share/wazuh-dashboard/data/wazuh/config
- ./config/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml:ro
- ./certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem:ro
ports:
# Only Caddy, on this server, can reach the dashboard: the port is not open to the internet.
- "127.0.0.1:8130:5601"
restart: always
secrets:
enrollment:
file: ./secrets/authd.pass
YAML
chown -R siem:siem /home/siem/wazuh
The three services reach each other by their service names, which are also the names in the certificates, and the indexer must be healthy before the manager and dashboard start. The indexer gets 1 GB of memory for its Java heap, which suits a handful of agents; raise both numbers for more. The manager's settings, its agents' keys and its rules are in ./data/manager-etc, and the alerts as files in ./data/manager-logs. The manager copies manager.conf over its ossec.conf each time it starts, so change the file in ~/wazuh/config, not inside the container. The enrollment password is mounted as the file the manager reads it from. The version is pinned: manager, indexer and dashboard must match, and agents must not be newer than the manager, so you update them together in step 14 rather than with the weekly timer.
6. Start it
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose pull && docker compose up -d"
The first pull downloads about 4.5 GB of images, and the dashboard is ready a minute or two after that. It is ready when this prints 200:
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8130/app/login
In the first hour, the manager also downloads its vulnerability database, about 10 GB on disk once unpacked.
7. Put Caddy in front
As root, add this block to the end of /home/caddy/Caddyfile:
wazuh.example.com {
reverse_proxy 127.0.0.1:8130
}
Restart Caddy:
uid=$(id -u caddy)
runuser -u caddy -- env HOME=/home/caddy XDG_RUNTIME_DIR=/run/user/$uid \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
bash -lc "export DOCKER_HOST=unix:///run/user/$uid/docker.sock; cd /home/caddy/caddy && docker compose restart caddy"
8. Log in
As siem, show the admin password:
sed -n 's/^INDEXER_PASSWORD=//p' /home/siem/wazuh/secrets.env
Open https://wazuh.example.com and log in as admin with that password. Keep it in your password manager. The first page, Overview, shows the agents and the alerts of the last 24 hours, and links to each part of Wazuh: Configuration Assessment, File Integrity Monitoring, Threat Hunting, Vulnerability Detection and more.
One agent is there from the start, wazuh (server). That is the manager watching itself, inside its container. To watch the server, it needs an agent of its own.
9. Enroll an agent
As siem, show the enrollment password:
sed -n 's/^ENROLLMENT_PASSWORD=//p' /home/siem/wazuh/secrets.env
Then, as root on the server you want to watch, this one or another, add Wazuh's package repository and install the agent, with the password in place of ENROLLMENT_PASSWORD:
curl -fsSLo /usr/share/keyrings/wazuh.asc https://packages.wazuh.com/key/GPG-KEY-WAZUH
echo "deb [signed-by=/usr/share/keyrings/wazuh.asc] https://packages.wazuh.com/4.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list
apt update
WAZUH_MANAGER=wazuh.example.com WAZUH_REGISTRATION_PASSWORD='ENROLLMENT_PASSWORD' WAZUH_AGENT_NAME=web1 apt install -y wazuh-agent=4.14.8-1
apt-mark hold wazuh-agent
systemctl daemon-reload
systemctl enable --now wazuh-agent
The variables go into the agent's configuration when the package installs: the manager's address, the password, which it keeps in /var/ossec/etc/authd.pass, and the name the server gets in Wazuh. apt-mark hold stops apt upgrade from installing an agent newer than your manager, which the manager would not accept.
The agent enrolls on port 1515 and then sends its events on port 1514, encrypted with the key it got. Within a minute, Agents management, Summary in the dashboard menu shows web1 as active, with its operating system. On the server, the agent's log says so too:
grep agentd /var/ossec/logs/ossec.log | tail -3
It ends with Connected to the server ([wazuh.example.com]:1514/tcp). For more servers, run the same commands on each, with a name of its own.
10. See the alerts
To see an alert arrive, try to log in over SSH to the server with a user that does not exist, from any computer:
ssh nosuchuser@wazuh.example.com
Each try gives the alert "sshd: Attempt to login using a non-existent user", level 5, and eight tries in a row give "sshd: brute force trying to get access to the system. Non existent user.", level 10. Wazuh's levels go from 0 to 15, and the dashboard counts 7 to 11 as medium, 12 to 14 as high and 15 as critical.
Open Threat Hunting and Events. Each alert shows the agent, the rule, its level and its ID, and opens with every detail, such as the address the logins came from. The search box takes queries such as rule.level >= 10.
In the first minutes, the agent also runs the CIS benchmark for Debian 13. Configuration Assessment lists each check that passed or failed, with the reason and how to fix it. A fresh Debian 13 scores around 45 %, mostly for logging rules it does not set up by default.
What else the agent watches by default:
- logins,
sudo, and new or deleted users and groups, from the system journal; - changes to files in
/etc,/bin,/sbin,/boot,/usr/binand/usr/sbin, checked every 12 hours, under File Integrity Monitoring; - installed packages, open ports and running processes, once an hour, which Vulnerability Detection compares with known security holes.
11. Email
Wazuh does not need email to work: without it you read the alerts in the dashboard. The manager's own email alerts cannot log in to a mail server, so they only work through a local mail relay, which this guide does not set up. Instead, the indexer's alerting can email you, and it logs in with a password over STARTTLS on port 587 or TLS on port 465.
As siem, put the SMTP password in /home/siem/wazuh/secrets.env and add the user name to the indexer's keystore, a file the indexer keeps secret settings in. mail is the name of the sender you create below, and alerts@example.com your account at your email provider:
printf 'SMTP_PASSWORD=%s\n' 'the-smtp-password' >> /home/siem/wazuh/secrets.env
pw=$(sed -n "s/^SMTP_PASSWORD=//p" /home/siem/wazuh/secrets.env)
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
docker run --rm -e PW="$pw" --user 0 -v /home/siem/wazuh/config:/conf -e OPENSEARCH_PATH_CONF=/conf --entrypoint bash docker.io/wazuh/wazuh-indexer:4.14.8 -c '
bin/opensearch-keystore create
echo alerts@example.com | bin/opensearch-keystore add --stdin opensearch.notifications.core.email.mail.username
printf %s "$PW" | bin/opensearch-keystore add --stdin opensearch.notifications.core.email.mail.password
chown 1000:1000 /conf/opensearch.keystore'
Add the keystore to the wazuh.indexer service in /home/siem/wazuh/compose.yaml, under the other volume lines, and restart:
- ./config/opensearch.keystore:/usr/share/wazuh-indexer/config/opensearch.keystore
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose up -d"
Then, in the dashboard, open the menu, Explore, Notifications:
- Under Email senders, choose Create SMTP sender. Enter
mailas Sender name, your address as Email address, your provider's SMTP server as Host,587as Port, and choose STARTTLS as Encryption method, or SSL/TLS for port 465. Choose Create. - Under Channels, choose Create channel. Give it a Name, such as
Security alerts, choose Email as Channel type,mailas SMTP sender, and your own address under Default recipients. Send test message sends a test email. Choose Create.
The channel does nothing until something uses it. To get an email for every alert of level 10 or higher, create a monitor that searches for them every five minutes. As siem, find the channel's ID, the config_id of the channel you named:
docker compose exec -T wazuh.indexer curl -sk --cert config/certs/admin.pem --key config/certs/admin-key.pem \
'https://127.0.0.1:9200/_plugins/_notifications/configs?config_type=email'; echo
Save this as ~/wazuh/monitor.json, with the ID in place of CHANNEL_ID:
{
"type": "monitor",
"monitor_type": "query_level_monitor",
"name": "Wazuh alerts of level 10 or higher",
"enabled": true,
"schedule": { "period": { "interval": 5, "unit": "MINUTES" } },
"inputs": [{ "search": {
"indices": ["wazuh-alerts-*"],
"query": {
"size": 10,
"_source": ["agent.name", "rule.level", "rule.description"],
"query": { "bool": { "filter": [
{ "range": { "rule.level": { "gte": 10 } } },
{ "range": { "timestamp": { "gte": "{{period_end}}||-5m", "lte": "{{period_end}}", "format": "epoch_millis" } } }
] } }
}
} }],
"triggers": [{ "query_level_trigger": {
"name": "Level 10 or higher",
"severity": "1",
"condition": { "script": { "source": "ctx.results[0].hits.total.value > 0", "lang": "painless" } },
"actions": [{
"name": "Email",
"destination_id": "CHANNEL_ID",
"subject_template": { "source": "Wazuh: {{ctx.results.0.hits.total.value}} alerts of level 10 or higher" },
"message_template": { "source": "{{#ctx.results.0.hits.hits}}{{_source.agent.name}}: {{_source.rule.description}} (level {{_source.rule.level}})\n{{/ctx.results.0.hits.hits}}" }
}]
} }]
}
And create the monitor:
docker compose exec -T wazuh.indexer curl -sk --cert config/certs/admin.pem --key config/certs/admin-key.pem \
-H 'Content-Type: application/json' -X POST https://127.0.0.1:9200/_plugins/_alerting/monitors --data-binary @- < ~/wazuh/monitor.json; echo
The admin certificate from step 2 lets these commands in without a password. The monitor shows under Explore, Alerting, where you can change it. After eight failed SSH logins, as in step 10, an email arrived within five minutes with the subject "Wazuh: 1 alerts of level 10 or higher" and the line web1: sshd: brute force trying to get access to the system. Non existent user. (level 10). We tested with a test mail server on the same server, not with an email provider.
12. Outside connections
In our tests, the server made two kinds of outside connections, both from the manager:
- to
cti.wazuh.com, Wazuh's threat intelligence service, for the vulnerability database and for news of new Wazuh versions, which the dashboard shows; - to
cdn.amazonlinux.com, right after the vulnerability scanner started. The manager's image is built on Amazon Linux.
The agents connect only to your manager.
13. Back up
As siem:
umask 077
mkdir -p /home/siem/backup
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose stop"
tar -C /home/siem/wazuh -cf /home/siem/backup/wazuh-volumes.tar \
--exclude='data/indexer/vd' --exclude='data/indexer/vd_updater' data
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose up -d"
tar -C /home/siem -cf /home/siem/backup/wazuh-files.tar wazuh
That saves all the data directories, which hold the agents' keys, the alerts, the settings and the email monitor, plus the certificates, the configuration, the Compose file and the passwords. The vulnerability database is left out, as the manager downloads it again. Wazuh is stopped for about a minute while the data is copied; agents keep their events meanwhile and send them when it is back. tar lists the sockets it skips, which Wazuh makes again when it starts. Copy /home/siem/backup to another machine, for example with restic, and keep it safe: it holds every password, the certificate authority's key and the history of your servers.
To restore, as siem, with the backup in /home/siem/backup:
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose down"
tar -C /home/siem -xpf /home/siem/backup/wazuh-files.tar
tar -C /home/siem/wazuh -xpf /home/siem/backup/wazuh-volumes.tar
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && docker compose up -d"
On a new server, first create the user as in step 1, then unpack wazuh-files.tar into /home/siem and run the two tar commands above. The agents keep working with the restored manager, as their keys are in the backup.
14. Update
Wazuh announces new versions on its blog and in the dashboard. Read the release notes, back up as in step 13, and change the version in the three image lines, here from 4.14.8 to 4.14.9. As siem:
uid=$(id -u siem)
runuser -u siem -- env HOME=/home/siem XDG_RUNTIME_DIR=/run/user/$uid \
DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
bash -lc "cd /home/siem/wazuh && sed -i 's/:4\.14\.8$/:4.14.9/' compose.yaml && docker compose pull && docker compose up -d"
Then update the agent on each server, as root:
apt-mark unhold wazuh-agent
apt update
apt install -y wazuh-agent=4.14.9-1
apt-mark hold wazuh-agent
When a new major version such as 5.0 comes out, read its upgrade guide first: it can change the configuration files from step 4.
Troubleshooting
The agent's log says "Connection refused by the manager". The <ipv6>yes</ipv6> lines from step 4 are missing from manager.conf, and the agent reaches the server over IPv6. Add them and restart the manager with docker compose restart wazuh.manager.
The agent's log says "Invalid password" or the enrollment fails. The password in WAZUH_REGISTRATION_PASSWORD differs from ENROLLMENT_PASSWORD in /home/siem/wazuh/secrets.env. Put the right one in /var/ossec/etc/authd.pass on the agent and run systemctl restart wazuh-agent.
https://wazuh.example.com answers with an empty page and error 502. The dashboard is not running. The manager and dashboard need the indexer, so they stop when it stops or fails. Check with docker compose ps, read docker compose logs wazuh.indexer, fix the cause and restart with docker compose up -d.
The indexer does not start after step 11, with AccessDeniedException on opensearch.keystore. The chown at the end of the keystore command is missing. Run it again as in step 11.
cat or cp says "Permission denied" for the files in ~/wazuh/certs. The certificate tool may have created them as users inside the container. Run the command as siem, or use docker run with a bind mount to read them.
Compose says permission denied. Run it as siem from /home/siem/wazuh, with DOCKER_HOST pointing at the user's socket.