OpenClaw Hardener
This skill provides a user-choice hardening tool that can:
- - Run OpenClaw’s built-in security audit (
openclaw security audit --deep / --fix). - Run workspace hygiene checks (exec bits, stray
.env, unsafe serialization patterns, etc.). - Apply safe mechanical fixes only when explicitly requested.
- Generate (and optionally apply) a Gateway
config.patch plan to tighten runtime policy.
Run the tool
Script:
Examples:
CODEBLOCK0
Design rules (do not violate)
- - Default = check-only. No file/config changes unless user runs
fix or apply-config. - No secrets in output. If a check reads sensitive paths, it must redact likely tokens.
- Patch plans must be explicit. Always show the patch before applying.
What it checks / fixes
OpenClaw built-in security audit
- - Runs
openclaw security audit --deep (and --fix in fix mode).
Workspace hygiene (scope: workspace + ~/.openclaw)
- - Permissions sanity under
~/.openclaw (basic checks). - Unexpected executable bits in non-executable filetypes.
- Stray
.env files (warn) and tracked .env (fail). - Risky deserialization / unsafe patterns in our scripts (heuristics).
Config hardening (optional plan)
Generates a conservative
config.patch template focusing on:
- - Tightening inbound access defaults (pairing/allowlist, mention gating) only if you opt-in.
- Ensuring sensitive log redaction is enabled.
(Exact keys depend on your config; the plan is best-effort and should be reviewed.)
OpenClaw 加固工具
此技能提供用户可选的加固工具,可执行以下操作:
- - 运行 OpenClaw 内置安全审计(openclaw security audit --deep / --fix)
- 运行工作区健康检查(可执行位、残留的 .env 文件、不安全的序列化模式等)
- 仅在用户明确要求时应用安全的机械修复
- 生成(并可选择应用)网关 config.patch 计划以收紧运行时策略
运行工具
脚本:
- - skills_live/openclaw-hardener/scripts/hardener.py
示例:
bash
只读检查(推荐默认模式)
python3 skills_live/openclaw-hardener/scripts/hardener.py check --all
仅运行 OpenClaw 内置审计(深度)
python3 skills_live/openclaw-hardener/scripts/hardener.py check --openclaw
仅运行工作区检查
python3 skills_live/openclaw-hardener/scripts/hardener.py check --workspace
应用安全修复(chmod/可执行位清理 + 可选 openclaw audit --fix)
python3 skills_live/openclaw-hardener/scripts/hardener.py fix --all
生成 config.patch 计划(输出 JSON5 补丁)
python3 skills_live/openclaw-hardener/scripts/hardener.py plan-config
应用计划(需要运行中的网关;使用 openclaw gateway call)
python3 skills_live/openclaw-hardener/scripts/hardener.py apply-config
设计规则(不可违反)
- - 默认 = 仅检查。 除非用户运行 fix 或 apply-config,否则不进行任何文件/配置更改。
- 输出中不包含机密信息。 如果检查读取敏感路径,必须对可能的令牌进行脱敏处理。
- 补丁计划必须明确。 在应用前始终显示补丁内容。
检查/修复内容
OpenClaw 内置安全审计
- - 运行 openclaw security audit --deep(在修复模式下运行 --fix)
工作区健康检查(范围:工作区 + ~/.openclaw)
- - ~/.openclaw 下的权限合理性检查(基本检查)
- 非可执行文件类型中出现意外的可执行位
- 残留的 .env 文件(警告)和已跟踪的 .env 文件(失败)
- 脚本中的风险性反序列化/不安全模式(启发式检测)
配置加固(可选计划)
生成保守的 config.patch 模板,重点关注:
- - 收紧入站访问默认设置(配对/白名单、提及限制)仅在您选择加入时
- 确保启用敏感日志脱敏功能
(具体键值取决于您的配置;该计划为尽力而为,应进行审查。)