vtino17/wazuh-custom-decoders
GitHub: vtino17/wazuh-custom-decoders
为 Wazuh SIEM 提供针对 MikroTik、UniFi 等原生不支持设备的自定义日志解码器、检测规则与告警的生产级配置集合。
Stars: 0 | Forks: 0
# Wazuh 自定义解码器
适用于 Wazuh 原生不支持的基础设施的生产级 Wazuh SIEM 解码器、规则和告警。
## 为什么需要这个项目
Wazuh 为标准的 Linux/Windows 事件自带了出色的默认解码器,但自定义设备(MikroTik、UniFi)和企业应用日志需要手工编写的解码器。这个仓库通过经过实战检验的 XML 来填补这些空白。
## 目录
| 解码器 | 来源 | 用途 | 告警 |
|---------|--------|---------|--------|
| MikroTik | syslog :514 | 防火墙拦截、VPN 认证、用户登录、配置更改 | 25 |
| UniFi | syslog/JSON | AP 接入、客户端认证、网关事件 | 12 |
| Windows Security | EventLog | 自定义审计策略事件 | 18 |
| SSH Auth | syslog | 带有地理信息丰富的暴力破解检测 | 8 |
| NGINX | JSON log | 4xx/5xx 激增、路径遍历尝试 | 10 |
## 快速安装
```
git clone https://github.com/vtino17/wazuh-custom-decoders.git
cd wazuh-custom-decoders
# 复制 decoders
cp decoders/*.xml /var/ossec/etc/decoders/
# 复制 rules
cp rules/*.xml /var/ossec/etc/rules/
# 重启 Wazuh manager
systemctl restart wazuh-manager
# 验证
/var/ossec/bin/wazuh-logtest
```
## 解码器:MikroTik 防火墙拦截
```
firewall,info forward: in:br-guest out:bridge-local ...
```
**解码器** (`decoders/0020-mikrotik-decoder.xml`):
```
^<\d+>
^<(\d+)>(\S+) (\S+) (\S+)\s+(\S+),(\S+) \S+: (\S+)
facility, timestamp, hostname, process, topics, logtype, detail
mikrotik
^firewall
^firewall,(\S+) \S+: (\S+): in:(\S+) out:(\S+), src-mac (\S+), proto (\S+) (\S+):(\S+)->(\S+):(\S+), len (\d+)%
topic, action, in_interface, out_interface, src_mac, protocol, src_ip, src_port, dst_ip, dst_port, length
```
**规则** (`rules/0020-mikrotik-rules.xml`):
```
mikrotik
MikroTik generic event
100001
action:forward
action:drop
MikroTik: Firewall dropped packet (forward)
firewall,attack,
100001
action:input
action:drop
MikroTik: Firewall dropped packet (input)
100001
admin login
MikroTik: Admin user logged in
authentication_success,pci_dss_10.2.5,
```
## 规则:SSH 暴力破解
```
5715
SSH Brute-force: 15+ failures in 2 minutes
authentication_failures,recon,
```
## 规则:NGINX LFI 尝试
```
100029
\.\./|\.\.\\|/etc/passwd|/proc/self
NGINX: Path traversal / LFI attempt detected
web_attack,lfi,
```
## 测试
```
# 测试 MikroTik syslog 条目
echo '<14>Jul 21 08:15:00 mikrotik-lan firewall,info forward: in:br-guest out:bridge-local, src-mac AA:BB:CC:DD:EE:FF, proto TCP 10.0.30.5:54321->192.168.1.1:443, len 60' | \
/var/ossec/bin/wazuh-logtest
# 测试 UniFi adoption 事件
echo '<14>Jul 21 08:15:00 unifi-controller uap-ac-lite: Device adopted by admin@admin' | \
/var/ossec/bin/wazuh-logtest
```
## 文件结构
```
wazuh-custom-decoders/
├── decoders/
│ ├── 0020-mikrotik-decoder.xml
│ ├── 0021-unifi-decoder.xml
│ └── 0022-windows-custom-decoder.xml
├── rules/
│ ├── 0020-mikrotik-rules.xml
│ ├── 0021-unifi-rules.xml
│ └── 0022-windows-custom-rules.xml
├── scripts/
│ └── deploy.sh
├── tests/
│ ├── test-mikrotik-firewall.sh
│ └── test-unifi-adoption.sh
└── README.md
```
## 环境要求
- Wazuh Manager 4.7+
- Python 3.8+(用于辅助脚本)
- 来自 MikroTik/Unifi 设备的 Syslog 转发
标签:逆向工具