CaHHaL/ThreatShield-Cloud-Native-Cyber-Defense-Monitoring-Platform
GitHub: CaHHaL/ThreatShield-Cloud-Native-Cyber-Defense-Monitoring-Platform
ThreatShield 是一个云原生网络安全监控平台,通过蜜罐捕获攻击数据并借助实时仪表板和威胁分类提升安全响应能力。
Stars: 1 | Forks: 0
# 🛡️ ThreatShield — 云原生网络防御平台





ThreatShield 是一个全面的云原生网络安全监控与威胁情报平台。它利用蜜罐网络捕获真实世界的攻击遥测数据,通过高性能异步后端处理数据,并通过 WebSocket 在基于 React 的安全运营中心仪表板上可视化实时威胁。
## ✨ 核心功能
- **主动防御蜜罐:** 部署 Cowrie (SSH/Telnet) 和一个基于 Flask 的定制化伪造企业网页登录门户,以诱捕攻击者并捕获遥测数据。
- **实时数据管道:** 异步 FastAPI 后端即时摄取蜜罐日志,利用 WebSocket 将实时攻击流式传输到前端。
- **威胁分类:** 自动计算威胁严重性评分,解析攻击者命令,并使用 MaxMind GeoIP 将 IP 地址映射到地理位置。
- **现代化 SOC 仪表板:** 响应式、深色主题的 React 前端,包含交互式 Leaflet 地图、Recharts 时间轴图表和实时事件流。
- **基础设施即代码:** 使用 Terraform 实现 100% 自动化的 AWS EC2 资源调配。
- **DevSecOps CI/CD:** 自动化 GitHub Actions 管道,包含代码检查、自动化测试和 Aqua Security Trivy 漏洞扫描。
- **可观测性栈:** 完全集成的 Prometheus 和 Grafana 自动配置仪表板,用于后端健康状态和 HTTP 请求监控。
## 🏗️ 架构
1. **前端:** React, Vite, TailwindCSS (托管于 Vercel 边缘网络)。
2. **后端:** FastAPI, Python, SQLAlchemy AsyncIO, WebSockets。
3. **数据库:** PostgreSQL。
4. **蜜罐:** Cowrie (SSH/Telnet), Flask (Web)。
5. **监控:** Prometheus, Grafana。
6. **部署:** Docker Compose, AWS EC2, Terraform。
## 🚀 部署指南
本项目针对通过 Terraform 在 AWS 上进行自动化云部署进行了优化。
### 1. 配置基础设施
确保已安装并配置 AWS CLI 和 Terraform。
```
cd terraform
terraform init
terraform apply -var="key_name=your-aws-ssh-key" -var="aws_region=ap-south-1"
```
*注意:EC2 实例利用 `userdata.sh` 脚本自动安装 Docker、克隆本代码仓库并启动整个后端容器栈。*
### 2. 前端配置
前端设计为部署在 Vercel 上。由于 AWS 实例使用动态 IP,Vercel 充当后端的安全反向代理。
1. 将 `frontend/` 目录部署到 Vercel。
2. 使用您的新 EC2 公有 IP 地址更新 `frontend/vercel.json` 文件。
3. Vercel 将自动把 `/api/` 和 `/ws/` 请求路由到您的 AWS 实例,绕过浏览器的混合内容限制。
## 🛡️ DevSecOps 流水线
每次推送到 `main` 分支都会触发 GitHub Actions 流水线 (`.github/workflows/ci.yml`),执行以下操作:
1. **代码质量:** Python Ruff 代码检查和 React 构建检查。
2. **集成测试:** 针对临时 PostgreSQL Docker 容器运行 PyTest 测试套件。
3. **安全扫描:** Trivy 文件系统扫描,查找严重和高危漏洞。
4. **试运行构建:** 在部署前验证所有 Dockerfile。
## 💻 本地开发
要在不使用 AWS 的情况下本地运行此平台:
```
# " is a noun. Perhaps "Clone" should be translated to "克隆", and "repository" kept as "repository"? But in the example, "Setup" in "Kubernetes Setup" is translated to "设置", which is a verb/noun, so it's translated.
git clone https://github.com/YourUsername/ThreatShield-AI.git
cd ThreatShield-AI
# To be consistent, I should translate the words that are not technical jargon. But in this context, almost all words might be technical. Let's assume that common verbs like "clone", "setup", "start" are translated, while nouns like "repository", "environment variables", "backend services", "frontend" are kept in English if they are technical terms.
cp .env.example .env
# But "backend services" and "frontend" are also technical terms. Perhaps I should translate the entire phrase but keep specific terms in English.
docker compose up -d
# The instruction says: "Keep all professional terms, proper nouns, tool/library/framework names, and technical jargon in their original English form." So for "environment variables", it's technical jargon, so keep it in English. Similarly, "backend services" and "frontend" might be kept.
cd frontend
npm install
npm run dev
```
*SOC 仪表板可在 `http://localhost:5173` 访问。*
标签:AI辅助安全, AWS云服务, DevSecOps, FastAPI后端, GitHub Actions, Grafana可视化, masscan, PFX证书, PostgreSQL数据库, Prometheus监控, React前端, Terraform配置, Trivy安全扫描, WebSocket通信, 上游代理, 交互式地图, 地理位置定位, 威胁分类, 威胁情报平台, 安全仪表板, 安全运营中心, 异步后端, 攻击检测, 时间线图表, 测试用例, 漏洞利用检测, 特权提升, 监控与告警, 网络安全, 网络映射, 自动化部署, 自动笔记, 自定义请求头, 蜜罐技术, 请求拦截, 逆向工具, 部署流水线, 隐私保护