rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
cat > /etc/yum.repos.d/wazuh.repo << EOF
[wazuh]
gpgcheck=1
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
name=EL-$releasever - Wazuh
baseurl=https://packages.wazuh.com/4.x/yum/
protect=1
EOF
yum install wazuh-manager
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list
apt-get update
apt-get install wazuh-manager
helpful vim configuation snippets
" automatically test the rules when saving them
autocmd BufWritePost /var/ossec/etc/rules/local_rules.xml !echo 'Mar 8 22:39:13 ip-10-0-0-10 sshd[2742]: Accepted publickey for root from 73.189.131.56 port 57516' | /var/ossec/bin/wazuh-logtest
" add syntax higlighting to the ossec configuation
autocmd BufRead /var/ossec/etc/ossec.conf set filetype=xml
Reference: https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/index.html
add email alerts to the config file: vim /var/ossec/etc/ossec.conf
<ossec_config>
<global>
<jsonout_output>yes</jsonout_output>
<alerts_log>yes</alerts_log>
<logall>no</logall>
<logall_json>no</logall_json>
<email_notification>yes</email_notification>
<smtp_server>/usr/sbin/sendmail -t</smtp_server>
<email_from>wazuh@host</email_from>
<email_to>[email protected]</email_to>
<email_maxperhour>12</email_maxperhour>
<email_log_source>alerts.log</email_log_source>
</global>
<alerts>
<log_alert_level>3</log_alert_level>
<email_alert_level>7</email_alert_level>
</alerts>
Re-configure the netstat command for more actionable alerts
vim /var/ossec/etc/ossec.conf
<localfile>
<log_format>full_command</log_format>
<command>netstat -plnt | awk '$4 !~ /127\.0\.0\.(1|53)/ {print ;}' | grep -v "0.0.0.0:55000" | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == /' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d</command>
<alias>netstat listening ports</alias>
<frequency>3600</frequency>
</localfile>
Reference: https://documentation.wazuh.com/current/user-manual/capabilities/vulnerability-detection/running-vu-scan.html
Reference: https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/vuln-detector.html
allow an OS such as Linux Mint or Alma - https://documentation.wazuh.com/current/user-manual/capabilities/vulnerability-detection/allow-os.html
vim /var/ossec/etc/ossec.conf
- ensure the syscollector module is enabled
- enable the vulnerability collector
systemctl restart wazuh-manager
tail -f /var/ossec/logs/ossec.log # monitor the logs for any issues
wazuh_auditd.xml
contains rules to alert on auditd alerts
wazuh_local_rules.xml
contains rules to tune noisy alerts. ℹ️ these tuning rules are meant to be applied as needed, not applied by default.
ID range | Comment | ||
---|---|---|---|
100000-199999 | Contains tuning rules that I believe are appropriate for all systems. | ||
200000-299999 | Contains custom auditd rules. | ||
300000-399999 | Contains placeholder tuning rules that are meant to be applied as needed. |