soc-automation-lab/docker-secops-ir-automation-lab-public

GitHub: soc-automation-lab/docker-secops-ir-automation-lab-public

一个轻量级本地安全运营与事件响应自动化实验室,用于在Windows/Docker环境中完成取证采集、安全基线审计、金丝雀模拟检测、规则引擎评估和风险报告生成。

Stars: 0 | Forks: 0

# Docker 安全运营与事件响应自动化实验室 本实验室是一个本地化的、仅用于审计的安全运营和事件响应环境,包含 Windows 主机取证、Docker 安全基线、金丝雀模拟、规则引擎、风险评分、修复计划、HTML 报告以及集中式证据索引。 ## 简述 本项目是一个便携式安全实验室,旨在对本地 Windows/Docker 实验室系统中的安全相关证据进行结构化的收集、规范化、评估和记录。 该实验室结合了多个典型的蓝队和安全运营任务: ``` Windows-Host-Evidence sammeln → Canary-Dateiaktivität sicher simulieren → Docker-/Container-Security-Baseline erfassen → Evidenz normalisieren → Rule Engine ausführen → Findings bewerten → Risiko-Score berechnen → audit-only Remediation-/Hardening-Plan erzeugen → HTML-Report generieren → zentralen Evidence Index erstellen ``` 其目标并非构建生产级别的 SIEM 或完整的企业级 SOC,而是提供一个可追溯且可在本地执行的证据工作流,以此演示安全运营、检测工程、容器安全、风险评估和技术文档编制中的典型工作步骤。 ## 项目目标 该实验室旨在解答一个实际问题: ``` Wie kann ein lokales Security-Lab sicherheitsrelevante Host-, Container- und Simulationsdaten sammeln, normalisieren, regelbasiert bewerten und als nachvollziehbares Evidence Pack dokumentieren? ``` 重点关注以下方面: - 仅限审计的证据收集 (audit-only Evidence Collection) - 不涉及恶意软件的安全本地模拟 - 可追溯的规则引擎 - 跨数据源的发现结果 (Finding) 评估 - 可复现的 Markdown/HTML 报告 - 适合用作作品集展示的文档 - 明确的安全边界 - 面向评审和面试的技术可解释性 ## 安全模型 本项目被有意设计为一个 **仅限审计 (audit-only)** 和 **仅限规划 (plan-only)** 的实验室。 这意味着: ``` - keine produktiven Änderungen am Windows-System - keine automatische Service-Deaktivierung - keine automatische Firewall-Änderung - keine automatische Docker-Härtung - keine Container-Restarts durch Remediation - keine echte Malware - keine Ransomware-Funktionalität - keine externen Ziele - keine Angriffe auf fremde Systeme ``` 金丝雀模拟仅在本地工作目录中使用受控的测试文件。所有的更改、复制、读取和标记文件操作都只涉及预先创建的实验室工件。 修复/加固计划同样是仅限审计的。它会生成操作建议,但不会执行任何更改。 ## 范围界定 本项目明确不包含以下内容: - 不包含 Wazuh - 不包含 OpenVAS/GVM - 不包含重量级 SIEM - 不包含真实的恶意软件 - 不包含针对外部目标的漏洞利用 - 不包含生产级别的事件响应自动化 - 不包含未经人工审核的自动系统加固 相反,本项目是一个轻量级的、可在本地受控的证据与报告实验室。 ## 主要组件 ### Windows 主机取证 Windows 主机将通过基于 PowerShell 的收集器进行检查。随后,收集到的证据将被规范化并转换为报告。 典型检查领域: - 本地开放端口 - Windows 服务 - 服务风险上下文 - 计划任务 - Defender 事件 - PowerShell 操作事件 - 安全事件 - 系统事件 ### 金丝雀文件活动模拟 金丝雀模拟会生成无害的本地文件活动,以便安全地测试检测、规则和报告逻辑。 典型的模拟事件: - 创建文件 - 读取金丝雀文件 - 修改金丝雀文件 - 复制金丝雀文件 - 重命名虚拟文件 - 删除临时文件 - 创建标记文件 这些事件作为受控且安全的信号,用于检测工程和流水线验证。 ### Docker 安全基线 Docker 基线以仅限审计的模式捕获本地 Docker 和 Compose 安全方面的信息。 检查领域: - Docker CLI 可用性 - Docker Daemon 可用性 - Docker Compose CLI 可用性 - 容器清单 - 镜像 - 网络 - 存储卷 - 发布的端口 - 特权容器 - 主机网络模式 - Root/默认用户 - 绑定挂载 - 健康检查 - 重启策略 - 只读根文件系统 - 包含敏感关键字的 Compose 文件 ### 规则引擎 规则引擎负责处理来自多个数据源的规范化证据: ``` baseline canary docker ``` 它会生成基于规则的发现结果,其中包含上下文、严重程度、类别、数据源、描述、证据和建议。 当前的规则包: ``` rules/windows-host/windows-host-baseline-rules.json rules/windows-host/canary-file-activity-rules.json rules/windows-host/docker-security-rules.json ``` ### 风险评分 风险评分器会对规则引擎的发现结果进行评估。 当前的模型: ``` windows_host_risk_model_v3 ``` 该模型的特性: - 优先考虑规则引擎的发现结果,而非规范化器的发现结果 - 考虑数据源上下文 - 使用最高严重级别的发现结果作为基准 - 增加有限的支持和上下文得分 - 防止在没有高/严重级别证据的情况下出现严重风险 - 将实验室典型的 PowerShell 遥测数据视为上下文 ### 修复/加固计划 修复计划生成器会根据发现结果生成一份仅限审计的行动计划。 当前的模型: ``` audit_only_remediation_plan_v1 ``` 该计划包含: - 优先级 - 阶段 - 数据源 - 领域 - 范围 - 建议措施 - 审计操作 - 验证方式 - 应用提示 - 安全标志 重要提示:该计划并非可以直接执行的。它旨在作为一个用于审查、验证和加固的规划方案。 ### HTML 安全报告 HTML 报告是一个集中的、人类可读的报告,旨在用于快速审查。 它主要包含: - 风险等级 - 风险评分 - 收集器状态 - 金丝雀上下文 - Docker 上下文 - 规则引擎上下文 - 发现结果计数 - 基于规则的发现结果 - 建议 - 修复和加固计划 - 摘要部分 ### 证据索引 证据索引是访问生成的实验室工件的中央入口点。 它负责检查并记录: - 流水线状态 - 数据源 - 发现结果计数 - 风险摘要 - 修复概述 - 工件可用性 - 工件索引 - 流水线步骤 用于全局概览的最重要报告是: ``` evidence/reports/evidence-index-latest.md ``` ## 流水线概览 中央流水线通过以下运行器执行: ``` python/run_windows_host_evidence_pipeline.py ``` 当前的流水线步骤: ``` 1. normalize-windows-host-baseline 2. normalize-canary-file-activity 3. collect-docker-security-baseline 4. normalize-docker-security-baseline 5. evaluate-windows-host-rules 6. score-windows-host-risk 7. generate-remediation-plan 8. generate-windows-host-html-report 9. generate-evidence-index ``` ## 当前验证状态 最近一次验证通过的流水线运行生成了: ``` Pipeline status: success Collector success: 10/10 Canary available: True Canary events: 11 Docker available: True Docker containers: 6 Rules evaluated: 26 Rules matched: 17 Rule errors: 0 Risk level: Medium Risk score: 64 Plan items: 17 Audit-only items: 17 Apply-ready items: 0 Artifacts total: 16 Artifacts available: 16 Artifacts missing: 0 ``` ## 重要的生成工件 生成的证据和报告文件位于 `evidence/` 目录下。这些文件旨在作为本地输出,在公开发布前应进行审查或避免提交。 当前重要的报告路径: ``` evidence/reports/windows-host-baseline-latest.md evidence/reports/canary-file-activity-latest.md evidence/reports/docker-security-baseline-latest.md evidence/reports/windows-host-rule-findings-latest.md evidence/reports/windows-host-risk-summary-latest.md evidence/reports/remediation-plan-latest.md evidence/reports/windows-host-security-report-latest.html evidence/reports/evidence-index-latest.md ``` 当前重要的 JSON 路径: ``` evidence/normalized/windows-host/latest-pipeline-summary.json evidence/normalized/windows-host/latest-baseline-summary.json evidence/normalized/windows-host/latest-canary-file-activity-summary.json evidence/normalized/docker/latest-docker-security-summary.json evidence/normalized/windows-host/latest-rule-findings.json evidence/normalized/windows-host/latest-risk-summary.json evidence/normalized/windows-host/latest-remediation-plan.json evidence/normalized/windows-host/latest-evidence-index.json ``` ## 推荐的审查切入点 为了进行快速的项目审查: 1. 阅读 README 2. 打开证据索引 3. 打开 HTML 安全报告 4. 审查修复计划 5. 审查规则发现结果和风险摘要 推荐的起点: ``` README.md evidence/reports/evidence-index-latest.md evidence/reports/windows-host-security-report-latest.html evidence/reports/remediation-plan-latest.md ``` ## 仓库结构 主要项目领域摘要: ``` . ├── README.md ├── docker-compose.yml ├── docs/ │ ├── architecture.md │ ├── canary-file-activity-simulation.md │ ├── configuration-as-code.md │ ├── docker-network-segmentation.md │ ├── docker-security-baseline.md │ ├── evidence-guide.md │ ├── evidence-index.md │ ├── remediation-hardening-plan.md │ ├── setup-wsl2-docker.md │ ├── threat-model.md │ ├── windows-host-evidence-pipeline.md │ ├── windows-host-rule-engine.md │ └── windows-host-security-baseline.md ├── python/ │ ├── canary_file_activity_normalizer.py │ ├── docker_security_baseline_collector.py │ ├── docker_security_baseline_normalizer.py │ ├── evidence_index_generator.py │ ├── remediation_plan_generator.py │ ├── run_windows_host_evidence_pipeline.py │ ├── windows_host_baseline_normalizer.py │ ├── windows_host_html_report_generator.py │ ├── windows_host_risk_scorer.py │ └── windows_host_rule_engine.py ├── rules/ │ └── windows-host/ │ ├── canary-file-activity-rules.json │ ├── docker-security-rules.json │ └── windows-host-baseline-rules.json ├── scripts/ │ ├── bash/ │ └── powershell/ └── evidence/ ├── normalized/ ├── raw/ └── reports/ ``` ## 先决条件 本实验室专为本地 Windows/WSL2/Docker 环境设计。 典型的环境: - Windows 11 - PowerShell - WSL2 Ubuntu - 基于 WSL2 后端的 Docker Desktop - Docker Compose - Python 3 - jq - VS Code 可选或与项目相关的组件: - Dev Container - Grafana - Loki - Vector - Trivy - Ansible 执行环境 - Terraform Runner ## 快速入门 ### 1. 打开仓库目录 ``` cd ``` ### 2. 检查 Python 文件 ``` python3 -m py_compile \ python/windows_host_baseline_normalizer.py \ python/canary_file_activity_normalizer.py \ python/docker_security_baseline_collector.py \ python/docker_security_baseline_normalizer.py \ python/windows_host_rule_engine.py \ python/windows_host_risk_scorer.py \ python/remediation_plan_generator.py \ python/windows_host_html_report_generator.py \ python/evidence_index_generator.py \ python/run_windows_host_evidence_pipeline.py ``` ### 3. 运行完整的证据流水线 ``` python3 \ python/run_windows_host_evidence_pipeline.py ``` ### 4. 检查流水线摘要 ``` cat \ evidence/normalized/windows-host/latest-pipeline-summary.json \ | jq '.status, .steps, .risk, .remediation, .evidence_index' ``` ### 5. 检查证据索引 ``` cat \ evidence/normalized/windows-host/latest-evidence-index.json \ | jq '.summary.artifact_total, .summary.artifact_available, .summary.artifact_missing' ``` 当所有工件均可用时,预期结果为: ``` 16 16 0 ``` ### 6. 打开 HTML 报告 在 Windows 下,可以在浏览器中直接打开该报告: ``` evidence/reports/windows-host-security-report-latest.html ``` ## 文档 重要的文档文件: | 文件 | 用途 | | --- | --- | | `docs/architecture.md` | 架构概览 | | `docs/setup-wsl2-docker.md` | WSL2/Docker 设置 | | `docs/threat-model.md` | 威胁模型与安全边界 | | `docs/configuration-as-code.md` | 配置即代码 概念 | | `docs/docker-network-segmentation.md` | Docker 网络分段 | | `docs/evidence-guide.md` | 证据和报告指南 | | `docs/windows-host-security-baseline.md` | Windows 主机安全基线 | | `docs/windows-host-evidence-pipeline.md` | Windows 主机证据流水线 | | `docs/windows-host-rule-engine.md` | 规则引擎 | | `docs/canary-file-activity-simulation.md` | 金丝雀文件活动模拟 | | `docs/docker-security-baseline.md` | Docker 安全基线 | | `docs/remediation-hardening-plan.md` | 仅限审计的修复/加固计划 | | `docs/evidence-index.md` | 证据索引与作品集概览 | ## 里程碑 当前的本地标签: ``` v0.5-windows-host-baseline v0.6-evidence-normalization v0.7-rule-based-findings v0.8-canary-simulation v0.9-docker-security-baseline v0.10-remediation-hardening-plan v0.11-evidence-index ``` 计划的下一个作品集里程碑: ``` v0.12-portfolio-ready ``` ## 作品集价值 本项目展示了在多个安全运营领域的实用技能: - Windows 主机安全审查 - 证据收集 - 日志与证据规范化 - 基于金丝雀信号的检测工程 - 基于规则的发现结果生成 - Docker/容器安全基线 - 风险评分 - 仅限审计的修复规划 - HTML/Markdown 报告生成 - 技术文档 - 安全的实验室边界 - 可复现的流水线执行 在面试或作品集评审中,可以将此项目作为一个完整的证据工作流进行讲解:涵盖从数据收集、评估,一直到生成文档化的操作建议的全过程。 ## 发布提示 本仓库旨在作为本地学习和作品集展示项目。 在公开发布之前,应检查以下内容: - 确保没有个人数据 - 确保没有敏感的主机名 - 确保没有包含机密上下文的内部路径 - 确保没有 Secrets - 确保没有 `.env` 文件 - 确保没有私有的证据工件 - 确保没有包含敏感信息的屏幕截图 - 确保没有不必要的大体量原始数据 - 确保没有可能泄露私有环境信息的 Docker 或系统数据 生成的证据文件只能在经过清理和有意向的情况下才能发布。
标签:AI合规, Ansible, Canary文件, Conpot, DNS 解析, Docker安全, ECS, ESC漏洞, HTML报告, PB级数据处理, Terraform, Web截图, Windows安全, 主机取证, 云计算, 关系图谱, 基础架构即代码, 基线检查, 安全合规, 安全实验室, 安全报告, 安全运维, 容器安全, 库, 应急响应, 应用安全, 插件系统, 搜索语句(dork), 数据包嗅探, 无线安全, 版权保护, 系统提示词, 网络代理, 网络安全审计, 蜜罐模拟, 规则引擎, 证据收集, 请求拦截, 逆向工具, 防御强化