ikhlas-rtb/aws-cloud-monitoring

GitHub: ikhlas-rtb/aws-cloud-monitoring

基于 CloudTrail、CloudWatch、GuardDuty 和 SNS 构建的 AWS 安全监控技术栈,实现 CIS Benchmark 合规告警与受损 EC2 实例的自动隔离响应。

Stars: 0 | Forks: 0

# AWS 云监控与安全告警技术栈 基于 CloudTrail、CloudWatch、GuardDuty 和 SNS 构建的生产级 AWS 安全监控设置。 实现了 CIS AWS Benchmark 控制措施,并包含针对受损实例的 EC2 自动隔离功能。 ## 架构 ``` flowchart TD A[AWS Account Activity
API calls, console logins, IAM, S3, EC2] --> B[CloudTrail
Multi-region audit trail] B --> C[(S3 Bucket
Versioned log storage)] B --> D[CloudWatch Logs] D --> E[Metric Filters
8 CIS Benchmark rules] E --> F[CloudWatch Alarms] F --> G[SNS Topic] G --> H[📧 Email Alerts] I[GuardDuty
15-min finding frequency] --> J[guardduty_monitor.py] J -->|severity >= 7| K[Auto-isolate EC2
Remove from network] J -->|severity 4-6| L[List & report findings] style A fill:#e1f5ff,stroke:#0066cc style B fill:#fff4e1,stroke:#ff9900 style I fill:#ffe1e1,stroke:#cc0000 style K fill:#ffcccc,stroke:#990000 style H fill:#d4f4dd,stroke:#00aa00 ``` ## 构建内容 - **CloudTrail** — 多区域审计轨迹,将所有 AWS API 调用记录到 S3 - **CloudWatch Alarms** — 8 个映射到 CIS AWS Benchmark 和 MITRE ATT&CK 的安全告警 - **GuardDuty** — 威胁检测,结果发布频率为 15 分钟 - **SNS Alerts** — 任何告警触发时的电子邮件通知 - **自动隔离** — 自动将受损的 EC2 实例从网络中移除的 Python 脚本 ## 检测规则 (CIS AWS Benchmark) | 告警 | CIS 控制 | MITRE ATT&CK | |-------|-------------|--------------| | Root 账户使用 | CIS 1.1 | T1078.004 | | 未授权的 API 调用 | CIS 3.1 | T1078 | | 未使用 MFA 的控制台登录 | CIS 3.2 | T1078 | | IAM 策略更改 | CIS 3.4 | T1484 | | CloudTrail 配置更改 | CIS 3.5 | T1562.008 | | 控制台登录失败 | CIS 3.6 | T1110 | | S3 存储桶策略更改 | CIS 3.8 | T1530 | | 安全组更改 | CIS 3.10 | T1562 | ## 设置 ### 前置条件 - 已配置具有适当权限的 AWS CLI - Python 3.8+ ``` pip install -r requirements.txt ``` ### 部署技术栈 ``` chmod +x setup.sh ./setup.sh ``` 当您收到确认电子邮件时,请确认 SNS 电子邮件订阅。 ### 监控 GuardDuty 发现 ``` # 列出所有 MEDIUM+ 发现 python3 guardduty_monitor.py --min-severity 4 # 列出带有自动隔离受损 EC2 实例的 HIGH+ 发现 python3 guardduty_monitor.py --min-severity 7 --auto-isolate ``` ## 文件 | 文件 | 用途 | |------|---------| | `setup.sh` | 部署完整技术栈 (CloudTrail, SNS, CloudWatch, GuardDuty) | | `cloudwatch_alarms.py` | 以编程方式创建指标过滤器和告警 | | `guardduty_monitor.py` | 获取发现并自动隔离受损实例 | | `cloudtrail-bucket-policy.json` | 用于 CloudTrail 日志传输的 S3 存储桶策略 | ## 展示技能 `AWS` `CloudTrail` `CloudWatch` `GuardDuty` `SNS` `boto3` `Python` `CIS AWS Benchmark` `MITRE ATT&CK` `Cloud Security` `Incident Response Automation` `Security Monitoring` `AWS CLI` `Infrastructure Auditing`
标签:AMSI绕过, Anthropic, AWS, boto3, CIS基准, Cloudflare, CloudTrail, CloudWatch, DevSecOps, DPI, EC2, EC2自动化隔离, GuardDuty, IaC, MITRE ATT&CK, Python, SNS, 上游代理, 云基础设施保护, 云计算, 人工智能安全, 合规性, 告警通知, 威胁检测, 安全告警, 无后门, 漏洞探索, 规则引擎, 逆向工具