2203 words
11 minutes
Wazuh 101 - Part 1: Building a Home Lab
2026-08-11
2026-08-15

My Journey Learning Wazuh#

I’ve been learning from a lot of different sources, and I finally decided to spend some real time digging into the Wazuh platform, to reinforce and expand my knowledge of this powerful detection tool.

A Quick Word About Wazuh#

Wazuh is a completely free, open-source security platform that combines two core technologies: SIEM (Security Information and Event Management) and XDR (Extended Detection and Response). It’s designed to provide deep visibility into infrastructure security, delivering comprehensive protection for systems ranging from on-premises and virtualized to containerized and cloud environments.

In fact, Wazuh is forked from the well-known OSSEC project. OSSEC gives us great foundational capabilities like log management, file integrity monitoring (FIM), rootkit detection, real-time alerting, and solid compliance support. But Wazuh doesn’t stop there — it has built on top of that foundation with a whole set of valuable extra capabilities, such as:

  • Vulnerability detection.
  • Security configuration assessment (SCA).
  • Cloud and container security monitoring.
  • A highly intuitive, comprehensive dashboard.
  • Regulatory compliance reporting.

Like any other HIDS (Host-based Intrusion Detection System), I’ve found Wazuh to be a genuinely powerful, indispensable ally for engineers working in a SOC role.

The 4 Core Components of Wazuh#

Wazuh runs on a centralized server-agent model, combined with indexing and data-visualization layers. For the architecture to run smoothly, it’s made up of 4 main components:

  1. Wazuh Agent: This is an extremely lightweight, cross-platform piece of software installed directly on endpoints such as servers, workstations, or containers. Its job is to collect telemetry, activity logs, and behavioral data from the system and send it back to the central analysis engine.
  2. Wazuh Server (Manager): Acts as the central processing engine of the whole system. This component receives the continuous stream of data sent from the Agents, runs it through decoders and rulesets to analyze events in real time, correlates threats, and generates alerts whenever it detects anomalies.
  3. Wazuh Indexer: A highly scalable full-text search and analytics engine built on top of OpenSearch. Its job is to index and securely store all the log data and security alerts forwarded by the Server.
  4. Wazuh Dashboard: The web interface for end users. I mainly use this component for threat hunting, viewing visual charts, managing system configuration, and reviewing compliance reports.

The Data Flow: From Agent to Dashboard#

To really get a handle on Wazuh, I broke down how a security event travels through the system. The process, from the moment the Agent captures data to the moment it turns into an Alert on my screen, happens in 4 continuous steps:

  1. Collection (Agent): The Wazuh Agent sitting on the victim machine continuously monitors activity, records every change, packages up the event logs, and sends them to the Server.
  2. Analysis (Server): When the Wazuh Server receives this log stream, it cross-references it against security rules to determine whether the behavior is normal or an attack. If it finds anything suspicious, the Server immediately generates an Alert.
  3. Storage (Indexer): Every log and Alert just generated is immediately pushed into the Wazuh Indexer. Here, the data gets indexed and categorized for secure storage, ready to be retrieved at high speed.
  4. Visualization (Dashboard): Finally, when I open the Wazuh Dashboard, the interface queries the data from the Indexer and visualizes it as alert charts. From there, I can easily analyze the threat and respond in a timely manner.

Here I’ll Be Building 4 Virtual Machines, Including#

  • VM1 - Wazuh (Ubuntu): This is where the agents’ logs land so they can be visualized on the dashboard.
  • VM2 - Victim 1 (Ubuntu Live Server): Installs the Wazuh Agent, collects system logs (auth.log), and Active Response.
  • VM3 - Victim 2 (Windows): Installs Sysmon and the Wazuh Agent to collect in-depth Windows logs.
  • VM4 - Attacker (Ubuntu): The machine used to run attack flows (brute force, scanning, etc.).
  • VM5 - pfSense (Router / Firewall): The central routing gateway, managing lab network connections, DHCP IP allocation, and forwarding firewall logs to the Wazuh Server.

Lab Topology#

alt text

VM 1 - Wazuh#

I started by building the Wazuh system first, then worked my way down through pfSense -> victim -> attacker. I read through the official Wazuh documentation so I could download and configure the components the way I wanted. There are two options here: downloading the .ova file or deploying on Docker. I went with Docker here, partly because I’m leaning toward DevSecOps and wanted to get more familiar with it while I’m still starting out.

alt text

After reading through the preparation steps for the download, I got to work. There are two types of deployment models here:

  • Single-node Stack
  • Multi-node Stack

Put simply, one is an All-In-One model, while the other is meant for Enterprise use. For a light lab setup suited to a student like me, Single-node is definitely the optimal choice.

I went over the sizing recommendations to figure out how to allocate resources for the VM.

alt text

A setup note: set max_map_count = 262144 first to avoid system errors.

alt text

By default, max_map_count is usually set to 65530, but the Wazuh indexer requires a higher number of VMAs than that, so raising this limit to 262144 is mandatory to avoid the application crashing or failing to start. You can check the max_map_count docs for more detail on this parameter.

Use the command sudo sysctl -w vm.max_map_count=262144 to raise it. Then run sudo sysctl -p to apply the change immediately.

alt text

Next, add the user to the Docker group so you don’t have to prefix every Docker command with sudo

usermod -aG docker <USER>

Then apply this change with the command newgrp docker. I ran into an issue where this command said it didn’t exist. Guessing it was because I was missing the package providing this command, I looked into it a bit more and realized I was missing a Linux utility, so I just needed to install it: sudo apt install util-linux-extra. Done! Now it’s just a matter of installing Docker and deploying:

1. Install Supporting Tools and Docker’s GPG Key:#

sudo apt update
sudo apt install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

alt text

2. Add the Docker Debian Repo to the Sources List:#

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  bookworm stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

alt text

3. Update the Package List and Install:#

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

alt text

After Docker was installed, I checked whether it was running with docker compose ps. If it wasn’t, I used sudo systemctl start docker and sudo systemctl enable docker, then checked again.

alt text

Next, Clone the Wazuh Repo#

git clone https://github.com/wazuh/wazuh-docker.git -b v4.9.0

If you want the latest version, you can fetch the latest tags and use git checkout <VERSION> to pick whichever version you want. Since I’m just doing a LAB here, 4.9.0 is more than enough.

Once it’s downloaded, go into the ~/wazuh-docker/single-node directory (this is where the indexer, server, and dashboard live) and start up the Wazuh system with docker compose up -d.

Once it started up, I ran into another error here.

alt text

I realized I’d skipped the step of generating certs for it after going back to the Wazuh docs. There are 2 types of certs here:

  • Wazuh self-signed certificates: For anyone wanting to set up a lab/test Wazuh environment, since this gives you a tool to generate your own free encryption key pair on your own machine, so when you access it via the web you’ll usually see a security warning (you can click advanced and continue through without any issue).
  • Your own certificates: These are certificates meant for enterprise environments, which can only be purchased from providers like DigiCert, Sectigo, or issued from the company’s own internal CA server.

alt text

So now I need to generate this SSL certificate set inside the single-node directory with the following commands:

docker compose down <--- (Important step)
docker compose -f generate-indexer-certs.yml run --rm generator

alt text Just wait for it to finish generating, then you can re-run docker to check it.

If you accidentally ran the generate-cert command while Docker was still up, you need to delete the config/wazuh_indexer_ssl_certs directory and regenerate it — if you just try to stop Docker and regenerate instead, you’ll hit a directory already exists so it can't be overwritten error. I’m including these commands here to save you the time I lost.

alt text

After Docker runs successfully, when you access the web page at https://<IP_MAY_BAN> you’ll see the following warning: alt text Don’t worry — as I mentioned before, generating the cert set yourself with the tool will trigger this. Just continue through and you’re in. Here’s what the interface looks like once you’re in. alt text

Log in with the account from the docker-compose.yml file

  • username: admin
  • password: SecretPassword alt text If the password is wrong, check it again with:
grep -i "INDEXER_PASSWORD" docker-compose.yml

alt text

Once you’ve logged in successfully, change the password to prevent unwanted access.

Stop Docker and Generate a New Password Hash:#

alt text

Open the config/wazuh_indexer/internal_users.yml file and Replace it with the New Hash, Then Save.#

alt text

Next, Apply the New Changes#

After updating the docker-compose.yml file, run Docker and find the name of the Wazuh indexer container with docker ps. Then exec into that container with docker exec -it <WAZUH_INDEXER_CONTAINER_NAME> bash. Once inside, paste the following:

export INSTALLATION_DIR=/usr/share/wazuh-indexer
export CONFIG_DIR=$INSTALLATION_DIR/config
CACERT=$CONFIG_DIR/certs/root-ca.pem
KEY=$CONFIG_DIR/certs/admin-key.pem
CERT=$CONFIG_DIR/certs/admin.pem
export JAVA_HOME=/usr/share/wazuh-indexer/jdk

Once it finishes starting up, run the following script to apply the changes

bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -cd $CONFIG_DIR/opensearch-security/ -nhnv -cacert  $CACERT -cert $CERT -key $KEY -p 9200 -icl

That wraps up the Wazuh installation process. Next up is the Victim.

VM2 - Victim (Ubuntu Live Server)#

I deliberately chose Ubuntu Server to save as much memory on my machine as possible while still meeting the requirements.

1. Create the Ubuntu Server VM.#

Machine specs:

Memory: 4GB
Processors: 2
Hard Disk: 20GB

alt text

2. Choose the Matching Agent Configuration on VM1’s Wazuh Dashboard.#

Select DEB amd64 since it’s the best match for this Ubuntu build. alt text

Enter the server IP (the IP of the machine running Wazuh), then set a name for the agent (this name stays fixed per machine so that when an alert comes in, you know exactly which machine generated it).

alt text

Once you’ve selected and entered that information, the dashboard generates a script you can paste into VM2 so it automatically downloads the necessary files and connects straight to the Server.

alt text

I just copy and paste it into the terminal of the VM2 I just created, so it downloads the agent onto the machine.

alt text

Finally, start the agent.

alt text

Back on the dashboard, I check whether the agent has connected. The status is now active. Done!

alt text

VM3 - Victim (Windows)#

I went to Microsoft’s site to download MediaCreationTool_22H2.exe so I could create the .iso file. Then I configured everything with higher specs than the Ubuntu box to avoid crashing during installation, since Windows is still fairly heavy and memory-hungry.

alt text

Then I powered on the VM and started the install. This process takes a fair amount of time, so I’ll skip over it.

alt text

If you run into an OOBE-related error once the install finishes, you can check out this OOBE fix. Once the basic steps were done, I installed VMware Tools, since that’s always the first thing I do after installing Windows — it makes the machine run a lot smoother and makes it much easier to copy files from the host machine and paste them in.

alt text

Once everything was done, I took a new snapshot so that later on I could rollback or clone this machine without running into the same installation errors again.

VM4 - Attacker#

For the attacker box, I’d recommend using the Kali Linux distro, since it already comes with pentest tools built in — scanning, vuln discovery, brute-forcing, and so on.

VM5 - Pfsense#

I downloaded the .iso file from pfSense’s official site and created a dedicated VM for it.

alt text

Before powering on the machine, bump the memory up to around 2GB and set processors to 2 to avoid crashes during installation. I usually just click next repeatedly, so by default the machine ends up with only 256MB of memory, which causes the install to keep failing. Also add another LAN network adapter so you end up with both a WAN and a LAN port for the lab. The remaining machines will all connect to pfSense’s LAN first, then reach the outside world through pfSense’s WAN port, so it can control all inbound and outbound traffic in order to:

  • Write Firewall Rules to block or allow machines in the lab to communicate with each other or reach the Internet.
  • Monitor, log, or capture packets (Packet Capture) for security research purposes.

alt text

Before installing pfSense, you need to identify which interface is WAN and which is LAN, since during installation you need to pick the correct WAN to download the file. Usually eM0 is WAN and eM1 is LAN. To figure out which is which, you can go into Edit -> Network Adapter -> Advanced Setting to check.

alt text

Once the install finishes, move on to configuring the LAN network. Since both LAN and WAN default to 192.168.x.x, configuring the LAN is worth doing. I set the IPv4 to 10.0.1.1 for pfSense to make it easy to identify, and set the DHCP range from 10.0.1.<100-200> for Wazuh and the rest of the VMs. Finally, select Yes for DHCP so that pfSense can hand out addresses to machines later on when they join its LAN.

alt text

The result after configuration:

alt text

That wraps up the basic configuration. I’ll post the rest of the process for integrating Sysmon + VirusTotal + Suricata into Wazuh over this weekend. Thanks for reading.#

Wazuh 101 - Part 1: Building a Home Lab
https://stewmalwarehunter.id.vn/posts/wazuh-learning-part-1-wazuh-en/
Author
Stew
Published at
2026-08-11
License
CC BY-NC-SA 4.0