Wazuh Agent Deployment and Log Capture via Syslog
Monitoring strategies by LAN/DMZ/OT network segments, pfSense perimeter firewall rules, and agent installation and registration on Ubuntu Linux.
Once the central Wazuh cluster has been successfully deployed and secured using cryptographic hashes on the internal network (172.16.50.10), the Blue Team analyst's mission is to deploy sensors on all critical infrastructure servers and coordinate the receipt of alerts from the perimeter firewalls.
1. Topology and Monitoring Strategy
Sección titulada «1. Topología y Estrategia de Monitorización»To ensure 100% security visibility across the entire segmented corporate network, a custom event collection map is designed for each server:
| Destination Node / Server | Network Segment (VLAN) | Connection Method | Blue Team Analytical Mission |
|---|---|---|---|
servidor-web-demo | DMZ (172.16.20.x) | Wazuh Agent (Linux) | Monitoring of HTTP requests, detection of SQL injections (SQLi), XSS attacks, and SSH intrusions. |
servidor-db-demo | LAN (172.16.50.x) | Wazuh Agent (Linux) | Database integrity auditing, unauthorized access, and local privilege escalation attempts. |
servidor-hmi-industrial | OT Network (172.16.80.x) | Wazuh Agent (Linux) | Monitoring of the MQTT port and immediate alert upon any change or manipulation of sensor firmware. |
firewall-perimetral | Gateway | Native Syslog (UDP 514) | Inspection of denied connections, perimeter port scans, and VPN tunnel traces. |
2. Perimeter Firewall Policies (Firewall Rules)
Sección titulada «2. Directivas del Cortafuegos Perimetral (Firewall Rules)»Before initializing agents on the different machines, it is mandatory to enable the necessary inbound traffic rules in your corporate firewall (pfSense / OPNsense) to allow smooth connection of the sensors to the Wazuh Manager (172.16.50.10):
- TCP Port 1514: Main transmission channel. Logs, metadata, and encrypted alerts are sent through this port.
- TCP Port 1515: Auto-registration channel (Authd). Used only when registering a new agent to transmit the symmetric key.
- UDP Port 514: Network Syslog collection port (exclusive for network log receivers).
3. Agent Deployment on Ubuntu Server
Sección titulada «3. Despliegue de Agentes en Ubuntu Server»Complete the following steps on each of your Ubuntu servers (servidor-web-demo, servidor-db-demo, and servidor-hmi-industrial):
Step A: Official Package Download and Installation
Sección titulada «Paso A: Descarga e Instalación del Paquete Oficial»Connect to the target server via secure SSH channel and download the official Wazuh Debian installer in its certified version. Pass the Manager IP as an environment variable during installation to initialize the association:
# 1. Descargar el agente en su versión correspondientewget https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_4.9.0-1_amd64.deb
# 2. Instalar el paquete inyectando la IP ficticia de nuestro Managersudo WAZUH_MANAGER="172.16.50.10" WAZUH_AGENT_GROUP="default" dpkg -i ./wazuh-agent_4.9.0-1_amd64.debStep B: Daemon Registration and Startup
Sección titulada «Paso B: Registro y Arranque del Daemon»Reload Systemd service managers, initialize the agent, and configure it to start automatically with every reboot of the physical server:
sudo systemctl daemon-reloadsudo systemctl enable wazuh-agentsudo systemctl start wazuh-agentStep C: Agent Connection Audit
Sección titulada «Paso C: Auditoría de Conexión en el Agente»To validate that the agent has correctly linked and encrypted with the Manager, audit its service logs:
sudo tail -n 15 /var/ossec/logs/ossec.logIf the connection is successful, the trace will unequivocally show the messages:
Valid key created and Connected to server 172.16.50.10.
4. Firewall Integration (pfSense/OPNsense via Syslog)
Sección titulada «4. Integración del Firewall (pfSense/OPNsense via Syslog)»Since dedicated firewalls do not allow the installation of local agent packages, we will channel their monitoring by redirecting their log traffic remotely:
Configuration in the pfSense Web Panel:
Sección titulada «Configuración en el Panel Web de pfSense:»- Access the pfSense firewall web administration console.
- Navigate through the top menu: Status ➔ System Logs.
- Select the Settings tab.
- Locate the Remote Logging Options section.
- Enable the checkbox: Enable Remote Logging.
- Complete network parameters:
- Remote log servers:
172.16.50.10:514(dummy Manager IP and UDP Syslog listening port). - Remote Syslog Contents: Select “Everything” or specifically define “Firewall events”.
- Remote log servers:
- Click Save.
5. Next Milestone: File Integrity Monitoring (FIM)
Sección titulada «5. Próximo Hito: File Integrity Monitoring (FIM)»Once the agents are consolidated in the main Wazuh Dashboard, the Blue Team's next objective to harden the defense will consist of deploying and configuring the File Integrity Monitor (FIM).
This will allow for auditing suspicious changes at the live binary level. It will be configured by editing the /var/ossec/etc/ossec.conf file within the monitored agent during the next protection phase.

