logo
0
0
WeChat Login
bug_zi<1844677084@qq.com>
Improve README skill overview

SecurityAgent Skills

这个仓库集中维护面向运维与安全巡检场景的 Codex Skills。每个一级目录都是一个可独立安装、独立分发、独立运行的 skill。

当前包含两个 skill:

  • server-health-monitor/:服务器运行状态与认证安全巡检。
  • website-health-inspector/:网站与管理平台健康巡检。

目录结构

SecurityAgent/
├─ server-health-monitor/
│  ├─ SKILL.md
│  ├─ agents/
│  ├─ assets/
│  ├─ references/
│  ├─ scripts/
│  └─ tests/
└─ website-health-inspector/
   ├─ SKILL.md
   ├─ agents/
   ├─ assets/
   ├─ docs/
   ├─ references/
   ├─ scripts/
   └─ tests/

Skill 1:server-health-monitor

server-health-monitor 用于生成中文、可交付、可复核的服务器运行状态巡检报告。它面向服务器清单、运维资产表、doops 节点、zheyin/hdu 等内网环境巡检场景。

适用任务:

  • 检查服务器 CPU、内存、磁盘、负载、uptime、主要进程和关键服务状态。
  • 通过 doops 检查 zheyin/hdu 节点自身运行状态。
  • 对 Excel/CSV/JSON 服务器清单做网络端口探测和可监测性分层。
  • 通过授权的 SSH、WinRM、SNMPv3 或 doops 通道采集主机指标。
  • 检查 K8s 应用镜像一致性。
  • 检查认证安全风险,包括登录失败/成功日志、账号锁定策略、SSH/RDP/WinRM 防护配置,以及显式授权后的本地密码强度评分。

核心能力:

  • doops 通道状态:targetsinfo、workspace push -> exec -> read -> clean、传输模式、session、清理状态。
  • 网络证据:IP 可达性、端口 open/closed/timeout、端口来源、管理端口与业务端口分级。
  • 主机证据:CPU、内存、磁盘、负载、uptime、主要运行进程、关键服务状态。
  • 认证安全:最近 N 天认证日志统计、失败后成功登录模式、防护配置缺口、弱口令风险评分。
  • 报告交付:HTML、PDF、Markdown、JSON、质量审计、交付清单、AI 或 HTML/CSS 导览图。
  • 多服务器批次:总报告 + 单机报告索引 + 每台可监测服务器的单独报告。

安全边界:

  • 默认只读巡检,不执行变更操作。
  • 不做在线密码爆破,不做弱口令登录尝试,不导出系统 hash,不做 hash 破解。
  • --password-strength-audit 必须由用户明确授权后才读取本次运行凭证,并且只在内存中评分。
  • 报告不得展示明文密码、hash、token、私钥、完整认证头或完整原始日志。

常用命令示例:

# zheyin doops 节点自身健康巡检
$env:DOOPS_ALLOW_INSECURE_GATEWAY='1'
python server-health-monitor/scripts/collect_doops_inventory.py --environment zheyin --out reports/zheyin-self-node/inventory.json
python server-health-monitor/scripts/run_server_health_monitor.py --inventory reports/zheyin-self-node/inventory.json --out reports/zheyin-self-node

# Excel 清单批量探测并采集主机指标
python server-health-monitor/scripts/collect_doops_inventory.py --inventory path/to/servers.xlsx --probe-target zheyin --host-metrics --host-metrics-target zheyin --classify-inventory --out reports/server-run/inventory.json
python server-health-monitor/scripts/run_server_health_monitor.py --inventory reports/server-run/inventory.json --out reports/server-run --guide-mode ai-image

# 启用认证安全巡检
python server-health-monitor/scripts/collect_doops_inventory.py --inventory path/to/servers.xlsx --probe-target zheyin --host-metrics --host-metrics-target zheyin --auth-security --auth-log-window-days 7 --out reports/auth-security/inventory.json
python server-health-monitor/scripts/run_server_health_monitor.py --inventory reports/auth-security/inventory.json --out reports/auth-security

Skill 2:website-health-inspector

website-health-inspector 用于面向管理平台管理员生成网站健康巡检报告。它支持临时 URL 快速巡检、Excel 资源清单批量巡检,以及带管理员凭证的深度浏览器巡检。

适用任务:

  • 检查网站是否可访问、打开是否超时、页面是否异常。
  • 审查网页内容完整性、关键页面状态、错误页、空白页、异常跳转。
  • 使用浏览器自动化复核管理员登录链路和后台页面。
  • 检查多站点清单,生成整体总报告和每个站点的单独报告。
  • 可选检查主机、微服务或接口健康状态。
  • 生成面向管理人员的正式巡检交付物。

核心能力:

  • URL 快速巡检:适合临时给出一个网站或后台地址的检查。
  • Excel 清单巡检:适合批量网站、管理后台、业务系统入口巡检。
  • 深度浏览器巡检:支持用户名和密码环境变量,复核登录、跳转、后台可用性。
  • 内容审查:识别页面缺失、异常文案、空页面、错误提示、低可读内容等。
  • 性能快照:记录轻量打开时间、慢页面、TTFB 等单次观测数据。
  • 评分与复核:按根因归并扣分,避免同一问题重复扣分。
  • 报告交付:HTML、PDF、Markdown、JSON、质量审计、交付清单、AI 或 HTML/CSS 导览图。

安全边界:

  • 管理员密码应通过环境变量传入,不应写入命令历史、报告或仓库。
  • 自动化登录失败不等同于生产登录故障,报告必须标注浏览器自动化和会话保持边界。
  • 报告不得泄露密码、token、Cookie、私钥、真实 API Key 或敏感后台配置。
  • 正式 PDF 必须由正式 HTML 渲染生成,不使用占位 PDF。

常用命令示例:

# 临时 URL 快速巡检
python website-health-inspector/scripts/run_health_inspection.py --url https://example.com/admin --out reports/site-run

# 管理员深度巡检,密码通过环境变量传入
$env:WEBSITE_HEALTH_ADMIN_PASSWORD='replace-with-local-secret'
python website-health-inspector/scripts/run_health_inspection.py --url https://example.com/admin --username admin --password-env WEBSITE_HEALTH_ADMIN_PASSWORD --out reports/site-deep

# 多站点清单巡检
python website-health-inspector/scripts/run_multi_site_inspection.py --inventory path/to/sites.xlsx --out reports/site-batch

安装方式

将需要使用的 skill 目录复制到 Codex skills 目录即可,例如:

Copy-Item -Recurse -Force server-health-monitor C:\Users\Administrator\.codex\skills\server-health-monitor
Copy-Item -Recurse -Force website-health-inspector C:\Users\Administrator\.codex\skills\website-health-inspector

安装后在 Codex 中可以通过 $server-health-monitor$website-health-inspector 显式调用,也可以让 Codex 根据任务描述自动触发。

验证方式

服务器巡检 skill:

python -m pytest server-health-monitor/tests/test_server_health_monitor.py -q
python server-health-monitor/scripts/check_text_integrity.py

网站巡检 skill:

python -m pytest website-health-inspector/tests -q
python website-health-inspector/scripts/check_runtime_dependencies.py --pdf

提交与发布注意事项

  • 不要提交 .env.doops/reports/runs/output/、浏览器截图、交付物目录、缓存目录或真实凭证。
  • 不要提交用户提供的 Excel 原始资产表、服务器账号密码表、后台账号密码或 API Key。
  • 每个 skill 的具体使用入口以对应目录下的 SKILL.md 为准。
  • 更新脚本后应至少运行对应 skill 的测试和文本完整性检查。