📦 SecOpsAI for OpenClaw — 对话式安全运营
v0.3.6通过聊天即可对 OpenClaw 审计日志执行实时检测、查看告警、分级事件并获取修复建议,一站式完成 SecOps 工作流。
详细分析 ▾
运行时依赖
版本
将旧版 soc_store 分级步骤切换为原生 secopsai 分级 investigate/close 流程。 新增原生编排器、队列与 apply-action 指引。 新增供应链误报操作指引。 更新写操作安全用语。
安装命令
点击复制技能文档
# 适用于 OpenClaw 的 SecOpsAI Skill 该 skill 使 OpenClaw agent 能够: - 运行 secopsai OpenClaw 检测管道 - 列出并汇总本地 SOC 存储中的发现 - 通过原生分类工作流按 ID 调查并关闭发现 - 运行原生分类编排器,检查已排队操作并应用已批准操作 - 获取任何发现的结构化缓解步骤 - 运行本地优先的威胁情报(IOC)管道,并在 OpenClaw 回放中匹配 IOC - 审查 PyPI 与 npm 软件包版本是否存在供应链投毒 - 为可疑的供应链发现建议误报操作 ## 前提假设 - secopsai 已安装于 ~/secopsai,最好通过透明仓库签出 / 手动安装流程,例如: - git clone https://github.com/Techris93/secopsai.git ~/secopsai - cd ~/secopsai && python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt - OpenClaw 审计日志位于同一主机的 ~/.openclaw/logs/。 - agent 拥有 exec 工具以运行 shell 命令。 - 所有命令均使用 ~/secopsai/.venv 虚拟环境。若需安装指引,优先引导用户前往 GitHub 仓库/手动安装路径;仅将托管安装器作为可选快捷方式,而非默认推荐。 --- ## 安全默认值(必读) 本 skill 可执行 shell 命令,并在分类时修改本地 SOC 存储。 - 默认优先执行只读操作(list/show/check)。 - 任何写入/分类操作(triage close、triage orchestrate、triage apply-action)前,须显式获得用户确认。 - 若启用定时任务,确保其在受控账户下运行,且自动写入为预期行为。 - 在启用无人值守自动化前,请备份 SOC 数据库(data/openclaw/findings/openclaw_soc.db)。 ## 命令映射 ### 1. 显示发现 用户表述: - "show findings" - "show today's findings" - "list findings" - "what findings do we have" Exec 命令: ``bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai list --severity info --json --cache-ttl 60 ` (--json 亦可置于子命令前,例如 secopsai --json list ...。) Agent 行为: - 解析 secopsai list 返回的 JSON(字段:findings)。 - 对每个发现提取:finding_id、severity、status、disposition、title。 - 回复内容: - 总计数量 - 按严重级别统计(HIGH / MEDIUM / LOW / INFO) - 列出 HIGH(及 MEDIUM)发现,含 ID 与标题 --- ### 2. 运行每日管道 用户表述: - "run daily pipeline" - "run secops scan" - "refresh findings" - "run live" Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai refresh --json && \ secopsai list --severity high --json --cache-ttl 300 ` Agent 行为: - 先运行一次管道(refresh),再列出当前高严重级别发现。 - 从 list JSON 输出中,突出显示 NEW 或 HIGH/CRITICAL 发现(依据 first_seen/last_seen 字段)。 示例回复: > Daily SecOps summary: 3 high-severity findings. > > - HIGH: OCF-C9D2523C770B6731 — OpenClaw Dangerous Exec / Tool Burst (status=open) > - HIGH: OCF-62FA8D1D3578BF6E — OpenClaw Sensitive Config (status=open) > > Reply triage OCF-... to mark as reviewed, or mitigate OCF-... for remediation steps. --- ### 3. 调查某个发现 用户表述: - investigate SCM- - triage OCF- - investigate EXFIL- Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai triage investigate --search-root "$HOME/secopsai" --json ` Agent 行为: - 汇总: - 推荐处置 - 依赖存在情况 - 策略匹配 - 裁决说明 - 后续操作 - 针对供应链发现,可视情况追加: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai supply-chain suggest-fp-action --search-root "$HOME/secopsai" --json ` --- ### 4. 关闭发现(写入) 重要:此操作将修改本地 SOC 存储。运行前需用户确认。 用户表述: - close SCM- as expected_behavior - close OCF- as needs_review note "..." Exec 命令模板: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai triage close --disposition --note "" --json ` Agent 行为: 向用户回显最终状态与处置结果。 --- ### 5. 详细展示单个发现 用户表述: - show OCF- - details OCF- Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai show OCF- --json ` Agent 行为: 解析并汇总 JSON:标题、严重级别、状态、处置、规则 ID、事件数量、首次/末次出现时间。优先使用 secopsai show 的结构化字段,避免重新解析原始文本。 --- ### 6. 运行分类编排器(写入) 重要:此操作可自动关闭明显安全的发现。运行前需用户确认。 用户表述: - run triage orchestrator - orchestrate findings - process open findings Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai triage orchestrate --search-root "$HOME/secopsai" --limit 20 --json ` Agent 行为: - 汇总: - processed - auto_applied - queued - 各发现的主要结果 - 若存在排队操作,可提供: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai triage queue --json ` 并在批准后执行: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai triage apply-action ACT-0001 --yes --json ` --- ### 7. 检查恶意软件或外泄 用户表述: - "check malware" - "check exfil" - "check both" - "any malware findings?" Exec 命令模板: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai check --type --severity medium --json --cache-ttl 60 ` Agent 行为: 解析 JSON(check 载荷:findings_total、matched_count、high_or_above、top_matches)并给出紧凑汇总: > Malware check: 2 matching findings (1 HIGH). > Top: OCF-C9D2523C770B6731, HIGH — OpenClaw Dangerous Exec / Policy Denials. --- ### 8. 缓解发现(推荐操作) 用户表述: - mitigate OCF- - show mitigation OCF- - what should I do for OCF- Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai mitigate OCF- --json --cache-ttl 60 ` 预期 JSON 字段: finding_id、title、severity、status、disposition、rule_ids、recommended_actions(字符串列表)。 Agent 行为: 以编号列表形式回复 recommended_actions。 示例: > Mitigation steps for OCF-C9D2523C770B6731 (HIGH — OpenClaw Dangerous Exec / Tool Burst): > > 1. Identify which agent or skill issued the dangerous execs and confirm business justification. > 2. If unauthorized, disable or restrict that skill/tool configuration in OpenClaw. > 3. Rotate any secrets used in the commands (tokens, SSH keys, API keys). > 4. Add stricter policy/approval requirements for high-risk exec operations. 若 recommended_actions 为空或缺失: > No curated mitigation steps are available yet for this finding. > Recommended next steps: review the associated events, confirm if the behaviour is expected, and restrict any over-permissive skills or credentials used. --- ## 威胁情报(IOCs) ### 7. 刷新 IOC 情报源 用户表述: - "refresh intel" - "update iocs" - "pull threat intel" Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai intel refresh --json ` Agent 行为: - 解析 JSON 并报告 IOC 总数及任何源错误。 - 默认不调用外部付费富化 API。 --- ### 8. 在 OpenClaw 回放中匹配 IOC 用户表述: - "match intel" - "check iocs" - "any intel matches" Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai intel match --limit-iocs 500 --json ` Agent 行为: - 解析 matched_findings。 - 若存在匹配,列出前 3 条 TI-... 发现 ID 与标题,并提供 show TI-...。 --- ## 供应链监控 ### 9. 扫描软件包版本 用户表述: - "scan this PyPI package release" - "check this npm package version" - "review package diff" Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai supply-chain scan --ecosystem pypi --package requests --version 2.32.0 --json ` Agent 行为: - 解析 result.verdict、result.finding_id 与 result.report_path。 - 若 verdict 为 malicious,提供 show 。 --- ### 10. 扫描近期热门软件包版本 用户表述: - "check recent package releases" - "run supply chain monitor" - "scan recent PyPI and npm releases" Exec 命令: `bash cd "$HOME/secopsai" && source .venv/bin/activate && \ secopsai supply-chain once --top 1000 --lookback 600 --json ` Agent 行为: - 解析 total_scanned、malicious、benign、errors 与 results。 - 若存在恶意发现,列出 SCM-... ID 与软件包版本。 --- ## 每日汇总(OpenClaw cron) 配置 OpenClaw 定时任务,驱动 secopsai CLI 并生成简洁的聊天摘要。 - 调度: 30 7 *(本地 07:30) - 动作(systemEvent 文本): `text [SECOPS_DAILY_SUMMARY_TRIGGER] Run the SecOpsAI pipeline and summarise new/high findings for this chat. Suggested steps for the agent: 1) cd "$HOME/secopsai" && source .venv/bin/activate 2) secopsai refresh --json 3) secopsai list --severity high --json --cache-ttl 300 4) Focus on high/critical findings first_seen in the last 24h. 5) Post a compact summary back into this conversation. ` 当触发时,agent 应: 1. 通过 exec 执行 secopsai 命令。 2. 解析 secopsai list --severity high --json 的 JSON 发现载荷。 3. 发布摘要:总计数量、HIGH/CRITICAL 细分,以及前几条发现 ID 与标题、状态。 4. 邀请用户对任何标记项执行 triage OCF-... 或 mitigate OCF-...`。