atharva80/autonomous-soc-platform
GitHub: atharva80/autonomous-soc-platform
面向银行业的自治 SOC 平台第一阶段实现,整合 Vector、Wazuh、OpenSearch 构建日志采集、威胁检测与告警分析流水线,预置 14 条金融场景检测规则并支持 MITRE ATT&CK 与 PCI-DSS 合规映射。
Stars: 0 | Forks: 0
# 企业级银行自治 SOC 平台 — 第一阶段
## 架构
```
┌──────────────┐ ┌─────────┐ ┌───────────────┐ ┌────────────┐
│ Mock Bank Log │────▶│ Vector │────▶│ Wazuh Manager │────▶│ OpenSearch │
│ Generator │ │ (ingest) │ │ (detection) │ │(alerts_idx)│
└──────────────┘ └────┬─────┘ └───────────────┘ └─────┬──────┘
│ │
│ (parallel direct path) │
└───────────────────────────────────────▶│
│
┌────┴─────┐
│ Alert API│
│ (FastAPI)│
└──────────┘
```
**数据流:**
1. **Mock Generator** 发出银行日志事件(认证、交易、API 调用、管理员操作)
2. **Vector** 通过 HTTP 和文件进行摄入,并将其标准化为标准 schema
3. **Wazuh Manager** 应用自定义检测规则(暴力破解、撞库、可疑管理员行为)
4. **OpenSearch** 将原始标准化日志和 Wazuh 告警存储在 `alerts_index` 中
5. **Alert API** 提供 REST 端点以查询和分析告警
6. **RabbitMQ** 已安装,用于第二阶段的消费(持久化队列已就绪)
## 服务与端口
| Service | Port | Description |
|-----------------------|-------|--------------------------------------|
| Mock Generator | 8000 | 日志生成 API |
| Alert API | 8001 | 用于告警查询的 REST API |
| OpenSearch | 9200 | 搜索与分析引擎 |
| OpenSearch Dashboards | 5601 | 可视化 UI |
| Wazuh Manager API | 55000 | Wazuh 管理 API |
| Wazuh Syslog (UDP) | 1514 | 接收来自 Vector 的日志 |
| RabbitMQ | 5672 | 消息队列 (AMQP) |
| RabbitMQ Management | 15672 | RabbitMQ Web UI |
| Vector HTTP | 8686 | 日志摄入端点 |
## 前置条件
- **Docker** ≥ 24.x + **Docker Compose** v2+
- **Python** 3.11+ (用于本地开发)
- 至少 **4 GB RAM** 可用于容器(OpenSearch + Wazuh 非常消耗内存)
## 快速开始
### 1. 设置 vm.max_map_count (OpenSearch 必需)
```
sudo sysctl -w vm.max_map_count=262144
# 持久化配置:echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
```
### 2. 启动所有服务
```
cd /path/to/HACKOHIRE
docker compose up --build -d
```
### 3. 等待服务健康
```
# 检查 OpenSearch 健康状态
curl -sk -u admin:S0cPl@tform#2026! https://localhost:9200/_cluster/health | python3 -m json.tool
# 检查 Alert API
curl -s http://localhost:8001/health | python3 -m json.tool
# 检查 Mock Generator
curl -s http://localhost:8000/health | python3 -m json.tool
```
### 4. 生成测试事件
```
# 登录失败突发 (暴力破解)
curl -s "http://localhost:8000/emit?scenario=failed-logins-burst&count=20" | python3 -m json.tool
# 撞库
curl -s "http://localhost:8000/emit?scenario=credential-stuffing&count=30" | python3 -m json.tool
# 可疑管理员操作
curl -s "http://localhost:8000/emit?scenario=suspicious-admin&count=10" | python3 -m json.tool
# 横向移动
curl -s "http://localhost:8000/emit?scenario=lateral-movement" | python3 -m json.tool
# 数据渗出
curl -s "http://localhost:8000/emit?scenario=exfiltration" | python3 -m json.tool
# 随机事件
curl -s "http://localhost:8000/emit?scenario=random&count=50" | python3 -m json.tool
# 持续流 (30 秒内 5 事件/秒)
curl -s "http://localhost:8000/emit/continuous?rate=5&duration=30" | python3 -m json.tool
```
### 5. 查询告警
```
# 获取所有警报
curl -s http://localhost:8001/alerts | python3 -m json.tool
# 按事件类型过滤
curl -s "http://localhost:8001/alerts?event_type=auth_failure" | python3 -m json.tool
# 按用户过滤
curl -s "http://localhost:8001/alerts?user=user1@bankdemo.com" | python3 -m json.tool
# 全文搜索
curl -s "http://localhost:8001/alerts?q=brute+force" | python3 -m json.tool
# 警报统计
curl -s http://localhost:8001/alerts/stats/summary | python3 -m json.tool
# 直接 OpenSearch 查询
curl -sk -u admin:S0cPl@tform#2026! "https://localhost:9200/alerts_index/_search?pretty&size=5"
```
### 6. 运行自动化测试场景
```
chmod +x test-scenarios/*.sh
bash test-scenarios/run_all.sh
```
## 停止与清理
```
# 停止所有服务
docker compose down
# 停止并移除卷 (完全重置)
docker compose down -v
```
## 本地开发 (Python venv)
```
python3 -m venv venv
source venv/bin/activate
pip install -r alert-api/requirements.txt -r mock-generator/requirements.txt
```
## Wazuh 自定义规则
自定义检测规则位于 `wazuh/rules/local_rules.xml`:
| Rule ID | Level | Description |
|---------|-------|------------------------------------------------------|
| 100001 | 3 | 单次认证失败 |
| 100002 | 10 | 暴力破解:同一 IP 在 2 分钟内失败 5 次以上 |
| 100003 | 10 | 定向暴力破解:同一用户失败 5 次以上 |
| 100004 | 12 | 撞库:同一 IP 在 1 分钟内失败 20 次以上 |
| 100005 | 2 | 认证成功 |
| 100006 | 10 | 暴力破解后登录成功(可能已失陷) |
| 100010 | 5 | 管理员操作 |
| 100011 | 12 | 管理员禁用了 MFA |
| 100012 | 10 | 授予管理员角色(权限提升) |
| 100013 | 13 | 清除审计日志(反取证) |
| 100014 | 10 | 管理员导出数据(数据泄露风险) |
| 100015 | 11 | 高频管理员操作(2 分钟内 5 次以上) |
| 100020 | 2 | 金融交易 |
| 100021 | 8 | 大额/可疑交易 |
| 100030 | 2 | API 调用 |
| 100031 | 7 | 未授权 API 访问 (401/403) |
| 100032 | 6 | API 服务器错误 (500) |
## JSON Schemas
- `docs/schemas/normalized_log_event.json` — 标准日志事件 schema
- `docs/schemas/alert_object.json` — OpenSearch 中的告警对象
- `docs/schemas/incident_object.json` — 事件对象 (第二阶段)
## 凭证 (仅限原型)
| Service | Username | Password |
|------------|----------|-------------------|
| OpenSearch | admin | S0cPl@tform#2026! |
| Wazuh API | wazuh-wui| W@zuhAp1#Sec2026! |
| RabbitMQ | soc_user | soc_pass_secure |
标签:AMSI绕过, AV绕过, CCTV/网络接口发现, Cloudflare, FastAPI, MITRE ATT&CK, PCI-DSS, PE 加载器, RabbitMQ, SOC平台, Vector, Wazuh, 人工智能安全, 企业银行安全, 免杀技术, 合规性, 威胁检测, 安全运营中心, 对抗机器学习, 异常行为检测, 日志标准化, 日志管道, 暴力破解检测, 红队行动, 网络映射, 请求拦截, 逆向工具, 金融安全