Ir al contenido

Wazuh Architecture and Deployment with Docker Compose

Modular deployment guide for Wazuh 4.9 in Docker containers, complex alphanumeric credential assignment, and security port routing map.

0views

This guide details the standard technical procedure for the deployment of Wazuh 4.9 in a single-node Dockerized environment (single-node). This module covers resource planning, host environment preparation, docker-compose.yml file structuring, and security network routing architecture.


To avoid parsing errors during container initialization by the Docker engine (such as the incorrect interpretation of special characters like $ or * in YAML files) and to strictly comply with Wazuh security directives, a high-entropy alphanumeric credential matrix has been defined for the core services:

Component / ServiceIdentity / UserExample Dummy PasswordIntegration Notes
Wazuh Interface (Indexer)adminzR9mK2vX5pW8qN3tY6cR4vB1Primary web administration access account.
Wazuh Internal APIwazuh-wuimP5nT8qB2vK9wR3xY6cS4dB9.Must end with a period . to comply with symbol directives.
Communication ServicekibanaserveryQ3wV8xR9pK2mN6tT5sR4vC1Account used for internal communication between nodes.

The complete deployment will be consolidated under the host directory: /opt/wazuh-stack/single-node.

Wazuh requires SSL/TLS certificates to provide end-to-end encryption for communications between its three main containers (Indexer, Manager, and Dashboard). Access your host console and clone the exact certified version (v4.9.0):

Ventana de terminal
# 1. Crear el directorio y clonar el repositorio oficial de despliegue
sudo mkdir -p /opt/wazuh-stack
sudo chown -R $USER:$USER /opt/wazuh-stack
git clone https://github.com/wazuh/wazuh-docker.git -b v4.9.0 /opt/wazuh-stack
# 2. Posicionarse en el directorio del nodo único
cd /opt/wazuh-stack/single-node

B. Generation of the Certificate Authority and TLS Certificates

Sección titulada «B. Generación de la Autoridad de Certificación y Certificados TLS»

Initialize the temporary generator container to automatically provision the Public Key Infrastructure (PKI) and the digital signatures of the services:

Ventana de terminal
sudo docker compose -f generate-indexer-certs.yml run --rm generator

This file contains the final service declaration, optimized kernel memory limits, and the initial static credentials of the environment.

File path: /opt/wazuh-stack/single-node/docker-compose.yml

# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
services:
wazuh.manager:
image: wazuh/wazuh-manager:4.9.0
hostname: wazuh.manager
restart: always
ports:
- "1514:1514"
- "1515:1515"
- "514:514/udp"
- "55000:55000"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 655360
hard: 655360
environment:
- INDEXER_URL=https://wazuh.indexer:9200
- INDEXER_USERNAME=admin
- INDEXER_PASSWORD=zR9mK2vX5pW8qN3tY6cR4vB1
- 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
- API_PASSWORD=mP5nT8qB2vK9wR3xY6cS4dB9.
- TZ=Europe/Madrid
volumes:
- wazuh_api_configuration:/var/ossec/api/configuration
- wazuh_etc:/var/ossec/etc
- wazuh_logs:/var/ossec/logs
- wazuh_queue:/var/ossec/queue
- wazuh_var_multigroups:/var/ossec/var/multigroups
- wazuh_integrations:/var/ossec/integrations
- wazuh_active_response:/var/ossec/active-response/bin
- wazuh_agentless:/var/ossec/agentless
- wazuh_wodles:/var/ossec/wodles
- filebeat_etc:/etc/filebeat
- filebeat_var:/var/lib/filebeat
- ./config/wazuh_indexer_ssl_certs/root-ca-manager.pem:/etc/ssl/root-ca.pem
- ./config/wazuh_indexer_ssl_certs/wazuh.manager.pem:/etc/ssl/filebeat.pem
- ./config/wazuh_indexer_ssl_certs/wazuh.manager-key.pem:/etc/ssl/filebeat.key
- ./config/wazuh_cluster/wazuh_manager.conf:/wazuh-config-mount/etc/ossec.conf
wazuh.indexer:
image: wazuh/wazuh-indexer:4.9.0
hostname: wazuh.indexer
restart: always
ports:
- "9200:9200"
environment:
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- TZ=Europe/Madrid
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- wazuh-indexer-data:/var/lib/wazuh-indexer
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
- ./config/wazuh_indexer_ssl_certs/wazuh.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh.indexer.key
- ./config/wazuh_indexer_ssl_certs/wazuh.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh.indexer.pem
- ./config/wazuh_indexer_ssl_certs/admin.pem:/usr/share/wazuh-indexer/certs/admin.pem
- ./config/wazuh_indexer_ssl_certs/admin-key.pem:/usr/share/wazuh-indexer/certs/admin-key.pem
- ./config/wazuh_indexer/wazuh.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
- ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
wazuh.dashboard:
image: wazuh/wazuh-dashboard:4.9.0
hostname: wazuh.dashboard
restart: always
ports:
- "443:5601"
environment:
- INDEXER_USERNAME=admin
- INDEXER_PASSWORD=zR9mK2vX5pW8qN3tY6cR4vB1
- WAZUH_API_URL=https://wazuh.manager
- DASHBOARD_USERNAME=kibanaserver
- DASHBOARD_PASSWORD=yQ3wV8xR9pK2mN6tT5sR4vC1
- API_USERNAME=wazuh-wui
- API_PASSWORD=mP5nT8qB2vK9wR3xY6cS4dB9.
- TZ=Europe/Madrid
volumes:
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard.pem
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem
- ./config/wazuh_dashboard/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml
- ./config/wazuh_dashboard/wazuh.yml:/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
depends_on:
- wazuh.indexer
links:
- wazuh.indexer:wazuh.indexer
- wazuh.manager:wazuh.manager
networks:
default:
name: wazuh_local
volumes:
wazuh_api_configuration:
wazuh_etc:
wazuh_logs:
wazuh_queue:
wazuh_var_multigroups:
wazuh_integrations:
wazuh_active_response:
wazuh_agentless:
wazuh_wodles:
filebeat_etc:
filebeat_var:
wazuh-indexer-data:
wazuh-dashboard-config:
wazuh-dashboard-custom:

To allow Blue Team analysts to correctly configure perimeter filtering rules (such as pfSense firewalls or host policies), the technical function of the mapped ports is detailed below:

  • 1514 (TCP/UDP) - Agents: Critical communication port. Remote collector agents send their decrypted logs and real-time metadata through here.
  • 1515 (TCP) - Authd: Agent registration service port. It is used exclusively when pairing a new node to generate and transmit the symmetric encryption key.
  • 514 (UDP) - Syslog: Optional service for collecting network logs from devices that do not support native agents (such as routers, pfSense firewalls, and switches).
  • 55000 (TCP) - REST API: Manager control interface. It is consumed by the Dashboard to process internal administration queries.
  • 9200 (TCP) - OpenSearch API: Read/write port for the indexing database. Filebeat feeds alerts here and the Dashboard retrieves them to display them in charts.
  • 443 ➔ 5601 (TCP) - HTTPS Portal: The internal service uses port 5601, but it is mapped in Docker to the standard port 443 (HTTPS) on the host to allow clean and direct access from the browser without specifying non-standard ports.

Once the docker-compose.yml file is structured, launch the infrastructure in the background:

Ventana de terminal
sudo docker compose up -d

Security Warning

Even if the containers initialize correctly in the Docker engine, the suite will not be functional or secure until the encrypted hashes detailed in the following document are generated and injected.