amaruxia42/cnapp-threat-detection-dashboard
GitHub: amaruxia42/cnapp-threat-detection-dashboard
基于 Terraform 和 Python Lambda 在 AWS 上构建的轻量级云原生威胁检测管线,聚合多源安全数据并实现实时告警与结构化日志。
Stars: 0 | Forks: 0
# 🛡️ CNAPP (Lite) 威胁检测仪表板 (AWS, Python, Terraform)
## 📌 概述
本项目使用模块化的 **Terraform** 和 **Python Lambda**,为 AWS 实现了一个轻量级的 **云原生应用保护平台 (CNAPP)**。它接收来自 **GuardDuty**、**Security Hub** 和 **CloudTrail** 的威胁数据,对其进行评估,并通过 **SNS**、**S3** 和 **CloudWatch Logs** 提供实时告警和结构化日志。
## 🎯 核心功能
- ⚙️ **模块化 Terraform**,易于维护和扩展
- 🧠 位于 Lambda 中的 **Python 威胁评估引擎**
- 🔁 **事件驱动**,通过由 GuardDuty 和 Security Hub 发现结果触发的 EventBridge 规则实现
- 🪵 位于 CloudWatch 和 S3 中的 **结构化日志**
- 🔔 通过 SNS 提供的 **实时告警** (支持邮件/短信)
- 💰 **低成本运行** (~每月 $10–$25,具体取决于使用量)
## 🧱 架构

```
---
## 📁 Project 结构
cnapp_threat_detection_dashboard/
│
├── modules/
│ ├── cloudtrail/
│ ├── eventbridge/
│ ├── guardduty/
│ ├── lambda/
│ │ ├── threat_detection/
│ │ ├── build/
│ ├── iam/
│ ├── security_hub/
│ └── s3/
│
├── terraform/
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
```
## 🚀 快速开始
### 📦 环境要求
- 已配置 AWS CLI (`aws configure`)
- Terraform `1.5+`
- Python `3.13+`
- Zip 工具 (`zip` CLI 或 Python 的 `zipfile`)
- (可选) 具有已订阅电子邮件的 SNS topic
### 🛠️ 部署
1. **打包 Lambda**
```
cd modules/lambda
zip -r build/threat_detection.zip threat_detection
Deploy Infrastructure
cd ../../terraform
terraform init
terraform apply
Provide inputs (e.g., bucket names, regions, etc.) during or via terraform.tfvars.
⸻
✅ Testing the Threat Detection Workflow
Once deployed, you can test the CNAPP Lite system by simulating findings and verifying alerts:
🔍 1. Simulate a GuardDuty Finding
aws guardduty create-sample-findings \
--detector-id \
--finding-types "Recon:EC2/PortProbeUnprotectedPort"
This triggers:
• ✅ EventBridge rule
• ✅ Lambda function execution
• ✅ Logs in CloudWatch
• ✅ Alert in SNS
• ✅ Log object in S3
⸻
📜 2. Verify Outputs
• CloudWatch Logs:
Go to Lambda logs in CloudWatch to inspect threat evaluations.
• S3 Bucket:
Check for logs under:
s3:///AWSLogs//...
• SNS Notification:
Confirm receipt of email or SMS alert.
🧼 Cleanup
To destroy the infrastructure:
terraform destroy -auto-approve
Author: Robert Wright
Cloud/Network Security Enthusiast | AWS Solutions Architect Associate | AWS Security Specialty
GitHub: @amaruxia42
```
标签:AMSI绕过, AWS, DPI, ECS, Python, Serverless, Terraform, 威胁检测, 无后门, 足迹分析, 逆向工具, 速率限制