{"id":1203,"date":"2026-10-11T03:13:11","date_gmt":"2026-10-11T03:13:11","guid":{"rendered":"https:\/\/www.devopsschool.com\/tutorials\/?p=1203"},"modified":"2026-10-11T03:20:21","modified_gmt":"2026-10-11T03:20:21","slug":"wazuh-the-complete-tutorial","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/tutorials\/wazuh-the-complete-tutorial\/","title":{"rendered":"Wazuh: The Complete Tutorial"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Wazuh: The Complete Gold-Standard Tutorial<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Zero to Intermediate | Theory + Hands-on Labs + Real-World Security Monitoring<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Stable version:<\/strong>&nbsp;4.14.8<br><strong>Level:<\/strong>&nbsp;Beginner \u2192 Intermediate<br><strong>Last verified:<\/strong>&nbsp;11 October 2026<br><strong>Primary lab OS:<\/strong>&nbsp;Ubuntu 24.04 LTS<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This course teaches you how to use Wazuh from scratch, including deployment, endpoint monitoring, threat detection, vulnerability assessment, incident investigation, and security automation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tutorials are built around a single working lab, so you progressively develop a functional security monitoring environment rather than completing unrelated demonstrations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Version verification: Wazuh 4.14.8 was released on September 23, 2026, and is the latest stable release verified in the official release listings. Wazuh 5.0 remains in beta, so this guide uses the stable 4.x architecture and commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Learning plan and tutorial sequence<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Total study plan<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Total:<\/strong>&nbsp;180 minutes<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Theory target<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Theory:<\/strong>&nbsp;55 minutes<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Practical target<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Practical:<\/strong>&nbsp;125 minutes<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">#<\/th><th class=\"has-text-align-left\" data-align=\"left\">Tutorial<\/th><th class=\"has-text-align-left\" data-align=\"left\">Duration<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Introduction to Wazuh<\/td><td>10 min<\/td><\/tr><tr><td>2<\/td><td>Security and Log Monitoring Fundamentals<\/td><td>10 min<\/td><\/tr><tr><td>3<\/td><td>Wazuh Architecture and Working<\/td><td>15 min<\/td><\/tr><tr><td>4<\/td><td>Wazuh Installation and Setup<\/td><td>25 min<\/td><\/tr><tr><td>5<\/td><td>Wazuh Agent Installation and Management<\/td><td>15 min<\/td><\/tr><tr><td>6<\/td><td>Log Collection, Monitoring, and Alerts<\/td><td>20 min<\/td><\/tr><tr><td>7<\/td><td>Wazuh Rules, Decoders, and Detection Engineering<\/td><td>20 min<\/td><\/tr><tr><td>8<\/td><td>File Integrity Monitoring (FIM)<\/td><td>15 min<\/td><\/tr><tr><td>9<\/td><td>Security Configuration Assessment and Vulnerability Detection<\/td><td>20 min<\/td><\/tr><tr><td>10<\/td><td>Threat Hunting and Security Investigation<\/td><td>10 min<\/td><\/tr><tr><td>11<\/td><td>Active Response and Security Integrations<\/td><td>15 min<\/td><\/tr><tr><td>12<\/td><td>End-to-End Security Monitoring Mini Lab<\/td><td>5 min<\/td><\/tr><tr><td><\/td><td>Total<\/td><td>180 min<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The 3-hour schedule is an accelerated practical lesson. Completing every optional cross-platform installation, deeper exercise, and troubleshooting scenario in this reference guide will require additional study time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Lab prerequisites<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Requirement<\/th><th class=\"has-text-align-left\" data-align=\"left\">Recommended setup<\/th><\/tr><\/thead><tbody><tr><td>Wazuh server<\/td><td>Ubuntu 24.04 LTS VM<\/td><\/tr><tr><td>Server resources<\/td><td>4 vCPU, 8 GiB RAM, 50 GB storage<\/td><\/tr><tr><td>Monitored endpoint<\/td><td>A second Ubuntu VM<\/td><\/tr><tr><td>Optional endpoints<\/td><td>Windows 11 and macOS<\/td><\/tr><tr><td>Connectivity<\/td><td>Private network between server and agents<\/td><\/tr><tr><td>Access<\/td><td>Administrator or&nbsp;<code>sudo<\/code>&nbsp;privileges<\/td><\/tr><tr><td>Basic utilities<\/td><td>SSH client, Bash, curl, text editor<\/td><\/tr><tr><td>Browser<\/td><td>Modern browser supporting HTTPS<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh officially recommends the server resources shown above for its all-in-one quickstart deployment with 1\u201325 agents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For consistency, the tutorials use these example addresses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Wazuh server:\u00a0<code>192.168.56.10<\/code><\/li>\n\n\n\n<li>Ubuntu monitored endpoint:\u00a0<code>192.168.56.20<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These are example private network addresses, not addresses discovered on your equipment. Replace them with your actual lab addresses.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 1 \u2014 Introduction to Wazuh<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">10 minutes | Fundamentals<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.1 What is Wazuh?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh is an open-source security monitoring platform combining two important security disciplines:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SIEM \u2014 Security Information and Event Management<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Collects, analyzes, stores, and correlates security events from multiple systems, helping security teams identify suspicious activity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">XDR \u2014 Extended Detection and Response<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Combines security telemetry from different environments to help detect, investigate, and respond to potential threats.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, imagine an organization has 100 Linux servers, 50 Windows systems, and multiple cloud workloads. Without a centralized security monitoring system, administrators would need to inspect different machines and logs separately.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh provides a central location to understand what is happening.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.2 Why is Wazuh needed?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Consider this scenario:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An attacker attempts to access a Linux server using SSH.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The server may record unsuccessful authentication attempts in system logs, but an administrator might not notice those entries immediately.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh can collect authentication events, analyze them against predefined security rules, and create alerts for suspicious authentication activity.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TD\n    A&#91;\"Suspicious activity on endpoint\"] --&gt; B&#91;\"Security event generated\"]\n    B --&gt; C&#91;\"Wazuh agent collects event\"]\n    C --&gt; D&#91;\"Wazuh server analyzes event\"]\n    D --&gt; E{\"Detection rule matched?\"}\n    E --&gt;|Yes| F&#91;\"Generate security alert\"]\n    E --&gt;|No| G&#91;\"No alert from this rule\"]\n    F --&gt; H&#91;\"Investigate in dashboard\"]\n    H --&gt; I&#91;\"Decide on response\"]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Notice that Wazuh does not automatically prevent every threat. Detection depends on available telemetry, enabled monitoring capabilities, rules, configuration, and any response mechanisms you deliberately configure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.3 Main features of Wazuh<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Feature<\/th><th class=\"has-text-align-left\" data-align=\"left\">Purpose<\/th><th class=\"has-text-align-left\" data-align=\"left\">Example<\/th><\/tr><\/thead><tbody><tr><td>Log analysis<\/td><td>Identify suspicious events<\/td><td>Failed SSH logins<\/td><\/tr><tr><td>File Integrity Monitoring<\/td><td>Detect file changes<\/td><td>Modified application configuration<\/td><\/tr><tr><td>Vulnerability Detection<\/td><td>Discover potentially vulnerable software<\/td><td>Installed package affected by a CVE<\/td><\/tr><tr><td>Security Configuration Assessment<\/td><td>Identify insecure settings<\/td><td>Weak SSH configuration<\/td><\/tr><tr><td>Threat detection<\/td><td>Match events against threat patterns<\/td><td>Repeated authentication failures<\/td><\/tr><tr><td>Active Response<\/td><td>Execute defined response actions<\/td><td>Block a source IP<\/td><\/tr><tr><td>System inventory<\/td><td>Track endpoint software and system details<\/td><td>Installed applications<\/td><\/tr><tr><td>Compliance support<\/td><td>Provide security monitoring evidence<\/td><td>CIS-related checks<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">1.4 Wazuh vs traditional monitoring<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Aspect<\/th><th class=\"has-text-align-left\" data-align=\"left\">Traditional monitoring<\/th><th class=\"has-text-align-left\" data-align=\"left\">Wazuh<\/th><\/tr><\/thead><tbody><tr><td>Primary focus<\/td><td>Health and availability<\/td><td>Security visibility and detection<\/td><\/tr><tr><td>Common metrics<\/td><td>CPU, RAM, disk, latency<\/td><td>Authentication, integrity, vulnerabilities, security events<\/td><\/tr><tr><td>Typical question<\/td><td>Is the server healthy?<\/td><td>Is suspicious activity occurring?<\/td><\/tr><tr><td>Detection method<\/td><td>Thresholds and health checks<\/td><td>Rules, decoders, security assessments<\/td><\/tr><tr><td>Main users<\/td><td>Operations, SREs<\/td><td>SOC, security, DevSecOps<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Tools such as Prometheus and Datadog can also collect logs and offer security capabilities, but traditional infrastructure monitoring and security investigation have different primary objectives.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.5 Wazuh vs Falco<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh and Falco complement one another in many environments.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Wazuh<\/th><th class=\"has-text-align-left\" data-align=\"left\">Falco<\/th><\/tr><\/thead><tbody><tr><td>Broad endpoint and security-event monitoring<\/td><td>Primarily runtime behavior detection<\/td><\/tr><tr><td>Log-based threat analysis<\/td><td>Syscall, kernel-event, and plugin-based monitoring<\/td><\/tr><tr><td>FIM, SCA, vulnerability inventory<\/td><td>Runtime detection rules<\/td><\/tr><tr><td>Centralized security investigation<\/td><td>Runtime-focused security alerts<\/td><\/tr><tr><td>Suitable for servers, endpoints, and cloud<\/td><td>Particularly useful for Linux and Kubernetes workloads<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A practical DevSecOps architecture can use Falco for runtime threat detection and Wazuh for centralized investigation and other security capabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.6 What Wazuh cannot guarantee<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh is not a complete replacement for antivirus, endpoint prevention, vulnerability remediation tools, firewalls, or human incident response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It cannot reliably detect activity it has no visibility into, and a generated alert does not necessarily prove that a security incident occurred.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Practical exercise:<\/strong>&nbsp;Identify three events on a Linux server that security monitoring should detect, such as repeated login failures, unexpected configuration modifications, and a vulnerable software package.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Is Wazuh primarily a performance monitoring system?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. Its primary purpose is security monitoring, detection, investigation, and response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Is installing Wazuh equivalent to automatically securing a server?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. Wazuh provides visibility and controls, but the operating system, network, applications, and security processes still require appropriate hardening.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 2 \u2014 Security and Log Monitoring Fundamentals<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">10 minutes | Foundational Linux and security knowledge<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.1 Important security terminology<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before installing Wazuh, understand these terms.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Term<\/th><th class=\"has-text-align-left\" data-align=\"left\">Meaning<\/th><\/tr><\/thead><tbody><tr><td>Event<\/td><td>Something that happened on a system<\/td><\/tr><tr><td>Log<\/td><td>Recorded information about an event<\/td><\/tr><tr><td>Alert<\/td><td>An event that a detection mechanism identifies as noteworthy<\/td><\/tr><tr><td>Incident<\/td><td>A security occurrence requiring investigation or response<\/td><\/tr><tr><td>IOC<\/td><td>Indicator of Compromise, such as a suspicious hash or domain<\/td><\/tr><tr><td>CVE<\/td><td>Common Vulnerabilities and Exposures identifier<\/td><\/tr><tr><td>CVSS<\/td><td>Common Vulnerability Scoring System<\/td><\/tr><tr><td>False positive<\/td><td>Benign activity incorrectly identified as suspicious<\/td><\/tr><tr><td>False negative<\/td><td>Harmful activity that detection mechanisms fail to flag<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2.2 Where Linux security events originate<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Common Linux logging sources include:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Source<\/th><th class=\"has-text-align-left\" data-align=\"left\">Information<\/th><\/tr><\/thead><tbody><tr><td><code>\/var\/log\/auth.log<\/code><\/td><td>Authentication activity on systems using this file<\/td><\/tr><tr><td><code>\/var\/log\/syslog<\/code><\/td><td>General system events when configured<\/td><\/tr><tr><td><code>journalctl<\/code><\/td><td>Logs collected by systemd-journald<\/td><\/tr><tr><td><code>\/var\/log\/audit\/audit.log<\/code><\/td><td>Linux Audit subsystem events when configured<\/td><\/tr><tr><td>Application logs<\/td><td>Web-server, database, and application-specific events<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The availability of specific files depends on the Linux distribution and logging services installed. For example, a minimal Ubuntu installation may use journald without providing a traditional&nbsp;<code>\/var\/log\/auth.log<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Practical: inspect Linux authentication-related events<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On an Ubuntu lab machine:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Display OS information<\/em>\ncat \/etc\/os-release\n\n<em># Show recent journal events<\/em>\nsudo journalctl -n 30 --no-pager\n\n<em># Show available SSH-service journal events<\/em>\nsudo journalctl -u ssh -n 20 --no-pager\n\n<em># Check whether a traditional authentication log exists<\/em>\nsudo test -f \/var\/log\/auth.log &amp;&amp; \\\n  sudo tail -n 20 \/var\/log\/auth.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected result: You should see timestamped system or SSH events if those services have produced journal records.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A missing&nbsp;<code>\/var\/log\/auth.log<\/code>&nbsp;is not automatically a security or installation problem.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.3 Understand a sample security event<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Oct 11 12:00:00 web01 sshd&#91;1234]:\nFailed password for invalid user demo\nfrom 192.0.2.15 port 52210 ssh2\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Meaning:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Field<\/th><th class=\"has-text-align-left\" data-align=\"left\">Interpretation<\/th><\/tr><\/thead><tbody><tr><td>Timestamp<\/td><td>When the event occurred<\/td><\/tr><tr><td>Host<\/td><td><code>web01<\/code><\/td><\/tr><tr><td>Process<\/td><td><code>sshd<\/code><\/td><\/tr><tr><td>PID<\/td><td><code>1234<\/code><\/td><\/tr><tr><td>Action<\/td><td>Failed authentication<\/td><\/tr><tr><td>Username<\/td><td><code>demo<\/code><\/td><\/tr><tr><td>Source IP<\/td><td><code>192.0.2.15<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A single failed login can be normal. Repeated failures, multiple targeted accounts, or suspicious source behavior may warrant investigation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.4 Windows security events<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Windows provides event logs through Windows Event Viewer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Important example event IDs:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Event ID<\/th><th class=\"has-text-align-left\" data-align=\"left\">Meaning<\/th><\/tr><\/thead><tbody><tr><td>4624<\/td><td>Successful logon<\/td><\/tr><tr><td>4625<\/td><td>Failed logon<\/td><\/tr><tr><td>4688<\/td><td>Process creation, when configured for auditing<\/td><\/tr><tr><td>4720<\/td><td>User account created<\/td><\/tr><tr><td>1102<\/td><td>Security audit log cleared<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On Windows, open PowerShell as Administrator:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Examine the latest five failed-logon events<\/em>\nGet-WinEvent -FilterHashtable @{\n    LogName = 'Security'\n    Id = 4625\n} -MaxEvents 5\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This may return no matching events if no relevant activity was recorded.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2.5 Introduction to MITRE ATT&amp;CK<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MITRE ATT&amp;CK is a framework used to describe adversary behavior.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A simple example is credential brute forcing.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tactic: Credential Access<\/li>\n\n\n\n<li>Technique: Brute Force<\/li>\n\n\n\n<li>Technique ID:\u00a0<code>T1110<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh rules can include MITRE ATT&amp;CK mappings to provide additional investigation context.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Practical exercise:<\/strong>&nbsp;Find a failed authentication event and identify its timestamp, username, source IP, and system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What is the difference between a log and an alert?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: A log records an event. An alert indicates that an event or pattern matched defined detection criteria.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Does a CVE mean that a vulnerability has been exploited?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. A CVE identifies a publicly recognized vulnerability; exploitation requires separate evidence.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 3 \u2014 Wazuh Architecture and Working<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">15 minutes | Components, data flow, and networking<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.1 Main architecture<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh contains an endpoint agent and three central components.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TB\n    subgraph Endpoints&#91;\"Monitored endpoints\"]\n        L&#91;\"Linux agent\"]\n        W&#91;\"Windows agent\"]\n        M&#91;\"macOS agent\"]\n    end\n    subgraph Central&#91;\"Wazuh platform\"]\n        S&#91;\"Wazuh server \/ manager\"]\n        F&#91;\"Filebeat\"]\n        I&#91;\"Wazuh indexer\"]\n        D&#91;\"Wazuh dashboard\"]\n        S --&gt; F\n        F --&gt;|\"TLS\"| I\n        I &lt;--&gt;|\"Search queries\"| D\n        D &lt;--&gt;|\"REST API\"| S\n    end\n    L --&gt;|\"Events\"| S\n    W --&gt;|\"Events\"| S\n    M --&gt;|\"Events\"| S\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This architecture is verified against the current Wazuh documentation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.2 Understand each component<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Wazuh Agent<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Installed on an endpoint to collect and report security telemetry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It supports functions such as log collection, file integrity monitoring, security configuration checks, and system inventory.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Wazuh Server \/ Manager<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The central detection and management component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Responsibilities include receiving events, processing decoders, evaluating rules, generating alerts, managing agents, and initiating configured responses.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Filebeat<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A forwarding component bundled with the Wazuh server installation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It sends security alert data to the indexer.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Wazuh Indexer<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Stores and indexes security information so it can be searched and analyzed efficiently.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Wazuh Dashboard<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The browser-based interface for investigating alerts, managing agents, reviewing vulnerabilities, inspecting security configuration results, and visualizing data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.3 How Wazuh processes an event<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A typical security event follows this sequence:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Something happens on a monitored endpoint.<\/li>\n\n\n\n<li>The endpoint generates an event or log.<\/li>\n\n\n\n<li>The Wazuh agent collects relevant data.<\/li>\n\n\n\n<li>The Wazuh manager receives the event.<\/li>\n\n\n\n<li>A decoder attempts to understand its structure.<\/li>\n\n\n\n<li>Rules evaluate whether the event meets detection conditions.<\/li>\n\n\n\n<li>When appropriate, Wazuh produces an alert.<\/li>\n\n\n\n<li>Filebeat forwards the alert for indexing.<\/li>\n\n\n\n<li>The indexer stores the information.<\/li>\n\n\n\n<li>The dashboard allows an analyst to investigate.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Later tutorials reproduce this complete process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.4 Important Wazuh ports<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Port<\/th><th class=\"has-text-align-left\" data-align=\"left\">Protocol<\/th><th class=\"has-text-align-left\" data-align=\"left\">Purpose<\/th><\/tr><\/thead><tbody><tr><td>1514<\/td><td>TCP<\/td><td>Agent-to-manager event communication<\/td><\/tr><tr><td>1515<\/td><td>TCP<\/td><td>Agent enrollment<\/td><\/tr><tr><td>1516<\/td><td>TCP<\/td><td>Manager-cluster communication<\/td><\/tr><tr><td>55000<\/td><td>TCP<\/td><td>Wazuh server API<\/td><\/tr><tr><td>9200<\/td><td>TCP<\/td><td>Indexer API<\/td><\/tr><tr><td>443<\/td><td>TCP<\/td><td>Dashboard HTTPS<\/td><\/tr><tr><td>514<\/td><td>UDP\/TCP<\/td><td>Optional Syslog collection<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These are default ports, and some services are disabled or unnecessary depending on the deployment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our lab, only the agent communication and enrollment ports need to be reachable from monitored endpoints. The dashboard should be accessible only from an authorized administration network.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not expose the Wazuh indexer or management APIs directly to the public internet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.5 Agent-based vs agentless monitoring<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Agent-based monitoring runs software directly on the monitored endpoint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Agentless monitoring gathers information without installing a native Wazuh agent on the source. For example, network equipment can send Syslog events to a central collector.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Agent-based monitoring usually provides richer host-level telemetry. Agentless approaches are useful when installing an agent is impractical or unsupported.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3.6 Deployment architectures<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Deployment<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><th class=\"has-text-align-left\" data-align=\"left\">Recommended for<\/th><\/tr><\/thead><tbody><tr><td>All-in-one<\/td><td>All central components share one server<\/td><td>Training and small environments<\/td><\/tr><tr><td>Distributed<\/td><td>Central components run on separate hosts<\/td><td>Higher resource requirements<\/td><\/tr><tr><td>Multi-node<\/td><td>Clustered managers\/indexers<\/td><td>Scale and higher availability<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This course uses all-in-one deployment to keep setup and troubleshooting approachable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Practical exercise:<\/strong>&nbsp;Draw the route followed by an SSH authentication event from its origin to the Wazuh dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Which component evaluates detection rules?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: The Wazuh manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Which component stores indexed security data?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: The Wazuh indexer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Which port does an agent normally use for event communication?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: TCP port 1514.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 4 \u2014 Wazuh Installation and Setup<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">25 minutes | Hands-on installation<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By the end of this tutorial, you will know how to install a single-node Wazuh deployment, access the dashboard, verify services, and identify common installation problems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Quick Installation and Configuration<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Platform<\/th><th class=\"has-text-align-left\" data-align=\"left\">Central Wazuh components<\/th><th class=\"has-text-align-left\" data-align=\"left\">Recommended approach<\/th><\/tr><\/thead><tbody><tr><td>Ubuntu Linux<\/td><td>Native installation supported<\/td><td>Official installation assistant<\/td><\/tr><tr><td>Windows<\/td><td>Not a native Windows server installation<\/td><td>Linux VM or Docker Desktop<\/td><\/tr><tr><td>macOS<\/td><td>Not a native macOS server installation<\/td><td>Linux VM; Docker-based alternatives require compatibility verification<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The main walkthrough uses an Ubuntu VM. The next tutorial provides native Wazuh agent installation commands for Ubuntu, Windows, and macOS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.2 Prepare the Ubuntu server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On your Wazuh server VM, open a Bash terminal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the operating system and resources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Display operating system information<\/em>\ncat \/etc\/os-release\n\n<em># Check architecture<\/em>\nuname -m\n\n<em># Check available memory<\/em>\nfree -h\n\n<em># Check available disk space<\/em>\ndf -h\n\n<em># Check available processors<\/em>\nnproc\n\n<em># Check the server IP<\/em>\nhostname -I\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected baseline:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu 24.04 LTS<\/li>\n\n\n\n<li>x86_64 or ARM64 architecture supported by your deployment<\/li>\n\n\n\n<li>At least 8 GiB RAM<\/li>\n\n\n\n<li>Four CPU cores<\/li>\n\n\n\n<li>Approximately 50 GB storage allocated<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Install the required download tools:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\n\nsudo apt install -y \\\n  curl \\\n  ca-certificates \\\n  nano\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4.3 Download the installation assistant<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The official all-in-one installation process is documented in Wazuh Quickstart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Create a dedicated installation directory<\/em>\nmkdir -p ~\/wazuh-install\n\ncd ~\/wazuh-install\n\n<em># Download the official 4.14 installer<\/em>\ncurl -fsSLO \\\n  https:&#47;&#47;packages.wazuh.com\/4.14\/wazuh-install.sh\n\n<em># Verify that the script was downloaded<\/em>\nls -lh wazuh-install.sh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Before running a downloaded installation script with elevated privileges, inspect it and verify its origin.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Inspect the beginning of the installer<\/em>\nhead -n 40 wazuh-install.sh\n\n<em># Display the installation assistant options<\/em>\nbash wazuh-install.sh --help\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For production installations, use your organization&#8217;s normal package integrity and installation approval process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.4 Install Wazuh<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the assisted all-in-one installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/wazuh-install\n\nsudo bash .\/wazuh-install.sh -a\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code>-a<\/code>&nbsp;option deploys the central components using the all-in-one installation method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Wazuh manager<\/li>\n\n\n\n<li>Filebeat<\/li>\n\n\n\n<li>Wazuh indexer<\/li>\n\n\n\n<li>Wazuh dashboard<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A successful installation provides dashboard access information resembling:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>INFO: --- Summary ---\nINFO: You can access the web interface:\nhttps:&#47;&#47;&lt;SERVER_IP&gt;\n\nUser: admin\nPassword: &lt;GENERATED_PASSWORD&gt;\n\nINFO: Installation finished.\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The password will be generated by your actual installation. Never use an example password as a real deployment credential.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.5 Verify the installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run these commands on the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Check that the central services are active<\/em>\nsudo systemctl is-active \\\n  wazuh-manager \\\n  wazuh-indexer \\\n  wazuh-dashboard \\\n  filebeat\n\n<em># Check Wazuh version<\/em>\nsudo \/var\/ossec\/bin\/wazuh-control info -v\n\n<em># Check manager processes<\/em>\nsudo \/var\/ossec\/bin\/wazuh-control status\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected version for this tutorial:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>v4.14.8\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check listening network ports:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ss -ltnp | grep -E \\\n  ':1514|:1515|:443|:9200|:55000'\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A missing port may indicate a service is not running, is configured differently, or is bound to a different interface. Not every listed port must be publicly reachable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.6 Access the Wazuh dashboard<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">From your computer, open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;192.168.56.10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the generated&nbsp;<code>admin<\/code>&nbsp;credentials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the installation uses a self-signed certificate by default, your browser may display a certificate warning. For a private training environment, you can verify the certificate and proceed according to your lab policy. Production systems should use properly trusted certificates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After logging in, explore:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Agents management \u2014 Monitored endpoints and groups<\/li>\n\n\n\n<li>Threat hunting \u2014 Security alerts and searches<\/li>\n\n\n\n<li>File Integrity Monitoring \u2014 File changes<\/li>\n\n\n\n<li>Configuration Assessment \u2014 Security baselines<\/li>\n\n\n\n<li>Vulnerability Detection \u2014 Vulnerable software inventory<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Dashboard navigation may vary slightly with the installed release.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.7 Network configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The monitored Ubuntu agent needs to reach the Wazuh server on TCP 1514 and 1515.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server, first check whether UFW is enabled:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status verbose\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If UFW is already active, allow the specific agent address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from 192.168.56.20 \\\n  to any port 1514 proto tcp\n\nsudo ufw allow from 192.168.56.20 \\\n  to any port 1515 proto tcp\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure that an authorized administrator can access HTTPS port 443. Do not enable or reset a firewall blindly on a remotely managed machine; it could interrupt your existing connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For cloud deployments, equivalent restrictions may need to be configured in cloud security groups or network firewalls.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.8 Windows and macOS alternatives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The beginner-friendly cross-platform option is to run the central Wazuh server in a Linux virtual machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh also provides an official OVA virtual appliance for compatible x86_64 virtualization environments. Its current appliance uses Amazon Linux 2023 with Wazuh 4.14.8.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a container-based laboratory on a compatible Docker host, the official pinned deployment is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Requires Git, Docker Engine\/Desktop,<\/em>\n<em># Docker Compose, and sufficient resources<\/em>\n\ngit clone \\\n  https:\/\/github.com\/wazuh\/wazuh-docker.git \\\n  -b v4.14.8\n\ncd wazuh-docker\/single-node\n\n<em># Generate lab certificates<\/em>\ndocker compose \\\n  -f generate-indexer-certs.yml \\\n  run --rm generator\n\n<em># Start the single-node Wazuh stack<\/em>\ndocker compose up -d\n\n<em># Inspect container status<\/em>\ndocker compose ps\n\n<em># Review initialization logs<\/em>\ndocker compose logs --tail=100\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a native Linux Docker host or WSL2, the indexer may additionally require:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sysctl -w vm.max_map_count=262144\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Docker instructions are documented for supported Linux and Windows hosts. Native macOS Docker compatibility for this exact deployment was not established by the retrieved vendor installation guide, so treat a Linux VM as the validated choice on a Mac. The Docker stack may use demonstration credentials; replace default credentials before allowing access beyond an isolated lab.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.9 Troubleshooting installation problems<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Problem<\/th><th class=\"has-text-align-left\" data-align=\"left\">Likely cause<\/th><th class=\"has-text-align-left\" data-align=\"left\">Diagnostic action<\/th><\/tr><\/thead><tbody><tr><td>Installer fails<\/td><td>Unsupported OS or missing resources<\/td><td><code>cat \/etc\/os-release<\/code>,&nbsp;<code>free -h<\/code>,&nbsp;<code>df -h<\/code><\/td><\/tr><tr><td>Dashboard unavailable<\/td><td>Service stopped or network restriction<\/td><td><code>systemctl status wazuh-dashboard<\/code><\/td><\/tr><tr><td>Indexer fails<\/td><td>Insufficient RAM or configuration issue<\/td><td><code>journalctl -u wazuh-indexer -n 100<\/code><\/td><\/tr><tr><td>Cannot authenticate<\/td><td>Incorrect credentials<\/td><td>Retrieve credentials from installation archive<\/td><\/tr><tr><td>Connection refused<\/td><td>Wrong address or blocked port<\/td><td><code>ss -ltnp<\/code>, firewall rules<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect installation logs with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl \\\n  -u wazuh-manager \\\n  -n 100 \\\n  --no-pager\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Other services can be inspected by replacing&nbsp;<code>wazuh-manager<\/code>&nbsp;with their corresponding service name.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.10 Rollback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If this is a disposable VM, restoring a snapshot or deleting the lab VM is the cleanest rollback.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The installation assistant also supports uninstalling Wazuh using&nbsp;<code>-u<\/code>, but this can remove the Wazuh installation and associated local data. Use that option only after confirming that no data must be retained.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exercise: Install Wazuh, verify all four central services, and log in to the dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What does the all-in-one deployment include?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: Wazuh manager, Filebeat, indexer, and dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Why should production deployments restrict the indexer API?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: It provides access to sensitive indexed security information and administrative functionality.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 5 \u2014 Wazuh Agent Installation and Management<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">15 minutes | Endpoint deployment and enrollment<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will install a Wazuh agent, connect it to the manager, verify communication, and understand agent groups.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An agent is a lightweight service installed on an endpoint. It gathers security information and communicates with the Wazuh manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The preferred lab configuration is a separate Ubuntu endpoint.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.2 Quick Installation \u2014 Ubuntu Linux<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Execute on the Ubuntu agent VM at 192.168.56.20, not on the Wazuh server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install prerequisites<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\n\nsudo apt install -y \\\n  curl \\\n  gnupg \\\n  ca-certificates\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Import the repository signing key<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL \\\n  https:\/\/packages.wazuh.com\/key\/GPG-KEY-WAZUH \\\n  | sudo gpg --dearmor \\\n      -o \/usr\/share\/keyrings\/wazuh.gpg\n\nsudo chmod 644 \/usr\/share\/keyrings\/wazuh.gpg\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the fingerprint information published by the vendor to validate signing-key provenance when preparing a production deployment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Add the Wazuh repository<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \\\n  \"deb &#91;signed-by=\/usr\/share\/keyrings\/wazuh.gpg] https:\/\/packages.wazuh.com\/4.x\/apt\/ stable main\" \\\n  | sudo tee \/etc\/apt\/sources.list.d\/wazuh.list\n\nsudo apt update\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Install and register the agent<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo env WAZUH_MANAGER=\"192.168.56.10\" \\\n  apt-get install -y wazuh-agent\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>WAZUH_MANAGER<\/code>&nbsp;identifies the manager the agent should contact.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For reproducible production deployments, pin the agent package version to the approved version. An agent version should not be newer than its Wazuh manager.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Enable the agent service<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload\n\nsudo systemctl enable wazuh-agent\n\nsudo systemctl start wazuh-agent\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Verify<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-active wazuh-agent\n\nsudo \/var\/ossec\/bin\/wazuh-control info -v\n\nsudo tail -n 30 \/var\/ossec\/logs\/ossec.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected service state:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check network access:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nc -zv 192.168.56.10 1514\nnc -zv 192.168.56.10 1515\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If&nbsp;<code>nc<\/code>&nbsp;is unavailable, install&nbsp;<code>netcat-openbsd<\/code>&nbsp;or use another TCP connectivity test.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.3 Quick Installation \u2014 Windows<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On your Windows endpoint, open PowerShell as Administrator.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Download the official versioned MSI installer:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$Installer = Join-Path $env:TEMP `\n    \"wazuh-agent-4.14.8-1.msi\"\n\n$Url = \"https:\/\/packages.wazuh.com\/4.x\/windows\/wazuh-agent-4.14.8-1.msi\"\n\nInvoke-WebRequest `\n    -Uri $Url `\n    -OutFile $Installer\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install and enroll:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$Arguments = @(\n    \"\/i\"\n    \"`\"$Installer`\"\"\n    \"\/qn\"\n    'WAZUH_MANAGER=\"192.168.56.10\"'\n)\n\n$Process = Start-Process `\n    -FilePath \"msiexec.exe\" `\n    -ArgumentList $Arguments `\n    -Wait `\n    -PassThru\n\n$Process.ExitCode\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An MSI exit code of&nbsp;<code>0<\/code>&nbsp;indicates success. Other codes should be investigated before continuing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start and verify the Windows service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Service WazuhSvc\n\nGet-Service WazuhSvc\n\nTest-NetConnection `\n  -ComputerName 192.168.56.10 `\n  -Port 1514\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the agent version and log:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$AgentPath = \"C:\\Program Files (x86)\\ossec-agent\"\n\n&amp; \"$AgentPath\\wazuh-control.exe\" info -v\n\nGet-Content \"$AgentPath\\ossec.log\" -Tail 30\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Official reference:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.4 Quick Installation \u2014 macOS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On macOS, open Terminal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Determine whether the Mac uses Intel or Apple silicon:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uname -m\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Typical results:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>arm64<\/code>\u00a0\u2014 Apple silicon<\/li>\n\n\n\n<li><code>x86_64<\/code>\u00a0\u2014 Intel<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Apple silicon<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/Downloads\n\ncurl -fLO \\\n  https:&#47;&#47;packages.wazuh.com\/4.x\/macos\/wazuh-agent-4.14.8-1.arm64.pkg\n\nprintf \"WAZUH_MANAGER='192.168.56.10'\\n\" \\\n  | sudo tee \/tmp\/wazuh_envs\n\nsudo installer \\\n  -pkg wazuh-agent-4.14.8-1.arm64.pkg \\\n  -target \/\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Intel Mac<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/Downloads\n\ncurl -fLO \\\n  https:&#47;&#47;packages.wazuh.com\/4.x\/macos\/wazuh-agent-4.14.8-1.intel64.pkg\n\nprintf \"WAZUH_MANAGER='192.168.56.10'\\n\" \\\n  | sudo tee \/tmp\/wazuh_envs\n\nsudo installer \\\n  -pkg wazuh-agent-4.14.8-1.intel64.pkg \\\n  -target \/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start the agent using the vendor&#8217;s LaunchDaemon:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo launchctl bootstrap \\\n  system \\\n  \/Library\/LaunchDaemons\/com.wazuh.agent.plist\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/Library\/Ossec\/bin\/wazuh-control info -v\n\nsudo \/Library\/Ossec\/bin\/wazuh-control status\n\nsudo tail -n 30 \/Library\/Ossec\/logs\/ossec.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If macOS reports that the service is already bootstrapped, inspect its current state rather than registering it repeatedly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on the monitored sources and macOS privacy protections, additional permissions may be necessary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Official reference:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.5 Verify enrolled agents on the server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Return to the Wazuh server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/agent_control -l\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Illustrative output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Wazuh agent_control. List of available agents:\n\nID: 000, Name: wazuh-server, Active\/Local\nID: 001, Name: ubuntu-agent, Active\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The agent ID and hostname will depend on your environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From the browser, open Agents management \u2192 Summary and confirm that your Ubuntu endpoint is active.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Available statuses include Active, Pending, Disconnected, and Never connected.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.6 Agent groups<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Agent groups allow multiple endpoints to receive common configurations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Group<\/th><th class=\"has-text-align-left\" data-align=\"left\">Typical endpoints<\/th><\/tr><\/thead><tbody><tr><td>Linux<\/td><td>Ubuntu and other Linux servers<\/td><\/tr><tr><td>Windows<\/td><td>Windows workstations and servers<\/td><\/tr><tr><td>macOS<\/td><td>Mac devices<\/td><\/tr><tr><td>WebServers<\/td><td>Application and web servers<\/td><\/tr><tr><td>DatabaseServers<\/td><td>Database systems<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Create a group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Run on Wazuh server<\/em>\nsudo \/var\/ossec\/bin\/agent_groups \\\n  -a -g Linux -q\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">List groups:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/agent_groups -l\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Assign an enrolled agent to the group, using its actual ID:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/agent_groups \\\n  -a -i 001 -g Linux\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify membership:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/agent_groups \\\n  -s -i 001\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The group configuration is stored under:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/var\/ossec\/etc\/shared\/Linux\/agent.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This mechanism supports centralized settings, such as common log paths, FIM monitoring policies, and other supported agent configurations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5.7 Agent troubleshooting<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Symptom<\/th><th class=\"has-text-align-left\" data-align=\"left\">Diagnostic step<\/th><th class=\"has-text-align-left\" data-align=\"left\">Possible fix<\/th><\/tr><\/thead><tbody><tr><td>Agent not connected<\/td><td>Test 1514\/TCP<\/td><td>Correct routing or firewall<\/td><\/tr><tr><td>Enrollment failure<\/td><td>Test 1515\/TCP<\/td><td>Check enrollment service<\/td><\/tr><tr><td>Wrong manager<\/td><td>Inspect agent&nbsp;<code>ossec.conf<\/code><\/td><td>Correct manager address<\/td><\/tr><tr><td>Agent starts then stops<\/td><td>Check&nbsp;<code>ossec.log<\/code><\/td><td>Resolve reported configuration errors<\/td><\/tr><tr><td>Older manager version<\/td><td>Compare component versions<\/td><td>Use a compatible agent version<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A common reason an agent cannot connect is a blocked port or incorrect manager address.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exercise: Connect an Ubuntu agent, verify Active status, create a Linux agent group, and assign that agent to it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Can Wazuh agents run on Windows and macOS?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: Yes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Does an active agent status prove every security feature is functioning?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. Each feature must be configured and validated separately.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 6 \u2014 Log Collection, Monitoring, and Alerts<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">20 minutes | Hands-on telemetry collection<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will understand log collection, configure a monitored log file, investigate system events, and prepare a custom security event for rule testing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.2 Understand log collection<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Wazuh agent uses its Logcollector functionality to read supported local log sources.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common log sources include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Linux authentication and system logs<\/li>\n\n\n\n<li>Windows Event Logs<\/li>\n\n\n\n<li>macOS system logs<\/li>\n\n\n\n<li>Web-server logs<\/li>\n\n\n\n<li>Application-specific text and JSON logs<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A typical agent configuration lives at:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Linux:   \/var\/ossec\/etc\/ossec.conf\nWindows: C:\\Program Files (x86)\\ossec-agent\\ossec.conf\nmacOS:   \/Library\/Ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6.3 Collect Linux journald events<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu, Wazuh supports the following agent configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;localfile&gt;\n  &lt;location&gt;journald&lt;\/location&gt;\n  &lt;log_format&gt;journald&lt;\/log_format&gt;\n&lt;\/localfile&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is normally included in the default Linux agent configuration. Check before adding another copy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On your Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep -n -A3 -B2 \\\n  '&lt;location&gt;journald&lt;\/location&gt;' \\\n  \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If it is missing, back up the configuration and add the block inside&nbsp;<code>&lt;ossec_config&gt;<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp -a \/var\/ossec\/etc\/ossec.conf \\\n  \/var\/ossec\/etc\/ossec.conf.bak\n\nsudo nano \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the agent only if you changed the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart wazuh-agent\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6.4 Generate a harmless system event<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Execute on the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logger -t wazuh-training \\\n  \"Training event: system monitoring test\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the event in journald:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl \\\n  -t wazuh-training \\\n  -n 10 \\\n  --no-pager\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This confirms the event reached journald.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It does not by itself prove that a Wazuh detection rule generated an alert.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Important distinction: Log collection and alert generation are different stages. Events may be collected successfully without producing visible security alerts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.5 Create a dedicated application log<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We will use this file throughout the remaining tutorials:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Create a clean lab log file<\/em>\nsudo install \\\n  -o root \\\n  -g adm \\\n  -m 0640 \\\n  \/dev\/null \\\n  \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following block inside the existing&nbsp;<code>&lt;ossec_config&gt;<\/code>&nbsp;in&nbsp;<code>\/var\/ossec\/etc\/ossec.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;localfile&gt;\n  &lt;location&gt;\/var\/log\/wazuh-lab.log&lt;\/location&gt;\n  &lt;log_format&gt;syslog&lt;\/log_format&gt;\n&lt;\/localfile&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Edit carefully and do not delete existing configuration blocks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart and verify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart wazuh-agent\n\nsudo systemctl is-active wazuh-agent\n\nsudo tail -n 30 \/var\/ossec\/logs\/ossec.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This tells Wazuh to monitor the specified file for Syslog-formatted messages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.6 Generate a synthetic failed-authentication event<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Execute on the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s\\n' \\\n  \"Oct 11 12:00:00 ubuntu-agent wazuh-lab: AUTH_FAIL username=alice srcip=192.0.2.15\" \\\n  | sudo tee -a \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 5 \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected final log entry:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Oct 11 12:00:00 ubuntu-agent wazuh-lab: AUTH_FAIL username=alice srcip=192.0.2.15\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is deliberately synthetic, not evidence of an actual attack. The source IP belongs to a documentation-only address range.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the next tutorial, we will create a decoder and detection rule that recognize this event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.7 Explore the Wazuh alert files<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Human-readable alert log<\/em>\nsudo tail -n 30 \\\n  \/var\/ossec\/logs\/alerts\/alerts.log\n\n<em># Structured JSON alerts<\/em>\nsudo tail -n 5 \\\n  \/var\/ossec\/logs\/alerts\/alerts.json\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The manager writes matching alerts here. Raw event archiving is a separate, configurable capability and should not be assumed to contain every collected event unless configured appropriately.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.8 Understand alert severity<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh rules use severity levels from 0 through 16.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a practical interpretation:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Level<\/th><th class=\"has-text-align-left\" data-align=\"left\">General significance<\/th><\/tr><\/thead><tbody><tr><td>0<\/td><td>Suppressed or ignored alert<\/td><\/tr><tr><td>1\u20133<\/td><td>Low-level activity<\/td><\/tr><tr><td>4\u20136<\/td><td>Low to moderate<\/td><\/tr><tr><td>7\u20139<\/td><td>Potentially important<\/td><\/tr><tr><td>10\u201312<\/td><td>High priority<\/td><\/tr><tr><td>13\u201316<\/td><td>Very high severity<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">These are working guidelines, not a universal risk-scoring standard. A rule&#8217;s configured level and surrounding context must both be considered.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6.9 Log troubleshooting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If your application event is missing:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Confirm that the original file exists.<\/li>\n\n\n\n<li>Confirm that new content was appended after log collection began.<\/li>\n\n\n\n<li>Inspect the agent configuration for the correct path and format.<\/li>\n\n\n\n<li>Check that the agent service is running.<\/li>\n\n\n\n<li>Confirm manager connectivity.<\/li>\n\n\n\n<li>Verify the detection rule using\u00a0<code>wazuh-logtest<\/code>.<\/li>\n\n\n\n<li>Check the manager&#8217;s alert output and indexing services.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Exercise: Generate three distinct synthetic log entries and confirm that they appear in the application log. Then inspect existing security alerts through the dashboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Why might a collected event not appear in Threat Hunting?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: It may not match an alert-generating rule, or there may be a forwarding or indexing problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What file controls Wazuh agent log collection on Ubuntu?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A:&nbsp;<code>\/var\/ossec\/etc\/ossec.conf<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 7 \u2014 Wazuh Rules, Decoders, and Detection Engineering<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">20 minutes | Intermediate detection engineering<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is one of the most important lessons in the course because it explains how security events become meaningful security alerts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will understand decoders, built-in rules, custom detection rules, rule severity, validation, and false-positive reduction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will also build a working detection rule for the synthetic event introduced in Tutorial 6.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.2 What is a decoder?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A decoder extracts information from a raw event so Wazuh can understand its structure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example log:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Oct 11 12:00:00 ubuntu-agent wazuh-lab: AUTH_FAIL username=alice srcip=192.0.2.15\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A decoder can extract:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>program_name = wazuh-lab\ndstuser      = alice\nsrcip        = 192.0.2.15\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result is structured information that Wazuh rules can use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.3 What is a Wazuh rule?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A rule determines whether a security event meets specified conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A failed authentication attempt occurs.<\/li>\n\n\n\n<li>The event was produced by a particular application.<\/li>\n\n\n\n<li>The source IP has appeared repeatedly.<\/li>\n\n\n\n<li>The event contains fields of interest.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A matching rule can generate an alert with its own ID, description, severity level, and group classification.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.4 Important Wazuh configuration files<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All paths below refer to the Wazuh server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">File<\/th><th class=\"has-text-align-left\" data-align=\"left\">Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>\/var\/ossec\/etc\/rules\/local_rules.xml<\/code><\/td><td>Custom detection rules<\/td><\/tr><tr><td><code>\/var\/ossec\/etc\/decoders\/local_decoder.xml<\/code><\/td><td>Custom log decoders<\/td><\/tr><tr><td><code>\/var\/ossec\/ruleset\/rules\/<\/code><\/td><td>Vendor-supplied detection rules<\/td><\/tr><tr><td><code>\/var\/ossec\/ruleset\/decoders\/<\/code><\/td><td>Vendor-supplied decoders<\/td><\/tr><tr><td><code>\/var\/ossec\/etc\/ossec.conf<\/code><\/td><td>Main server configuration<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh recommends using custom rule IDs between&nbsp;<code>100000<\/code>&nbsp;and&nbsp;<code>120000<\/code>, and preserving your own rules separately from vendor-supplied rules that may be replaced during upgrades.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.5 Hands-on: create a custom decoder<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server, first back up the existing decoder file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/ossec\/etc\/decoders\n\nsudo cp -a local_decoder.xml \\\n  local_decoder.xml.bak\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the file is absent, create it first and ensure the Wazuh manager can read it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \\\n  \/var\/ossec\/etc\/decoders\/local_decoder.xml\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Append the following definitions without deleting existing decoders:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;decoder name=\"wazuh-lab\"&gt;\n  &lt;program_name&gt;^wazuh-lab$&lt;\/program_name&gt;\n&lt;\/decoder&gt;\n\n&lt;decoder name=\"wazuh-lab\"&gt;\n  &lt;parent&gt;wazuh-lab&lt;\/parent&gt;\n  &lt;regex type=\"pcre2\"&gt;AUTH_FAIL username=(&#91;A-Za-z0-9_-]+) srcip=(&#91;0-9.]+)&lt;\/regex&gt;\n  &lt;order&gt;dstuser,srcip&lt;\/order&gt;\n&lt;\/decoder&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The parent decoder identifies the&nbsp;<code>wazuh-lab<\/code>&nbsp;application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The child decoder extracts a username and source IP address. The expression is intentionally simple for training; production decoders should validate input formats more carefully.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The use of a parent decoder and PCRE2 expression follows Wazuh&#8217;s supported custom decoder syntax.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.6 Hands-on: create a custom detection rule<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Back up the rules file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp -a \\\n  \/var\/ossec\/etc\/rules\/local_rules.xml \\\n  \/var\/ossec\/etc\/rules\/local_rules.xml.bak\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Edit it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \\\n  \/var\/ossec\/etc\/rules\/local_rules.xml\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Append this rule group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;group name=\"wazuh_lab,authentication_failed,\"&gt;\n  &lt;rule id=\"100100\" level=\"7\"&gt;\n    &lt;decoded_as&gt;wazuh-lab&lt;\/decoded_as&gt;\n    &lt;description&gt;Lab authentication failure for $(dstuser) from $(srcip)&lt;\/description&gt;\n    &lt;group&gt;authentication_failed,&lt;\/group&gt;\n  &lt;\/rule&gt;\n&lt;\/group&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Attribute<\/th><th class=\"has-text-align-left\" data-align=\"left\">Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>id=\"100100\"<\/code><\/td><td>Unique custom rule identifier<\/td><\/tr><tr><td><code>level=\"7\"<\/code><\/td><td>Alert severity<\/td><\/tr><tr><td><code>decoded_as<\/code><\/td><td>Matches events processed by the custom decoder<\/td><\/tr><tr><td><code>description<\/code><\/td><td>Human-readable alert message<\/td><\/tr><tr><td><code>dstuser<\/code>,&nbsp;<code>srcip<\/code><\/td><td>Fields extracted from the event<\/td><\/tr><tr><td><code>group<\/code><\/td><td>Helps classify the alert<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">7.7 Test the decoder and rule<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the official rule-testing utility on the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/wazuh-logtest\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Paste:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Oct 11 12:00:00 ubuntu-agent wazuh-lab: AUTH_FAIL username=alice srcip=192.0.2.15\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see results organized into three phases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Expected key values, provided the configuration matches successfully:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Phase 1: Pre-decoding\nprogram_name: wazuh-lab\n\nPhase 2: Decoding\nname: wazuh-lab\ndstuser: alice\nsrcip: 192.0.2.15\n\nPhase 3: Rule matching\nid: 100100\nlevel: 7\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The displayed output is illustrative, not a captured execution result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Wazuh does not match the decoder, check the exact&nbsp;<code>program_name<\/code>, raw log format, regular expression, and decoder file contents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>wazuh-logtest<\/code>&nbsp;evaluates decoding and rules in a test session. It does not establish that the actual endpoint is successfully delivering events.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.8 Apply the detection rule<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Validate server detection configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/wazuh-analysisd -t\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fix any reported errors before proceeding.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the manager:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart wazuh-manager\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now return to the Ubuntu agent and produce a&nbsp;<strong>new<\/strong>&nbsp;event:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s %s wazuh-lab: AUTH_FAIL username=alice srcip=192.0.2.15\\n' \\\n  \"$(date '+%b %e %T')\" \\\n  \"$(hostname -s)\" \\\n  | sudo tee -a \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On the manager:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep -n -C6 '100100' \\\n  \/var\/ossec\/logs\/alerts\/alerts.log \\\n  | tail -n 35\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should find a rule&nbsp;<code>100100<\/code>&nbsp;alert if log collection, decoding, detection, and communication are working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then open Wazuh Dashboard \u2192 Threat Hunting and search:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rule.id:100100\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Choose a time range that includes the generated event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.9 Intermediate example: detect repeated failures<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A single failed authentication attempt may not be particularly serious.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Five attempts from the same source IP within two minutes are potentially more interesting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Append this additional rule inside the same custom rule group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;rule id=\"100101\"\n      level=\"12\"\n      frequency=\"5\"\n      timeframe=\"120\"&gt;\n  &lt;if_matched_sid&gt;100100&lt;\/if_matched_sid&gt;\n  &lt;same_srcip \/&gt;\n  &lt;description&gt;Repeated lab authentication failures from one source IP&lt;\/description&gt;\n  &lt;group&gt;authentication_failed,brute_force,&lt;\/group&gt;\n&lt;\/rule&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This demonstrates event correlation using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>frequency<\/code>\u00a0\u2014 Number of matching events<\/li>\n\n\n\n<li><code>timeframe<\/code>\u00a0\u2014 Evaluation period, in seconds<\/li>\n\n\n\n<li><code>if_matched_sid<\/code>\u00a0\u2014 Previously matched rule<\/li>\n\n\n\n<li><code>same_srcip<\/code>\u00a0\u2014 Repeated source IP<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The precise frequency-counter behavior and matching should be confirmed with&nbsp;<code>wazuh-logtest<\/code>&nbsp;using repeated events in the same test session.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file, run configuration validation, and restart the manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generate several test events from the same source IP and look for the correlation alert.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.10 False-positive reduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Detection engineering requires more than writing rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For each new rule, evaluate:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>What specific behavior does it detect?<\/li>\n\n\n\n<li>Is that behavior always suspicious?<\/li>\n\n\n\n<li>What legitimate activity might produce the same event?<\/li>\n\n\n\n<li>What evidence confirms the intended activity?<\/li>\n\n\n\n<li>Does the severity level reflect the actual risk?<\/li>\n\n\n\n<li>Can alert frequency or scope be adjusted safely?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">A rule triggering repeatedly is not automatically a better rule.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Troubleshooting:<\/strong>&nbsp;If&nbsp;<code>wazuh-logtest<\/code>&nbsp;succeeds but the dashboard shows no alert, investigate the agent collection path, service connectivity, manager alert file, indexer, and chosen time range.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exercise:<\/strong>&nbsp;Change the custom rule severity from 7 to 9, validate the configuration, generate another event, and confirm the new alert level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What is the difference between a decoder and a rule?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: A decoder extracts event fields. A rule evaluates event data against detection conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Which utility should you use to test a Wazuh detection rule?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A:&nbsp;<code>wazuh-logtest<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 8 \u2014 File Integrity Monitoring (FIM)<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">15 minutes | Hands-on file security monitoring<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will learn how File Integrity Monitoring works and detect file creation, modification, and deletion.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">FIM is useful for identifying unexpected changes to critical files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, a security team may want to know when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A web-server configuration changes.<\/li>\n\n\n\n<li>An application configuration is modified.<\/li>\n\n\n\n<li>A critical executable is replaced.<\/li>\n\n\n\n<li>A sensitive configuration file is deleted.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">FIM can detect changes, but it does not automatically establish whether those changes were malicious.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.2 How FIM works<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TD\n    A&#91;\"Select files or directories\"] --&gt; B&#91;\"Create monitoring baseline\"]\n    B --&gt; C&#91;\"File attributes or content change\"]\n    C --&gt; D&#91;\"Wazuh detects the change\"]\n    D --&gt; E&#91;\"Create and forward FIM event\"]\n    E --&gt; F&#91;\"Investigate file change\"]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh can compare attributes such as file size, modification time, ownership, permissions, and cryptographic hashes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Linux and Windows, Wazuh supports real-time directory monitoring. On macOS, use supported scheduled FIM scanning rather than assuming the Linux\/Windows real-time option is available.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.3 Hands-on: create a monitored directory<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/opt\/wazuh-lab\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create the initial file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf 'mode=development\\n' \\\n  | sudo tee \/opt\/wazuh-lab\/settings.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls -la \/opt\/wazuh-lab\n\nsudo sha256sum \\\n  \/opt\/wazuh-lab\/settings.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Record the original hash.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.4 Configure FIM<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the Ubuntu agent configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find the existing&nbsp;<code>&lt;syscheck&gt;<\/code>&nbsp;block and add the following directory entry inside it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;directories realtime=\"yes\" check_all=\"yes\"&gt;\/opt\/wazuh-lab&lt;\/directories&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The relevant portion of the configuration should resemble:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;syscheck&gt;\n  &lt;disabled&gt;no&lt;\/disabled&gt;\n\n  <em>&lt;!-- Preserve the existing FIM configuration --&gt;<\/em>\n\n  &lt;directories realtime=\"yes\" check_all=\"yes\"&gt;\/opt\/wazuh-lab&lt;\/directories&gt;\n&lt;\/syscheck&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not replace the existing configuration with this shortened illustration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Validate and restart:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/wazuh-syscheckd -t\n\nsudo systemctl restart wazuh-agent\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Allow the initial FIM scan and monitoring baseline to complete before testing modifications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.5 Test 1: modify an existing file<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf 'mode=production\\n' \\\n  | sudo tee \/opt\/wazuh-lab\/settings.conf\n\nsudo sha256sum \\\n  \/opt\/wazuh-lab\/settings.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The new hash should differ from the original because the file contents changed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open Wazuh Dashboard \u2192 File Integrity Monitoring.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Look for a modified-file event associated with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/wazuh-lab\/settings.conf\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">8.6 Test 2: create a new file<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>printf 'created by training lab\\n' \\\n  | sudo tee \/opt\/wazuh-lab\/new-file.txt\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected behavior: Wazuh should detect the addition once the monitored directory&#8217;s baseline and real-time monitoring are active.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.7 Test 3: delete a file<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo rm \/opt\/wazuh-lab\/new-file.txt\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Because this is a disposable file created specifically for the lab, deleting it is safe.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the FIM events again and look for a deletion event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.8 Windows and macOS equivalents<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For Windows, create a test directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>New-Item `\n  -ItemType Directory `\n  -Force `\n  -Path \"C:\\WazuhLab\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following inside the Windows agent&#8217;s existing&nbsp;<code>&lt;syscheck&gt;<\/code>&nbsp;block:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;directories realtime=\"yes\"&gt;C:\\WazuhLab&lt;\/directories&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then restart the Windows Wazuh service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For macOS, create:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/Users\/Shared\/wazuh-lab\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add to the macOS agent&#8217;s&nbsp;<code>&lt;syscheck&gt;<\/code>&nbsp;block:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;directories&gt;\/Users\/Shared\/wazuh-lab&lt;\/directories&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then restart the macOS agent and inspect changes after a scheduled FIM scan.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8.9 Real-world FIM scenarios<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Scenario<\/th><th class=\"has-text-align-left\" data-align=\"left\">What to monitor<\/th><\/tr><\/thead><tbody><tr><td>Linux configuration tampering<\/td><td>Selected files under&nbsp;<code>\/etc<\/code><\/td><\/tr><tr><td>Web-server changes<\/td><td>Nginx or Apache configuration<\/td><\/tr><tr><td>Application security<\/td><td>Sensitive deployment configuration files<\/td><\/tr><tr><td>Windows persistence<\/td><td>Selected startup locations and Registry entries<\/td><\/tr><tr><td>Critical software<\/td><td>Important executables and scripts<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Be careful with highly active directories. Monitoring massive or frequently changing file trees can produce unnecessary overhead and alerts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also avoid displaying sensitive file contents or differences from files containing secrets.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exercise:<\/strong>&nbsp;Modify, create, and delete files in&nbsp;<code>\/opt\/wazuh-lab<\/code>, and identify the corresponding events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What can FIM detect?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: Changes in monitored files, directories, and supported attributes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Does changing a file prove malicious activity?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. Investigation must establish whether the change was expected or unauthorized.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 9 \u2014 Security Configuration Assessment and Vulnerability Detection<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">20 minutes | Security posture and vulnerability management<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial covers two related but different Wazuh capabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.1 Understand the difference<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Capability<\/th><th class=\"has-text-align-left\" data-align=\"left\">Primary question<\/th><\/tr><\/thead><tbody><tr><td>Security Configuration Assessment (SCA)<\/td><td>Is the system configured securely?<\/td><\/tr><tr><td>Vulnerability Detection<\/td><td>Is installed software affected by known vulnerabilities?<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For example, SSH password authentication may be configured insecurely even if no known software vulnerability is present.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Conversely, a properly hardened server may still run a package with a known CVE.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Both capabilities matter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.2 Security Configuration Assessment fundamentals<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SCA examines operating system or application configuration against predefined policies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh includes security policies, many based on CIS benchmarks, and evaluates whether the configured checks pass or fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example checks may cover:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Password policy<\/li>\n\n\n\n<li>SSH security settings<\/li>\n\n\n\n<li>File and directory permissions<\/li>\n\n\n\n<li>Unnecessary services<\/li>\n\n\n\n<li>Operating system hardening<\/li>\n\n\n\n<li>Security logging configuration<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">9.3 Verify SCA configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep -n -A12 '&lt;sca&gt;' \\\n  \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A configuration may resemble:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;sca&gt;\n  &lt;enabled&gt;yes&lt;\/enabled&gt;\n  &lt;scan_on_start&gt;yes&lt;\/scan_on_start&gt;\n  &lt;interval&gt;12h&lt;\/interval&gt;\n&lt;\/sca&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is an illustrative partial block. Keep the policy configuration and other settings installed with your Wazuh agent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that SCA is enabled, then inspect the installed policies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls -lh \/var\/ossec\/ruleset\/sca\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Different operating systems include different policy files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Linux, Wazuh stores default SCA policies under&nbsp;<code>\/var\/ossec\/ruleset\/sca<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.4 Review SCA results in the dashboard<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Endpoint security \u2192 Configuration Assessment<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Select your monitored Ubuntu endpoint and an available policy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Review:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Policy name<\/li>\n\n\n\n<li>Number of passed checks<\/li>\n\n\n\n<li>Number of failed checks<\/li>\n\n\n\n<li>Check descriptions<\/li>\n\n\n\n<li>Check results<\/li>\n\n\n\n<li>Remediation recommendations<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example learning scenario:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Control: SSH root login must be restricted\n\nDesired state:\nDirect root SSH access should be restricted\naccording to the organization's security policy.\n\nAssessment:\nInspect the effective SSH daemon configuration.\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the effective SSH configuration on Ubuntu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sshd -T 2&gt;\/dev\/null \\\n  | grep -i '^permitrootlogin'\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If SSH server software is not installed, the command may be unavailable. Do not install or change SSH simply to create an insecure setting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An actual SCA finding depends on the installed policy and the current endpoint configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.5 How to use SCA results<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For each failed check:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Read the complete policy requirement.<\/li>\n\n\n\n<li>Determine whether it applies to the system.<\/li>\n\n\n\n<li>Assess the change&#8217;s impact.<\/li>\n\n\n\n<li>Apply the change using normal change-management procedures.<\/li>\n\n\n\n<li>Re-run the relevant assessment.<\/li>\n\n\n\n<li>Confirm the expected result without disrupting services.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Avoid modifying critical security settings on production machines simply to improve an assessment score.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SCA identifies potential security configuration issues; remediation is a separate action.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.6 Vulnerability Detection fundamentals<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh&#8217;s Vulnerability Detection capability uses endpoint software inventory together with its Cyber Threat Intelligence (CTI) vulnerability data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The workflow is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TD\n    A&#91;\"Wazuh agent\"] --&gt; B&#91;\"Syscollector gathers software inventory\"]\n    B --&gt; C&#91;\"Wazuh manager\"]\n    D&#91;\"Wazuh CTI vulnerability data\"] --&gt; C\n    C --&gt; E&#91;\"Correlate packages and affected versions\"]\n    E --&gt; F&#91;\"Vulnerability inventory\"]\n    F --&gt; G&#91;\"Review, prioritize, and remediate\"]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh uses Syscollector inventory and vulnerability intelligence to identify potentially affected software packages. It does not require you to exploit a vulnerability to determine that the package version is reported as affected.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.7 Verify vulnerability detection settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep -n -A5 \\\n  '&lt;vulnerability-detection&gt;' \\\n  \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The documented default configuration includes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;vulnerability-detection&gt;\n  &lt;enabled&gt;yes&lt;\/enabled&gt;\n  &lt;index-status&gt;yes&lt;\/index-status&gt;\n  &lt;feed-update-interval&gt;60m&lt;\/feed-update-interval&gt;\n&lt;\/vulnerability-detection&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These settings control whether vulnerability detection is enabled, whether vulnerability inventory is indexed, and how frequently vulnerability intelligence is refreshed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.8 Verify Syscollector on the agent<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo grep -n -A18 \\\n  '&lt;wodle name=\"syscollector\"&gt;' \\\n  \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check that inventory collection is enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Important settings include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;disabled&gt;no&lt;\/disabled&gt;\n&lt;scan_on_start&gt;yes&lt;\/scan_on_start&gt;\n&lt;packages&gt;yes&lt;\/packages&gt;\n&lt;os&gt;yes&lt;\/os&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not create a duplicate Syscollector configuration block if an existing one is present.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.9 Review vulnerability results<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open Wazuh Dashboard \u2192 Vulnerability Detection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Review:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Field<\/th><th class=\"has-text-align-left\" data-align=\"left\">Meaning<\/th><\/tr><\/thead><tbody><tr><td>CVE ID<\/td><td>Identifies the vulnerability<\/td><\/tr><tr><td>Severity<\/td><td>Indicates assessed impact<\/td><\/tr><tr><td>Affected package<\/td><td>Installed software potentially affected<\/td><\/tr><tr><td>Installed version<\/td><td>Version found on the endpoint<\/td><\/tr><tr><td>Affected asset<\/td><td>Endpoint requiring investigation<\/td><\/tr><tr><td>Remediation information<\/td><td>Available mitigation or upgrade guidance<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Results depend on inventory collection, CTI synchronization, package applicability, and indexing health. An empty inventory immediately after installation does not necessarily mean that the endpoint is free of vulnerabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.10 Practical vulnerability investigation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu, inspect locally installed packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg-query -W \\\n  -f='${binary:Package} ${Version}\\n' \\\n  | head -n 30\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Choose a package already reported in your Wazuh vulnerability inventory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the corresponding CVE record.<\/li>\n\n\n\n<li>Review affected version ranges.<\/li>\n\n\n\n<li>Confirm the installed package version.<\/li>\n\n\n\n<li>Check vendor-specific security advisories.<\/li>\n\n\n\n<li>Identify any patched backports that may affect applicability.<\/li>\n\n\n\n<li>Determine whether an update is necessary.<\/li>\n\n\n\n<li>Document the remediation decision.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For production systems, prioritize vulnerability remediation using exploitability, asset exposure, business criticality, vendor status, and compensating controls\u2014not CVSS severity alone.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9.11 SCA and vulnerability troubleshooting<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Problem<\/th><th class=\"has-text-align-left\" data-align=\"left\">What to check<\/th><\/tr><\/thead><tbody><tr><td>No SCA policies shown<\/td><td>Agent policy files, SCA enablement, initial scan<\/td><\/tr><tr><td>No vulnerabilities shown<\/td><td>Syscollector, CTI reachability, indexing<\/td><\/tr><tr><td>Old package inventory<\/td><td>Inventory scan interval and synchronization<\/td><\/tr><tr><td>Incorrect vulnerability finding<\/td><td>Vendor advisories and package version details<\/td><\/tr><tr><td>Dashboard data missing<\/td><td>Indexer and Wazuh manager health<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Useful agent-side diagnostic command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 100 \/var\/ossec\/logs\/ossec.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Useful server-side diagnostic command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl \\\n  -u wazuh-manager \\\n  -n 100 \\\n  --no-pager\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exercise:<\/strong>&nbsp;Select one failed SCA check and one vulnerability finding, if any exist, and prepare a brief remediation explanation. Do not intentionally weaken the server to manufacture a failure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What is the difference between SCA and Vulnerability Detection?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: SCA evaluates configuration security. Vulnerability Detection correlates software inventory with known vulnerability information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Does a high CVSS score automatically establish that a specific endpoint is exploitable?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. You must assess the actual software, configuration, exposure, and mitigating controls.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 10 \u2014 Threat Hunting and Security Investigation<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">10 minutes | Intermediate security analysis<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will learn to search alerts, investigate related events, interpret security findings, and document investigation results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Threat hunting<\/strong>&nbsp;is the process of proactively examining security telemetry to identify potentially malicious behavior that may not yet have been confirmed as an incident.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is different from simply reading alerts as they arrive.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.2 Understand the investigation process<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TD\n    A&#91;\"Identify suspicious event\"] --&gt; B&#91;\"Review source and severity\"]\n    B --&gt; C&#91;\"Identify affected endpoint\"]\n    C --&gt; D&#91;\"Search related events\"]\n    D --&gt; E&#91;\"Review context and evidence\"]\n    E --&gt; F{\"Evidence of malicious activity?\"}\n    F --&gt;|Yes| G&#91;\"Escalate and contain\"]\n    F --&gt;|No| H&#91;\"Document benign or unconfirmed activity\"]\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">10.3 Explore Threat Hunting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open the Wazuh dashboard and navigate to:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Threat intelligence \u2192 Threat Hunting<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Select a time range covering your training events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Filter by your custom rule:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rule.id:100100\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open a matching alert and inspect its fields.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Important fields include:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Field<\/th><th class=\"has-text-align-left\" data-align=\"left\">Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>timestamp<\/code><\/td><td>When the alert occurred<\/td><\/tr><tr><td><code>agent.name<\/code><\/td><td>Endpoint reporting the event<\/td><\/tr><tr><td><code>rule.id<\/code><\/td><td>Detection rule identifier<\/td><\/tr><tr><td><code>rule.level<\/code><\/td><td>Severity level<\/td><\/tr><tr><td><code>rule.description<\/code><\/td><td>Human-readable detection<\/td><\/tr><tr><td><code>data.srcip<\/code><\/td><td>Source IP if extracted by the decoder<\/td><\/tr><tr><td><code>data.dstuser<\/code><\/td><td>Username if extracted by the decoder<\/td><\/tr><tr><td><code>full_log<\/code><\/td><td>Original event, where available<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">An illustrative investigation record might look like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Rule ID: 100100\nSeverity: 7\nAgent: ubuntu-agent\n\nEvent:\nLab authentication failure for alice\nfrom 192.0.2.15\n\nClassification:\nControlled training simulation\n\nRecommended response:\nNo containment required\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The classification is important: this event was intentionally generated as part of the tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.4 Correlate related events<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now generate several training events on the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for user in alice bob charlie; do\n  printf '%s %s wazuh-lab: AUTH_FAIL username=%s srcip=192.0.2.15\\n' \\\n    \"$(date '+%b %e %T')\" \\\n    \"$(hostname -s)\" \\\n    \"$user\"\ndone | sudo tee -a \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Investigate the resulting alerts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ask:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Did the events come from the same source IP?<\/li>\n\n\n\n<li>Were multiple accounts targeted?<\/li>\n\n\n\n<li>Were events generated within a short period?<\/li>\n\n\n\n<li>Did the higher-severity correlation rule trigger?<\/li>\n\n\n\n<li>Was there any successful authentication after the failures?<\/li>\n\n\n\n<li>Is the source trusted, known, or expected?<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The final two questions cannot be answered conclusively from the synthetic authentication-failure events alone. Additional telemetry would be needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.5 Connect findings to MITRE ATT&amp;CK<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Repeated attempts to guess credentials may be associated with MITRE ATT&amp;CK technique&nbsp;<code>T1110<\/code>&nbsp;(Brute Force).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, mapping an alert to ATT&amp;CK is contextual classification, not proof that the adversary performed that technique.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can review MITRE mappings available on built-in Wazuh rules and use them to understand the tactics and techniques a rule is designed to detect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.6 Create a simple investigation report<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Field<\/th><th class=\"has-text-align-left\" data-align=\"left\">Example<\/th><\/tr><\/thead><tbody><tr><td>Finding<\/td><td>Repeated synthetic authentication failures<\/td><\/tr><tr><td>Detected by<\/td><td>Wazuh custom rules<\/td><\/tr><tr><td>Affected endpoint<\/td><td>Ubuntu lab agent<\/td><\/tr><tr><td>Source IP<\/td><td>192.0.2.15<\/td><\/tr><tr><td>Severity<\/td><td>As assigned by the matching rule<\/td><\/tr><tr><td>Evidence<\/td><td>Relevant event logs and rule IDs<\/td><\/tr><tr><td>Classification<\/td><td>Authorized simulation<\/td><\/tr><tr><td>Action<\/td><td>Document and close training investigation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A real security investigation should also capture the detection time, analyst, evidence references, business impact, containment actions, and decision rationale.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10.7 Common investigation mistakes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Do not assume that every alert is malicious.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Avoid drawing conclusions from one event without context, confusing the source IP with the actual identity of an attacker, or taking disruptive action before confirming the affected system and incident severity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exercise:<\/strong>&nbsp;Investigate three synthetic authentication alerts and write a five-line incident summary explaining why they should be classified as training activity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What is the purpose of threat hunting?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: To proactively identify suspicious behavior by analyzing available telemetry and related evidence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: Is a high-severity alert proof of compromise?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: No. Severity helps prioritization, but investigation is required.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 11 \u2014 Active Response and Security Integrations<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">15 minutes | Security automation<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.1 Learning objectives<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You will understand Active Response, configure an automated action, test it without blocking network access, and explore basic Wazuh integrations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.2 What is Active Response?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh Active Response executes a defined script or command when specified security conditions occur.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Possible actions include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Recording a security response<\/li>\n\n\n\n<li>Blocking an IP address<\/li>\n\n\n\n<li>Disabling an account<\/li>\n\n\n\n<li>Triggering an external workflow<\/li>\n\n\n\n<li>Restarting a service where appropriate<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Automated responses are useful, but incorrectly configured responses can interrupt legitimate activity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh supports stateless one-time responses and stateful responses that reverse an action after a configured timeout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.3 Understand Active Response configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two main elements define the response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A&nbsp;<code>&lt;command&gt;<\/code>&nbsp;block identifies the executable to run.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An&nbsp;<code>&lt;active-response&gt;<\/code>&nbsp;block defines when and where it runs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;command&gt;\n  &lt;name&gt;example-response&lt;\/name&gt;\n  &lt;executable&gt;example-response.py&lt;\/executable&gt;\n  &lt;timeout_allowed&gt;no&lt;\/timeout_allowed&gt;\n&lt;\/command&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;active-response&gt;\n  &lt;disabled&gt;no&lt;\/disabled&gt;\n  &lt;command&gt;example-response&lt;\/command&gt;\n  &lt;location&gt;local&lt;\/location&gt;\n  &lt;rules_id&gt;100100&lt;\/rules_id&gt;\n&lt;\/active-response&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>local<\/code>&nbsp;means the response executes on the agent that generated the matching alert.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.4 Hands-on: create a harmless Active Response<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Rather than modifying firewall rules, this lab will automatically record a response in the agent&#8217;s Active Response log whenever rule&nbsp;<code>100100<\/code>&nbsp;fires.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This demonstrates end-to-end automation without network disruption.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create the response script<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \\\n  \/var\/ossec\/active-response\/bin\/wazuh-lab-notify.py\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the complete script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>#!\/usr\/bin\/env python3<\/em>\n\nimport json\nimport sys\nfrom datetime import datetime, timezone\n\nLOG_FILE = \"\/var\/ossec\/logs\/active-responses.log\"\n\ndef main():\n    try:\n        message = json.loads(sys.stdin.readline())\n    except (json.JSONDecodeError, ValueError):\n        return 1\n\n    if message.get(\"command\") != \"add\":\n        return 0\n\n    alert = (\n        message.get(\"parameters\", {})\n        .get(\"alert\", {})\n    )\n\n    rule = alert.get(\"rule\", {})\n    data = alert.get(\"data\", {})\n\n    rule_id = rule.get(\"id\", \"unknown\")\n    src_ip = data.get(\"srcip\", \"unknown\")\n\n    timestamp = datetime.now(\n        timezone.utc\n    ).isoformat()\n\n    with open(\n        LOG_FILE,\n        \"a\",\n        encoding=\"utf-8\"\n    ) as log_file:\n        log_file.write(\n            f\"{timestamp} \"\n            f\"wazuh-lab-notify: \"\n            f\"rule_id={rule_id} \"\n            f\"srcip={src_ip}\\n\"\n        )\n\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The script implements Wazuh&#8217;s stateless Active Response approach: read JSON from standard input, check for the&nbsp;<code>add<\/code>&nbsp;command, extract alert information, and perform a one-time action.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Set permissions<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown root:wazuh \\\n  \/var\/ossec\/active-response\/bin\/wazuh-lab-notify.py\n\nsudo chmod 750 \\\n  \/var\/ossec\/active-response\/bin\/wazuh-lab-notify.py\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Validate the Python syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo python3 -m py_compile \\\n  \/var\/ossec\/active-response\/bin\/wazuh-lab-notify.py\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart wazuh-agent\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Test the script independently<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This verifies that the script can process a simulated Active Response JSON message before Wazuh invokes it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s\\n' \\\n  '{\"command\":\"add\",\"parameters\":{\"alert\":{\"rule\":{\"id\":\"100100\"},\"data\":{\"srcip\":\"192.0.2.15\"}}}}' \\\n  | sudo \/var\/ossec\/active-response\/bin\/wazuh-lab-notify.py\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 10 \\\n  \/var\/ossec\/logs\/active-responses.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If this succeeds, you should see a&nbsp;<code>wazuh-lab-notify<\/code>&nbsp;entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This verifies the standalone script, not yet the complete Wazuh response integration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Register the command on the server<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp -a \/var\/ossec\/etc\/ossec.conf \\\n  \/var\/ossec\/etc\/ossec.conf.pre-active-response\n\nsudo nano \/var\/ossec\/etc\/ossec.conf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the existing&nbsp;<code>&lt;ossec_config&gt;<\/code>&nbsp;element, add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;command&gt;\n  &lt;name&gt;wazuh-lab-notify&lt;\/name&gt;\n  &lt;executable&gt;wazuh-lab-notify.py&lt;\/executable&gt;\n  &lt;timeout_allowed&gt;no&lt;\/timeout_allowed&gt;\n&lt;\/command&gt;\n\n&lt;active-response&gt;\n  &lt;disabled&gt;no&lt;\/disabled&gt;\n  &lt;command&gt;wazuh-lab-notify&lt;\/command&gt;\n  &lt;location&gt;local&lt;\/location&gt;\n  &lt;rules_id&gt;100100&lt;\/rules_id&gt;\n&lt;\/active-response&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not remove the other Active Response definitions already present in the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Validate detection-related configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/wazuh-analysisd -t\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the Wazuh manager:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart wazuh-manager\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Trigger the response<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent, append a new event:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s %s wazuh-lab: AUTH_FAIL username=testuser srcip=192.0.2.15\\n' \\\n  \"$(date '+%b %e %T')\" \\\n  \"$(hostname -s)\" \\\n  | sudo tee -a \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the agent-side response log:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 20 \\\n  \/var\/ossec\/logs\/active-responses.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected outcome:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The agent collects the event.<\/li>\n\n\n\n<li>The server decoder identifies the event.<\/li>\n\n\n\n<li>Rule\u00a0<code>100100<\/code>\u00a0generates an alert.<\/li>\n\n\n\n<li>Wazuh invokes the configured response on the agent.<\/li>\n\n\n\n<li>The Python script records the response.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If the response doesn&#8217;t execute, inspect the manager and agent&nbsp;<code>ossec.log<\/code>&nbsp;files and confirm the rule ID actually fired.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.5 Understand automated IP blocking<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh includes a&nbsp;<code>firewall-drop<\/code>&nbsp;Active Response script on supported Linux systems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following example is based on the vendor&#8217;s SSH brute-force demonstration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;active-response&gt;\n  &lt;disabled&gt;no&lt;\/disabled&gt;\n  &lt;command&gt;firewall-drop&lt;\/command&gt;\n  &lt;location&gt;local&lt;\/location&gt;\n  &lt;rules_id&gt;5763&lt;\/rules_id&gt;\n  &lt;timeout&gt;180&lt;\/timeout&gt;\n&lt;\/active-response&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is a reference configuration,&nbsp;<strong>not an instruction to enable blocking on your existing machines<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rule&nbsp;<code>5763<\/code>&nbsp;represents a built-in SSH brute-force detection scenario. A corresponding&nbsp;<code>firewall-drop<\/code>&nbsp;command definition and suitable firewall tooling must also be present.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before testing such a response in a dedicated lab, verify that you have console access, the appropriate firewall backend, a reversible timeout, and an independent management connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For production systems, also implement exceptions for trusted administration addresses and test the rollback behavior.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.6 Security integrations<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh can integrate with other tools to support security operations.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Integration<\/th><th class=\"has-text-align-left\" data-align=\"left\">Example purpose<\/th><\/tr><\/thead><tbody><tr><td>Slack or team messaging<\/td><td>Send selected security notifications<\/td><\/tr><tr><td>Jira or incident management<\/td><td>Track investigations and remediation<\/td><\/tr><tr><td>Threat intelligence<\/td><td>Enrich findings with external reputation data<\/td><\/tr><tr><td>AWS<\/td><td>Collect supported cloud security and audit telemetry<\/td><\/tr><tr><td>Docker and Kubernetes<\/td><td>Monitor supported container and host security events<\/td><\/tr><tr><td>APIs and automation<\/td><td>Query agents and manage security configuration<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Integrations differ in supported versions and configuration requirements. Some require additional scripts, credentials, permissions, or collectors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.7 Basic Wazuh API demonstration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Wazuh exposes a REST API for management and automation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To avoid placing administrator passwords in a command, use the dashboard&#8217;s authenticated&nbsp;<strong>Server management \u2192 Dev Tools<\/strong>&nbsp;interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Execute a read-only request:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/agents?limit=10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The response provides information about available agents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For production automation, create an appropriately restricted account or API integration identity rather than using unrestricted administrator credentials.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">11.8 Production best practices<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For Active Response and integrations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use least-privilege identities and restrict which systems can execute response commands.<\/li>\n\n\n\n<li>Protect webhook URLs, API tokens, and integration credentials.<\/li>\n\n\n\n<li>Avoid automatically disabling accounts or blocking network access based on weak detections.<\/li>\n\n\n\n<li>Test responses in staging before production.<\/li>\n\n\n\n<li>Log every automated action.<\/li>\n\n\n\n<li>Define ownership, escalation, and rollback procedures.<\/li>\n\n\n\n<li>Review noisy or frequently triggered automation.<\/li>\n\n\n\n<li>Restrict and audit changes to response scripts.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exercise:<\/strong>&nbsp;Generate an event that triggers your harmless Active Response script and verify the resulting agent-side log entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Knowledge check<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What does&nbsp;<code>location=local<\/code>&nbsp;mean in an Active Response configuration?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: The action runs on the monitored agent associated with the triggering event.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Q: What is the difference between stateless and stateful responses?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A: A stateless response performs a one-time action. A stateful response supports reversing or stopping the action after a specified timeout.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial 12 \u2014 End-to-End Security Monitoring Mini Lab<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">5 minutes | Final integrated exercise<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">12.1 Objective<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your final task is to connect everything learned in the previous tutorials into one functioning security monitoring workflow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By this point, the environment should already contain:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A running Wazuh server and dashboard<\/li>\n\n\n\n<li>An enrolled Ubuntu agent<\/li>\n\n\n\n<li>A monitored application log<\/li>\n\n\n\n<li>Custom decoder\u00a0<code>wazuh-lab<\/code><\/li>\n\n\n\n<li>Custom detection rule\u00a0<code>100100<\/code><\/li>\n\n\n\n<li>File Integrity Monitoring<\/li>\n\n\n\n<li>SCA and vulnerability inventory<\/li>\n\n\n\n<li>A harmless Active Response script<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">12.2 Final architecture<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>flowchart TD\n    A&#91;\"Ubuntu monitored endpoint\"] --&gt; B&#91;\"Generate synthetic authentication event\"]\n    B --&gt; C&#91;\"Wazuh Logcollector\"]\n    C --&gt;|\"TCP 1514\"| D&#91;\"Wazuh manager\"]\n    D --&gt; E&#91;\"Custom decoder\"]\n    E --&gt; F&#91;\"Rule 100100\"]\n    F --&gt; G&#91;\"Security alert\"]\n    G --&gt; H&#91;\"Filebeat and indexer\"]\n    H --&gt; I&#91;\"Wazuh dashboard\"]\n    G --&gt; J&#91;\"Active Response\"]\n    J --&gt; K&#91;\"Write response log on Ubuntu endpoint\"]\n    I --&gt; L&#91;\"Investigate and document\"]\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">12.3 Execute the final lab<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1 \u2014 Confirm agent connectivity<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/var\/ossec\/bin\/agent_control -l\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that the Ubuntu agent is Active.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2 \u2014 Generate a security event<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>printf '%s %s wazuh-lab: AUTH_FAIL username=finaltest srcip=192.0.2.25\\n' \\\n  \"$(date '+%b %e %T')\" \\\n  \"$(hostname -s)\" \\\n  | sudo tee -a \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3 \u2014 Verify alert generation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 50 \\\n  \/var\/ossec\/logs\/alerts\/alerts.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find the alert associated with your synthetic event and confirm its rule ID, severity, username, and source IP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the optional repeated-failure correlation rule becomes the final match, inspect rule&nbsp;<code>100101<\/code>&nbsp;as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4 \u2014 Verify automated response<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -n 20 \\\n  \/var\/ossec\/logs\/active-responses.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Look for your custom response log entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the correlation rule is superseding rule&nbsp;<code>100100<\/code>&nbsp;during repeated testing, adjust the authorized lab Active Response configuration to match the intended rule IDs and retest.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5 \u2014 Investigate and explain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In the dashboard:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open Threat Hunting.<\/li>\n\n\n\n<li>Find the latest matching alert.<\/li>\n\n\n\n<li>Identify the monitored endpoint.<\/li>\n\n\n\n<li>Review the raw log and extracted fields.<\/li>\n\n\n\n<li>Explain why the detection rule matched.<\/li>\n\n\n\n<li>Confirm the response, if configured.<\/li>\n\n\n\n<li>Classify the event as an authorized training simulation.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You have now completed the complete event-to-detection-to-response workflow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">12.4 Final acceptance checklist<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[ ] Wazuh server and dashboard are running<\/li>\n\n\n\n<li>[ ] Ubuntu agent is enrolled and active<\/li>\n\n\n\n<li>[ ] System or application logs are being collected<\/li>\n\n\n\n<li>[ ] Custom decoder extracts the expected fields<\/li>\n\n\n\n<li>[ ] Custom rule generates the expected alert<\/li>\n\n\n\n<li>[ ] File creation or modification generates an FIM event<\/li>\n\n\n\n<li>[ ] SCA results and vulnerability inventory have been reviewed<\/li>\n\n\n\n<li>[ ] Security alert can be investigated in the dashboard<\/li>\n\n\n\n<li>[ ] Harmless Active Response has been tested<\/li>\n\n\n\n<li>[ ] Training event and investigation are documented<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Troubleshooting Reference<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Use this diagnostic sequence when a Wazuh lab does not work.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Symptom<\/th><th class=\"has-text-align-left\" data-align=\"left\">Diagnostic command<\/th><th class=\"has-text-align-left\" data-align=\"left\">What to resolve<\/th><\/tr><\/thead><tbody><tr><td>Manager not responding<\/td><td><code>systemctl status wazuh-manager<\/code><\/td><td>Service errors or configuration<\/td><\/tr><tr><td>Agent disconnected<\/td><td><code>agent_control -l<\/code>&nbsp;on server<\/td><td>Agent status and connectivity<\/td><\/tr><tr><td>Enrollment failing<\/td><td><code>nc -zv SERVER_IP 1515<\/code><\/td><td>Routing, firewall, enrollment<\/td><\/tr><tr><td>No events collected<\/td><td><code>wazuh-logcollector -t<\/code>&nbsp;on agent<\/td><td>Log path and collection configuration<\/td><\/tr><tr><td>Decoder not matching<\/td><td><code>wazuh-logtest<\/code>&nbsp;on server<\/td><td>Program name or regex<\/td><\/tr><tr><td>Custom rule not loading<\/td><td><code>wazuh-analysisd -t<\/code>&nbsp;on server<\/td><td>Invalid rule or decoder configuration<\/td><\/tr><tr><td>FIM not detecting<\/td><td><code>wazuh-syscheckd -t<\/code>&nbsp;on agent<\/td><td>Baseline, directory, scan settings<\/td><\/tr><tr><td>No dashboard alerts<\/td><td>Check manager alerts and indexer<\/td><td>Detection vs indexing problem<\/td><\/tr><tr><td>Vulnerability inventory empty<\/td><td>Check Syscollector and manager logs<\/td><td>Inventory and CTI processing<\/td><\/tr><tr><td>Active Response not running<\/td><td>Inspect&nbsp;<code>ossec.log<\/code>&nbsp;and response log<\/td><td>Script, permissions, command, rule ID<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For every fix, confirm success at the component where the failure originated before retrying the complete workflow. The official Wazuh configuration-validation reference documents the relevant daemon test commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lab cleanup and rollback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the exercises are complete, either preserve a VM snapshot or remove the training-specific changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the Ubuntu agent, inspect the temporary files before deleting them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls -la \/opt\/wazuh-lab\n\nsudo ls -l \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If they contain only disposable training data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo rm -r -- \/opt\/wazuh-lab\n\nsudo rm -- \/var\/log\/wazuh-lab.log\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the corresponding lab-specific&nbsp;<code>&lt;localfile&gt;<\/code>&nbsp;and FIM directory entries from the agent configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the Wazuh server, remove only the tutorial&#8217;s custom decoder, rules, and Active Response definitions when they are no longer needed. Validate the configuration and restart the affected services. Remove the custom response script from the agent after disabling its configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not overwrite entire configuration files from backups if unrelated changes have been made since those backups were created.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What to learn after this 3-hour course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you can independently complete the lab, the next areas to study are:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Advanced subject<\/th><th class=\"has-text-align-left\" data-align=\"left\">Why it matters<\/th><\/tr><\/thead><tbody><tr><td>Wazuh manager clustering and indexer HA<\/td><td>Production availability and scaling<\/td><\/tr><tr><td>Wazuh API and automation<\/td><td>Programmatic administration<\/td><\/tr><tr><td>Advanced detection engineering<\/td><td>Rules, correlations, false-positive tuning<\/td><\/tr><tr><td>Threat intelligence integrations<\/td><td>Enriched security investigations<\/td><\/tr><tr><td>AWS security monitoring<\/td><td>CloudTrail, GuardDuty, and other supported security telemetry<\/td><\/tr><tr><td>Container and Kubernetes monitoring<\/td><td>Workload and host security<\/td><\/tr><tr><td>Security data retention and index management<\/td><td>Cost, performance, and compliance<\/td><\/tr><tr><td>SIEM incident-response workflows<\/td><td>Operationalizing detections and escalation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Official documentation and references<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All version-specific installation methods and core configuration concepts were checked against these Wazuh resources:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Reference<\/th><th class=\"has-text-align-left\" data-align=\"left\">What it covers<\/th><\/tr><\/thead><tbody><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/release-notes\/release-4-14-8.html\">Wazuh 4.14.8 Release Notes<\/a><\/td><td>Verified stable release<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/quickstart.html\">Quickstart<\/a><\/td><td>All-in-one installation and resources<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/getting-started\/architecture.html\">Architecture<\/a><\/td><td>Components, data flow, and ports<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/installation-guide\/wazuh-agent\/index.html\">Agent Installation<\/a><\/td><td>Linux, Windows, and macOS deployments<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/ruleset\/testing.html\">Testing Rules and Decoders<\/a><\/td><td>Detection validation<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/capabilities\/file-integrity\/index.html\">File Integrity Monitoring<\/a><\/td><td>File monitoring<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/capabilities\/sec-config-assessment\/index.html\">Security Configuration Assessment<\/a><\/td><td>Hardening policy assessments<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/capabilities\/vulnerability-detection\/index.html\">Vulnerability Detection<\/a><\/td><td>Software vulnerability inventory<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/capabilities\/active-response\/index.html\">Active Response<\/a><\/td><td>Automated response<\/td><\/tr><tr><td><a href=\"https:\/\/documentation.wazuh.com\/current\/user-manual\/api\/index.html\">Wazuh API<\/a><\/td><td>Integrations and automation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Final learning outcome<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After studying all 12 tutorials and completing the labs, you should be able to build a small Wazuh deployment, onboard endpoints, collect security events, develop and test basic detection rules, monitor file changes, review security posture and vulnerabilities, investigate alerts, and implement a safe automated response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This establishes a&nbsp;<strong>practical beginner-to-intermediate foundation in Wazuh<\/strong>. It does not yet make the deployment production-ready; that requires additional work on reliability, certificates, identity management, data retention, scaling, detection quality, and incident-response operations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Verification limitation:<\/strong>&nbsp;The installation methods, command interfaces, and configuration concepts were checked against official Wazuh documentation current to October 11, 2026. The complete lab was not executed against a live Wazuh installation in this conversation. Sample outputs represent expected behavior, and the custom training decoder, rules, and response should be validated in your own isolated environment before broader use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wazuh: The Complete Gold-Standard Tutorial Zero to Intermediate | Theory + Hands-on Labs + Real-World Security Monitoring Stable version:&nbsp;4.14.8Level:&nbsp;Beginner \u2192 IntermediateLast verified:&nbsp;11 October 2026Primary lab OS:&nbsp;Ubuntu 24.04&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1203","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/1203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/comments?post=1203"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1206,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/1203\/revisions\/1206"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/media?parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/categories?post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/tutorials\/wp-json\/wp\/v2\/tags?post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}