jbanday808/ai-powered-threat-detection-platform

GitHub: jbanday808/ai-powered-threat-detection-platform

面向 Amazon EKS 的端到端 DevSecOps 平台,整合 CI/CD 安全自动化、运行时威胁检测与 AI 驱动的事件响应分诊。

Stars: 0 | Forks: 0

# AI 驱动的 EKS 威胁狩猎与云事件响应平台 ## 执行摘要 本项目展示了一个用于 Amazon EKS 的完整云安全和 DevSecOps 平台。它使用了 GitHub Actions、GitHub OIDC、Terraform、Python、Pytest、CodeQL、Trivy、SBOM 生成、Docker、Amazon ECR、Amazon EKS、Falco、AWS Security Agent、GuardDuty Runtime Monitoring、AI 威胁分诊以及云事件响应报告。 该平台验证代码和基础设施,构建并扫描容器镜像,将 AI 分诊工作负载部署到 EKS,检测运行时威胁,将告警映射到 MITRE ATT&CK,并生成事件响应报告。 ## 架构图 ![图 1. 高层架构](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/163c2c03bc053536.png) 图 1. 平台的高层视图,展示了 CI/CD、安全验证、运行时检测、AI 分诊和事件响应。 ![图 2. 详细的 DevSecOps 架构](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/35fccdba56053544.png) 图 2. 详细的 DevSecOps 工作流,从 GitHub Actions 到 EKS 部署、GuardDuty 监控、AI 分诊和事件响应。 ## 架构工作流 ``` Git Push → GitHub Actions → OIDC Authentication → Terraform Validation → Python Validation → Pytest → CodeQL → Trivy Filesystem Scan → SBOM Generation → Docker Build → Trivy Image Scan → Amazon ECR → Amazon EKS → AWS Security Agent → GuardDuty Runtime Monitoring → AI Threat Triage → Cloud Incident Response ``` ## 技术栈 | 技术 | 用途 | | --- | --- | | AWS | 用于 EKS 安全环境的云平台。 | | Amazon EKS | 用于容器工作负载的托管型 Kubernetes 平台。 | | Amazon ECR | 用于 AI 分诊镜像的容器镜像仓库。 | | Amazon VPC | EKS 环境的网络基础。 | | Amazon S3 | Terraform 远程状态存储。 | | Amazon DynamoDB | Terraform 状态锁定。 | | AWS IAM | 用于 AWS 访问的角色和策略管理。 | | GitHub Actions | 用于验证、扫描、镜像构建和部署的 CI/CD 自动化。 | | GitHub OIDC | 无需长期访问密钥的短期 AWS 身份验证。 | | Terraform | 用于 AWS 资源的基础设施即代码。 | | Kubernetes | 通过 Amazon EKS 进行容器编排。 | | kubectl | Kubernetes 资源管理。 | | Docker | 用于 AI 分诊工作负载的容器打包。 | | Python | 告警分诊和事件报告生成。 | | Pytest | AI 分诊工作流的单元测试。 | | CodeQL | 针对 Python 代码的静态分析。 | | Trivy | 文件系统和镜像漏洞扫描。 | | CycloneDX SBOM | 软件组件清单格式。 | | Falco | 开源运行时威胁检测。 | | AWS GuardDuty Runtime Monitoring | 针对 EKS 的 AWS 原生运行时威胁检测。 | | AWS Security Agent | EKS 工作节点上的 GuardDuty 运行时可见性。 | | MITRE ATT&CK | 检测到对手技术的映射。 | ## 已完成的里程碑 - GitHub Actions CI/CD - GitHub OIDC 身份验证 - Terraform 验证 - Python 验证 - AI 分诊单元测试 - CodeQL 静态分析 - Trivy 安全扫描 - SBOM 生成 - Docker 构建流水线 - Amazon ECR 集成 - Amazon EKS 部署流水线 - AWS Security Agent 验证 - GuardDuty Runtime Monitoring - Falco 运行时检测验证 - AI 事件报告生成 ## 部署验证证据 ![图 3. Terraform 管理的 EKS VPC](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/5244c52b41053550.png) 图 3. Terraform 创建了 EKS 环境使用的 VPC 网络基础。 ![图 4. Amazon ECR 镜像仓库](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/fcf641d8cd053556.png) 图 4. Amazon ECR 存储 AI 分诊工作负载的 Docker 镜像。 ![图 5. GitHub 仓库变量](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/5f7de81b7c053603.png) 图 5. GitHub 仓库变量安全地为 GitHub Actions 工作流提供 AWS 和部署设置。 ![图 6. AWS GuardDuty Security Agent](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/d5d72b4ec9053609.png) 图 6. AWS Security Agent 运行正常,并支持 EKS 工作节点上的 GuardDuty Runtime Monitoring。 ![图 7. AI 分诊工作负载部署](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/edfef6704b053616.png) 图 7. GitHub Actions 成功将 AI 分诊工作负载部署到 Amazon EKS。 ![图 8. GitHub Actions 工作流](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/fdc5debdc5053622.png) 图 8. GitHub Actions 工作流实现了测试、安全验证、镜像构建和部署的自动化。 ![图 9. Falco 运行时测试工作负载](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/e807177064053628.png) 图 9. 使用受控的 nginx 工作负载来测试运行时检测行为。 ![图 10. Falco 运行时测试结果](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/2df935c056053634.png) 图 10. 运行时测试产生了预期的 Kubernetes 活动,以进行检测验证。 ![图 11. Falco 检测证据](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/228f30feba053641.png) 图 11. Falco 检测到 Kubernetes 容器内的 shell 活动,并生成了运行时安全告警。 ![图 12. Pytest 验证](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/20e2e10ce2053647.png) 图 12. Pytest 确认 AI 分诊测试成功通过。 ![图 13. AI 分诊事件报告](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/9a3196fbad053654.png) 图 13. Python 分诊工作流根据样本告警生成了 Markdown 事件报告。 ## 安全验证结果 已验证的控制措施: - GitHub OIDC 身份验证 - 基础设施即代码验证 - Python 静态验证 - 单元测试 - CodeQL 静态分析 - Trivy 文件系统扫描 - SBOM 生成 - Docker 镜像安全扫描 - 运行时威胁检测 - GuardDuty Runtime Monitoring - MITRE ATT&CK 映射 - AI 辅助事件分诊 ## AI 威胁分诊 AI 分诊工作流处理 Falco 风格的告警,提取 Kubernetes 上下文,将检测映射到 MITRE ATT&CK,推荐响应措施,并生成 Markdown 事件报告。 ``` python3 -m py_compile ai-triage/triage.py python3 ai-triage/triage.py pytest tests -v ``` ## 文档 | 文档 | 用途 | | --- | --- | | [架构](docs/architecture.md) | 当前的架构、工作流和验证证据。 | | [重建 AWS 环境](docs/rebuild-aws-environment.md) | 安全的端到端重建指南。 | | [DevSecOps 安全自动化](docs/devsecops-security-automation.md) | CI/CD、OIDC、扫描、构建、推送和部署工作流。 | | [软件供应链安全](docs/software-supply-chain-security.md) | SBOM、依赖扫描、镜像扫描和部署信任。 | | [容器安全](docs/container-security.md) | Docker、EKS 部署、Falco 和 GuardDuty。 | | [AWS GuardDuty Security Agent](docs/aws-security-agent.md) | GuardDuty agent 的用途、验证和响应价值。 | | [云事件响应](docs/cloud-incident-response.md) | 检测、分诊、调查、建议和报告。 | ## 仓库结构 | 路径 | 用途 | | --- | --- | | `.github/workflows` | DevSecOps 自动化工作流。 | | `ai-triage` | Python 告警分诊和事件报告生成。 | | `docs` | 架构和安全文档。 | | `falco` | Falco Helm 值和自定义运行时检测规则。 | | `k8s/ai-triage` | AI 分诊工作负载的 Kubernetes 部署清单。 | | `terraform/backend` | 用于状态和锁定的 Terraform 后端资源。 | | `terraform/eks` | Amazon EKS 和 Terraform 管理的 VPC 基础设施。 | | `tests` | AI 分诊工作流的 Pytest 验证。 | ## 必需的 GitHub 仓库变量 ``` AWS_REGION AWS_ACCOUNT_ID ECR_REPOSITORY EKS_CLUSTER_NAME AWS_ROLE_ARN ``` ## 作品集总结 本项目展示了 AWS 云安全、Amazon EKS、Kubernetes、Terraform、GitHub Actions、GitHub OIDC、CodeQL、Trivy、SBOM 生成、Docker、Amazon ECR、Falco 运行时检测、AWS GuardDuty Runtime Monitoring、AI 辅助分诊以及云事件响应的实际应用。 ## 参考 | 工具 / 服务 | 用途 | 官方文档 | | ---------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | AWS | 用于托管项目资源的云平台。 | https://docs.aws.amazon.com/ | | Amazon EKS | 用于运行容器工作负载的托管型 Kubernetes 服务。 | https://docs.aws.amazon.com/eks/ | | Amazon ECR | 用于存储 Docker 镜像的容器镜像仓库。 | https://docs.aws.amazon.com/ecr/ | | AWS IAM | 用于角色、策略和 OIDC 访问的身份和访问管理。 | https://docs.aws.amazon.com/iam/ | | GitHub OIDC with AWS | 无需长期密钥即可实现从 GitHub Actions 到 AWS 的安全身份验证。 | https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | | GitHub Actions | 用于验证、扫描、镜像构建和 EKS 部署的 CI/CD 自动化。 | https://docs.github.com/en/actions | | Terraform | 用于预置 AWS 资源的基础设施即代码工具。 | https://developer.hashicorp.com/terraform/docs | | Kubernetes | Amazon EKS 使用的容器编排平台。 | https://kubernetes.io/docs/ | | kubectl | 用于管理 Kubernetes 资源的命令行工具。 | https://kubernetes.io/docs/reference/kubectl/ | | Docker | 用于打包 AI 分诊工作负载的容器工具。 | https://docs.docker.com/ | | Python | 用于 AI 分诊和事件报告生成的编程语言。 | https://docs.python.org/3/ | | Pytest | 用于验证 AI 分诊工作流的测试框架。 | https://docs.pytest.org/ | | CodeQL | 用于扫描代码安全问题的静态分析工具。 | https://codeql.github.com/docs/ | | Trivy | 用于文件系统和容器镜像扫描的安全扫描器。 | https://aquasecurity.github.io/trivy/ | | CycloneDX SBOM | 用于记录软件组件的 SBOM 格式。 | https://cyclonedx.org/docs/ | | Falco | 用于检测可疑容器行为的运行时安全工具。 | https://falco.org/docs/ | | AWS GuardDuty | 用于运行时监控的 AWS 原生威胁检测服务。 | https://docs.aws.amazon.com/guardduty/ | | GuardDuty Runtime Monitoring | 用于观察 EKS 工作负载行为的运行时监控功能。 | https://docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring.html | | AWS Security Agent for EKS | GuardDuty Runtime Monitoring 用于 EKS 工作负载的安全 agent。 | https://docs.aws.amazon.com/guardduty/latest/ug/eks-runtime-monitoring.html | | Amazon VPC | EKS 环境使用的网络基础。 | https://docs.aws.amazon.com/vpc/ | | Amazon S3 | 用于 Terraform 远程状态的存储服务。 | https://docs.aws.amazon.com/s3/ | | Amazon DynamoDB | 用于 Terraform 状态锁定的数据库服务。 | https://docs.aws.amazon.com/dynamodb/ | | MITRE ATT&CK | 用于将检测映射到对手技术的框架。 | https://attack.mitre.org/ | ## 作者 James Banday 云安全 | Kubernetes | DevSecOps | 威胁检测 | 事件响应 GitHub: https://github.com/jbanday808/ai-eks-threat-hunting-platform/tree/main LinkedIn: https://www.linkedin.com/in/james-allen-morta-banday-62a391128/
标签:AI威胁狩猎, DevSecOps, EKS安全, LLM防护, Web截图, 上游代理, 子域名突变, 容器安全, 请求拦截, 逆向工具