WazuhAgentConfigActive ResponseSysmonFIM

Wazuh Agent — Config & Response

Konfigurasi ossec.conf, tambah log sources, active response, Sysmon integration, dan FIM advanced.

25 min read2026-04-07

1. 01 — ossec.conf — Agent Configuration

File konfigurasi utama: /var/ossec/etc/ossec.conf (Linux/Mac) atau C:\Program Files (x86)\ossec-agent\ossec.conf (Windows).


2. Section: <server> — Koneksi ke Manager

text
<ossec_config>
  <client>
    <server>
      <address>192.168.1.10</address>
      <port>1514</port>
      <protocol>tcp</protocol>
    </server>
    <server>
      <address>192.168.1.11</address>
    </server>
    <notify_time>10</notify_time>
    <time-reconnect>60</time-reconnect>
  </client>
</ossec_config>

3. Section: <localfile> — Log Sources

text
<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/syslog</location>
</localfile>

<localfile>
  <log_format>syslog</log_format>
  <location>/var/log/auth.log</location>
</localfile>

<localfile>
  <log_format>apache</log_format>
  <location>/var/log/apache2/access.log</location>
</localfile>

<localfile>
  <log_format>json</log_format>
  <location>/var/log/myapp/events.json</location>
</localfile>

4. Section: <syscheck> — FIM

text
<syscheck>
  <disabled>no</disabled>
  <frequency>43200</frequency>
  <directories check_all="yes" realtime="yes">/etc,/usr/bin,/usr/sbin</directories>
  <directories check_all="yes" realtime="yes">/bin,/sbin,/boot</directories>
  <ignore>/etc/mtab</ignore>
  <ignore type="sregex">.log$|.swp$</ignore>
</syscheck>

5. Section: <rootcheck> & <syscollector>

text
<rootcheck>
  <disabled>no</disabled>
  <frequency>36000</frequency>
</rootcheck>

<wodle name="syscollector">
  <disabled>no</disabled>
  <interval>1h</interval>
  <scan_on_start>yes</scan_on_start>
  <hardware>yes</hardware>
  <os>yes</os>
  <network>yes</network>
  <packages>yes</packages>
  <ports all="no">yes</ports>
  <processes>yes</processes>
</wodle>

Setelah edit ossec.conf: Selalu restart agent! sudo systemctl restart wazuh-agent. Cek log untuk error parsing XML.


6. 02 — Centralized Configuration

Push konfigurasi dari Manager pakai agent.conf — nggak perlu SSH ke setiap agent.


7. agent.conf (di Manager)

text
<!-- /var/ossec/etc/shared/webservers/agent.conf -->
<agent_config>
  <localfile>
    <log_format>apache</log_format>
    <location>/var/log/apache2/access.log</location>
  </localfile>
  <localfile>
    <log_format>apache</log_format>
    <location>/var/log/apache2/error.log</location>
  </localfile>
  <syscheck>
    <directories check_all="yes" realtime="yes">/var/www/html</directories>
    <directories check_all="yes" realtime="yes">/etc/apache2</directories>
  </syscheck>
</agent_config>

8. ossec.conf vs agent.conf

Aspekossec.conf (lokal)agent.conf (centralized)
Lokasi editDi setiap agentDi Manager, per group
ScopeSatu agentSemua agent di group
DeployManual (SSH)Otomatis push
PriorityDi-override oleh agent.confMenang kalau konflik

9. 03 — Windows Event Channels

text
<localfile>
  <location>Security</location>
  <log_format>eventchannel</log_format>
</localfile>

<localfile>
  <location>System</location>
  <log_format>eventchannel</log_format>
</localfile>

<localfile>
  <location>Microsoft-Windows-Sysmon/Operational</location>
  <log_format>eventchannel</log_format>
</localfile>

<localfile>
  <location>Microsoft-Windows-PowerShell/Operational</location>
  <log_format>eventchannel</log_format>
</localfile>

<localfile>
  <location>Microsoft-Windows-Windows Defender/Operational</location>
  <log_format>eventchannel</log_format>
</localfile>

10. 04 — Active Response

Otomatis ambil tindakan saat rule trigger: block IP, disable account, kirim notifikasi.

Active Response bisa auto-block IP legitimate kalau salah konfigurasi. Selalu test di staging dulu. Gunakan whitelist untuk management IP.


11. Built-in Commands

CommandFungsiPlatform
firewall-dropBlock IP di iptables/netshLinux, Windows
host-denyTambah IP ke /etc/hosts.denyLinux
disable-accountDisable user accountLinux, Windows
restart-wazuhRestart Wazuh agent/managerAll

12. Active Response Config (Manager)

text
<command>
  <name>firewall-drop</name>
  <executable>firewall-drop</executable>
  <timeout_allowed>yes</timeout_allowed>
</command>

<active-response>
  <command>firewall-drop</command>
  <location>local</location>
  <rules_id>5763</rules_id>
  <timeout>600</timeout>
</active-response>

<global>
  <white_list>10.0.0.1</white_list>
  <white_list>192.168.1.0/24</white_list>
</global>

13. Custom: Slack Notification Script

bash
#!/bin/bash
# /var/ossec/active-response/bin/slack-notify.sh
read INPUT_JSON

ALERT_MSG=$(echo $INPUT_JSON | jq -r '.parameters.alert.rule.description')
ALERT_LEVEL=$(echo $INPUT_JSON | jq -r '.parameters.alert.rule.level')
SRC_IP=$(echo $INPUT_JSON | jq -r '.parameters.alert.data.srcip')
AGENT_NAME=$(echo $INPUT_JSON | jq -r '.parameters.alert.agent.name')

WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"

curl -s -X POST "$WEBHOOK_URL" \
  -H 'Content-Type: application/json' \
  -d "{ \"text\": \"Wazuh Alert (Level $ALERT_LEVEL)\\n$ALERT_MSG\\nAgent: $AGENT_NAME\\nSource: $SRC_IP\" }"

14. 05 — Sysmon + Wazuh (Windows)

Sysmon dari Microsoft Sysinternals = game changer untuk Windows endpoint monitoring. Tanpa Sysmon, kamu buta terhadap process-level activity.


15. Tanpa vs Dengan Sysmon

Event TypeTanpa SysmonDengan Sysmon
Process creationEvent 4688 — nama proses sajaSysmon 1 — full command line, parent, hash
Network connectionFirewall log (terbatas)Sysmon 3 — proses mana konek ke IP mana
File creationTidak adaSysmon 11 — file baru oleh proses apa
Registry changesAudit policy (ribet)Sysmon 12/13/14 — create, modify, delete
DNS queriesTidak adaSysmon 22 — proses mana query domain apa

16. Install Sysmon

text
# Download config SwiftOnSecurity
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml" -OutFile sysmonconfig.xml

# Install Sysmon
.\Sysmon64.exe -accepteula -i sysmonconfig.xml

# Verify
Get-Service Sysmon64
Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" -MaxEvents 5

17. Best Practice

Sysmon + Wazuh Agent adalah minimum setup untuk Windows endpoint monitoring di SOC. Install Sysmon di SEMUA Windows endpoint.


18. 06 — FIM Advanced

Fitur advanced FIM: real-time monitoring, who-data, registry monitoring, dan tuning.


19. Who-Data — Track Siapa yang Ubah File

text
<syscheck>
  <directories check_all="yes" whodata="yes">/etc</directories>
  <directories check_all="yes" whodata="yes">/var/www/html</directories>
</syscheck>

Who-data butuh auditd aktif di Linux. Install: apt install auditd.


20. FIM Tuning & Ignore Patterns

text
<syscheck>
  <file_limit>
    <enabled>yes</enabled>
    <entries>200000</entries>
  </file_limit>
  <ignore>/etc/mtab</ignore>
  <ignore type="sregex">\.log$|\.tmp$|\.swp$</ignore>
  <directories check_all="yes" restrict=".conf$|.cfg$|.ini$">/etc</directories>
  <directories check_all="yes" recursion_level="3">/home</directories>
</syscheck>

21. Windows Registry Monitoring

text
<syscheck>
  <windows_registry arch="both">HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run</windows_registry>
  <windows_registry arch="both">HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce</windows_registry>
  <windows_registry arch="both">HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run</windows_registry>
  <windows_registry>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services</windows_registry>
  <windows_registry>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks</windows_registry>
</syscheck>

Prioritaskan Run, RunOnce, dan Services — ini yang paling umum dipakai malware untuk persistence.