brianchaplow/HomeLab-SOC
GitHub: brianchaplow/HomeLab-SOC
在消费级 NAS 硬件上构建覆盖边缘防护、网络入侵检测和 SIEM 日志分析的生产级安全运营中心,实现对真实 Web 流量的自动化威胁检测与拦截。
Stars: 0 | Forks: 0
# 🛡️ HomeLab SOC
[](https://opensearch.org/)
[](https://suricata.io/)
[](https://docker.com/)
[](https://cloudflare.com/)
[](https://tailscale.com/)
一个基于消费级硬件构建的生产级安全运营中心(SOC),展示了在家庭实验室环境中的企业级安全监控能力。
**实时基础设施:** 此 SOC 正在积极监控 [brianchaplow.com](https://brianchaplow.com) 和 [bytesbourbonbbq.com](https://bytesbourbonbbq.com),处理真实的攻击流量并自动拦截威胁。
## 项目概述
本项目实现了跨越三个架构层级的完整安全监控技术栈:
| 层级 | 平台 | 组件 |
|-------|----------|------------|
| **边缘安全** | Cloudflare | WAF, Bot Fight Mode, JA3 指纹识别, 自动拦截 |
| **Web 托管** | Google Cloud | Apache/HTTP2, Umami Analytics, Fluent Bit |
| **SOC 基础设施** | QNAP NAS | OpenSearch SIEM, Suricata IDS, 自动化威胁情报 |
### 核心指标
- **47,290** 条 Suricata 检测规则(ET Open 规则集)
- **100+** 个在边缘被自动拦截的恶意 IP
- **15 分钟**的威胁情报富化周期
- 基于 GeoIP 可视化的**实时**仪表盘
- 通过 Tailscale mesh 实现的**零信任**连接
## 架构
```
┌─────────────────┐
│ INTERNET │
└────────┬────────┘
│
┌──────────────────▼──────────────────┐
│ CLOUDFLARE (Edge) │
│ • WAF + Managed Rules │
│ • Bot Fight Mode │
│ • JA3 TLS Fingerprinting │
│ • Auto-block API (score ≥90) │
│ • Geo Headers → Origin │
└──────────────────┬──────────────────┘
│
┌──────────────────▼──────────────────┐
│ GOOGLE CLOUD VM (Web) │
│ • Apache + Let's Encrypt │
│ • Umami Analytics │
│ • Fluent Bit → Tailscale → NAS │
└──────────────────┬──────────────────┘
│
TAILSCALE VPN MESH
(Encrypted WireGuard)
│
┌──────────────────────────────────────▼─────────────────────────────────────┐
│ QNAP NAS (SOC Stack) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ OpenSearch │ │ Suricata │ │ Fluent Bit │ │ SOC │ │
│ │ (SIEM) │ │ (NIDS) │ │ (Ingest) │ │ Automation │ │
│ │ Port 9200 │ │ SPAN Port │ │ Port 5514 │ │ (Python) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ OpenSearch │ │ Zeek │ │ CyberChef │ + GeoIP Enrichment │
│ │ Dashboards │ │ (NSM) │ │ (Analysis) │ + AbuseIPDB Lookup │
│ │ Port 5601 │ │ │ │ Port 8000 │ + Discord Alerts │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└────────────────────────────────────────────────────────────────────────────┘
```
## 组件
### 网络监控
| 工具 | 用途 | 配置 |
|------|---------|---------------|
| **Suricata** | 拥有 4.7 万+ 条规则的网络 IDS | 通过管理型交换机进行 SPAN 端口捕获 |
| **Zeek** | 网络安全监控器 | 协议分析和连接日志 |
| **Fluent Bit** | 日志聚合 | 多源收集至 OpenSearch |
### SIEM 与可视化
| 工具 | 用途 | 特性 |
|------|---------|----------|
| **OpenSearch** | 日志存储与搜索 | 数据摄入管道, GeoIP 富化 |
| **OpenSearch Dashboards** | 可视化 | 自定义安全仪表盘 |
### 自动化
| 脚本 | 计划任务 | 功能 |
|--------|----------|----------|
| `enrichment.py` | 每 15 分钟 | 查询 AbuseIPDB 获取威胁评分 |
| `autoblock.py` | 每小时 | 将高风险 IP 推送到 Cloudflare 拦截列表 |
| `digest.py` | 每天 0600/1800 | 海军风格的值班交接报告 |
### 网络基础设施
```
┌────────────────────────────────────────────────────────────┐
│ TP-Link TL-SG108E Managed Switch │
│ │
│ Port 1: Router uplink Port 5: Eufy Security Hub │
│ Port 2: Windows Laptop Port 6: Available │
│ Port 3: Kali Machine Port 7: Available │
│ Port 4: Hue Bridge Port 8: SPAN → QNAP eth4 │
│ │
│ Mirror Config: Ports 1-7 (ingress+egress) → Port 8 │
└────────────────────────────────────────────────────────────┘
```
## 仓库结构
```
HomeLab-SOC/
├── README.md
├── configs/
│ ├── .env.example # Environment variables template
│ ├── docker-compose.yml # Full SOC container stack
│ ├── fluent-bit/
│ │ ├── fluent-bit-qnap.conf # NAS-side log collection
│ │ ├── fluent-bit-vm.conf # GCP VM Apache logs
│ │ ├── parsers-qnap.conf # Syslog & JSON parsers
│ │ └── parsers-vm.conf # Apache log parser with geo
│ └── opensearch/
│ └── geoip-pipeline.json # MaxMind GeoLite2 enrichment
├── scripts/
│ └── soc-startup.sh # QNAP boot initialization
├── dashboards/
│ └── (exported .ndjson files)
├── docs/
│ └── architecture.md # Detailed documentation
└── screenshots/
└── (dashboard images)
```
## 快速开始
### 前置条件
- Docker & Docker Compose
- QNAP NAS(或任何支持 Docker 的 Linux 服务器)
- Cloudflare 账户(免费版即可)
- AbuseIPDB API 密钥(免费版:每天 1000 次查询)
- MaxMind GeoLite2 许可证(免费)
### 部署
1. **克隆仓库**
git clone https://github.com/brianchaplow/HomeLab-SOC.git
cd HomeLab-SOC
2. **配置环境变量**
cp configs/.env.example configs/.env
# 使用您的凭据编辑 .env
3. **部署技术栈**
cd configs
docker-compose up -d
4. **访问仪表盘**
- OpenSearch Dashboards: `http://:5601`
- CyberChef: `http://:8000`
有关详细的设置说明,请参阅 [docs/architecture.md](docs/architecture.md)。
## 仪表盘
- **NIDS 概览** - Suricata 警报、流量、协议分布
- **Web 流量分析** - 访客指纹、地理分布、威胁评分
- **Windows 安全** - Sysmon 事件、进程执行、网络连接
## 路线图
- [x] 核心 SIEM 基础设施(OpenSearch + Fluent Bit)
- [x] 网络 IDS(Suricata 与 ET Open 规则)
- [x] 自动化威胁情报(AbuseIPDB)
- [x] 边缘自动拦截(Cloudflare API)
- [x] GeoIP 富化(MaxMind + Cloudflare 标头)
- [x] 安全远程访问(Tailscale mesh)
- [ ] 用于 Windows 检测的 Sigma 规则
- [ ] Atomic Red Team 验证
- [ ] 索引生命周期管理
- [ ] 额外的检测仪表盘
## 技术栈
| 类别 | 技术 |
|----------|-------------|
| **SIEM** | OpenSearch, OpenSearch Dashboards |
| **网络安全** | Suricata, Zeek |
| **日志流水线** | Fluent Bit |
| **边缘安全** | Cloudflare WAF, Bot Fight Mode |
| **威胁情报** | AbuseIPDB, MaxMind GeoLite2 |
| **连接** | Tailscale (WireGuard) |
| **容器** | Docker, Docker Compose |
| **自动化** | Python, Cron |
| **告警** | Discord Webhooks, Email |
## 作者
**Brian Chaplow**
- 网站:[brianchaplow.com](https://brianchaplow.com)
- LinkedIn:[linkedin.com/in/brianchaplow](https://linkedin.com/in/brianchaplow)
- GitHub:[@brianchaplow](https://github.com/brianchaplow)
## 许可证
本项目基于 MIT 许可证授权 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。
## 致谢
- [Emerging Threats Open](https://rules.emergingthreats.net/) - Suricata 规则集
- [SwiftOnSecurity](https://github.com/SwiftOnSecurity/sysmon-config) - Sysmon 配置灵感
- [AbuseIPDB](https://abuseipdb.com) - 威胁情报 API
- [MaxMind](https://maxmind.com) - GeoIP 数据库
标签:Docker, IP 地址批量处理, Metaprompt, 入侵检测系统, 威胁拦截, 安全数据湖, 安全运营中心, 安全防御评估, 版权保护, 网络映射, 请求拦截, 运维与基础设施, 逆向工具