Security engineering workflow for OpenClaw privilege governance and hardening. Use for least-privilege execution, approval-first privileged actions, idle timeout controls, port + egress monitoring, and ISO 27001/NIST-aligned compliance reporting with mitigations.
Required tools:
python3 (>= 3.8)npm during bootstrap, or pre-installed)openclaw is not already installed)lsof, ss, or netstat for port/egress checksreadlink (standard on macOS/Linux, used by the runtime hook installer)Env vars (all optional, documented for configuration):
OPENCLAW_REQUIRE_POLICY_FILES — set to 1 to block privileged execution when policy files are missing1 to require a task session id for each privileged actionOPENCLAW_REQUIRE_SESSION_ID=1)1 to flag the current content source as untrusted1 to allow non-interactive sudo through the shim (default: blocked)1 to skip the interactive confirmation before modifying the macOS LaunchAgent plistPolicy files (admin reviewed):
Implement these controls in every security-sensitive task:
python3 scripts/generate_approved_ports.py, then review and prune.The script scripts/install-openclaw-runtime-hook.sh installs an opt-in sudo
shim at ~/.openclaw/bin/sudo. This shim shadows the system sudo binary by
prepending ~/.openclaw/bin to PATH in the OpenClaw gateway process.
What it does:
sudo invocations and routes them through INLINECODE41-h, --version, -k, -l) directly to real sudoWhat it does NOT do:
PATH includes ~/.openclaw/bin before INLINECODE48Opt-in: The hook is not installed by default. To enable it, run bootstrap with
ENFORCE_PRIVILEGED_EXEC=1. On macOS, the installer will prompt for confirmation
before modifying the gateway LaunchAgent plist. The shim can be removed at any time
by deleting ~/.openclaw/bin/sudo.
This skill writes only to ~/.openclaw/ and the assessments/ directory inside the
skill folder. No files are written outside these two trees.
Under ~/.openclaw/ (user config/state):
~/.openclaw/security/approved_ports.json — generated port baseline (by generate_approved_ports.py)root_session_guard.py)audit_logger.py)notify_on_violation.py)install-openclaw-runtime-hook.sh, see Runtime Hook section)auto_invoke_cycle.sh)Under assessments/ (inside skill directory):
assessments/openclaw-assessment.json — compliance check resultsTemporary files:
tempfile.NamedTemporaryFile (by generate_approved_ports.py) — auto-cleanedNo files are written to /usr/, /etc/, or any system directory.
OPENCLAW_UNTRUSTED_SOURCE=1 + prompt policy).OPENCLAW_REQUIRE_SESSION_ID=1).~/.openclaw/security/privileged-audit.jsonl (best-effort).When reporting status, include:
check_id(s) affected, status, risk, and concise evidence.该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 cyber-security-engineer-1776419993 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 cyber-security-engineer-1776419993 技能
skillhub install cyber-security-engineer-1776419993
文件大小: 46.98 KB | 发布时间: 2026-4-17 20:05