ahmspiii/-Suricata-IDS-Custom-detection-rules
GitHub: ahmspiii/-Suricata-IDS-Custom-detection-rules
一套用于 Suricata IDS 的自定义检测规则集与部署指南,帮助快速识别网络中的常见攻击行为。
Stars: 0 | Forks: 0
# -Suricata-IDS-自定义检测规则
一个使用 Suricata IDS 在实时 Linux 环境中检测实时网络攻击和可疑流量模式的网络安全隐患实战项目。
## 📌 本规则检测内容
| # | 规则 | SID | 描述 |
|---|------|-----|-------------|
| 1 | DoS 攻击检测 | 200001 | 指向服务器的高容量 TCP 流量泛洪 |
| 2 | SSH 暴力破解检测 | 200002 | 来自同一源的重复 SSH 登录尝试 |
| 3 | 端口扫描检测 | 200003 | 跨端口 SYN 标志扫描 |
| 4 | 过量 DNS 请求 | 200009 | 可能的 DNS 隧道 / 数据渗出 |
## 📝 规则
```
# DoS 攻击检测
alert tcp any any -> any any (msg:"Possible DoS attack"; flow:to_server; threshold:type both, track by_src, count 100, seconds 10; sid:200001; rev:1;)
# SSH 暴力破解检测
alert tcp any any -> any 22 (msg:"Possible SSH brute force"; flow:to_server; threshold:type both, track by_src, count 10, seconds 60; sid:200002; rev:1;)
# Port 扫描检测
alert tcp any any -> any any (msg:"Port scan detected"; flags:S; threshold:type both, track by_src, count 20, seconds 10; sid:200003; rev:1;)
# 过量 DNS 请求(可能为 DNS 隧道)
alert udp any any -> any 53 (msg:"Excessive DNS requests"; threshold:type both, track by_src, count 50, seconds 30; sid:200009; rev:1;)
```
## 🧰 环境
| 组件 | 详情 |
|-----------|---------|
| OS | Ubuntu |
| IDS Engine | Suricata |
| Interface | `eth0` (或您的活动 NIC) |
| Config | `/etc/suricata/suricata.yaml` |
| Logs | `/var/log/suricata/fast.log` |
## ⚙️ 设置与安装
### 1. 安装 Suricata
```
sudo apt install suricata -y
```
### 2. 查找您的网络接口
```
ip a
```
### 3. 配置 Suricata
```
sudo mousepad /etc/suricata/suricata.yaml
```
更新 `HOME_NET` 以匹配您的网络范围。
### 4. 更新 Suricata 规则集
```
sudo suricata-update
```
### 5. 添加自定义规则
```
nano local.rules
```
粘贴上述规则,然后在 `suricata.yaml` 中注册该文件:
```
rule-files:
- /path/to/local.rules
```
## ✅ 验证与运行
### 测试配置
```
sudo suricata -T -c /etc/suricata/suricata.yaml -i eth0
```
### 开始捕获
```
sudo suricata -c /etc/suricata/suricata.yaml -i eth0
```
## 📊 监控警报
```
tail -f /var/log/suricata/fast.log
```
示例警报输出:
```
[**] [1:200002:1] Possible SSH brute force [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
01/01-12:00:00.000000 192.168.1.100:54321 -> 192.168.1.1:22
TCP TTL:64 TOS:0x0 ID:1337 IpLen:20 DgmLen:60 S
```
## 🗂️ 仓库结构
```
suricata-nids/
├── rules/
│ └── local.rules # All custom detection rules
├── configs/
│ └── suricata.yaml.example # Example Suricata configuration
├── screenshots/ # Alert screenshots
└── README.md
```
## 📚 参考资料
- [Suricata 官方文档](https://docs.suricata.io/)
- [Suricata 规则编写指南](https://docs.suricata.io/en/latest/rules/intro.html)
- [Emerging Threats 规则集](https://rules.emergingthreats.net/)
## 关于
本项目是对 **网络安全监控** 和 **入侵检测** 的实践深入探索。这里的一切都是基于实践的——真实的规则、真实的流量、真实的警报。
标签:AMSI绕过, Cutter, DNS隧道, DoS攻击, IP 地址批量处理, Metaprompt, PB级数据处理, SSH暴力破解, Suricata, Suricata规则, 入侵检测系统, 威胁检测, 安全数据湖, 安全运维, 实验环境, 应用层协议, 开原项目, 异常流量监控, 插件系统, 数据统计, 时间线生成, 现代安全运营, 端口扫描, 网络安全, 规则编写, 防御工程, 隐私保护