name: cyber-security-engineer version: 0.1.9 description: 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)
- openclaw CLI (installed via npm during bootstrap, or pre-installed)
- npm (only needed for bootstrap if openclaw is not already installed)
- One of lsof, ss, or netstat for port/egress checks
- stat, readlink (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 missing
- OPENCLAW_REQUIRE_SESSION_ID — set to 1 to require a task session id for each privileged action
- OPENCLAW_TASK_SESSION_ID — per-task session id (used when OPENCLAW_REQUIRE_SESSION_ID=1)
- OPENCLAW_APPROVAL_TOKEN — if set, requires this token during the approval step
- OPENCLAW_UNTRUSTED_SOURCE — set to 1 to flag the current content source as untrusted
- OPENCLAW_VIOLATION_NOTIFY_CMD — absolute path to a notifier binary (must also be allowlisted)
- OPENCLAW_VIOLATION_NOTIFY_ALLOWLIST — JSON array of allowed argv arrays, or comma-separated absolute paths
- OPENCLAW_REAL_SUDO — override path to the real sudo binary (used by the runtime hook shim)
- OPENCLAW_PYTHON3 — override path to python3 (used by the runtime hook shim)
- OPENCLAW_CYBER_SKILL_DIR — override path to the skill directory (used by the runtime hook shim)
- OPENCLAW_ALLOW_NONINTERACTIVE_SUDO — set to 1 to allow non-interactive sudo through the shim (default: blocked)
- OPENCLAW_PRIV_REASON — human-readable reason passed to the guarded execution wrapper
- OPENCLAW_VIOLATION_NOTIFY_STATE — override path to the notification state file
- OPENCLAW_SKIP_PLIST_CONFIRM — set to 1 to skip the interactive confirmation before modifying the macOS LaunchAgent plist
Policy files (admin reviewed):
- ~/.openclaw/security/approved_ports.json
- ~/.openclaw/security/command-policy.json
- ~/.openclaw/security/egress_allowlist.json
- ~/.openclaw/security/prompt-policy.json
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:
- Intercepts sudo invocations and routes them through guarded_privileged_exec.py
- Requires explicit interactive user approval before running any privileged command
- Enforces command policy allow/deny rules, audit logging, and a 30-minute idle timeout
- Blocks non-interactive sudo by default (prevents automated abuse)
- Passes through harmless flags (-h, --version, -k, -l) directly to real sudo
What it does NOT do:
- It does not replace or modify the system sudo binary
- It does not grant itself any elevated permissions
- It only affects processes whose PATH includes ~/.openclaw/bin before /usr/bin
Opt-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)
- ~/.openclaw/security/root-session-state.json — elevated session state (by root_session_guard.py)
- ~/.openclaw/security/privileged-audit.jsonl — append-only audit log (by audit_logger.py)
- ~/.openclaw/security/violation-notify-state.json — notification diff state (by notify_on_violation.py)
- ~/.openclaw/bin/sudo — opt-in sudo shim (by install-openclaw-runtime-hook.sh, see Runtime Hook section)
- ~/.openclaw/logs/cyber-security-engineer-auto.log — auto-cycle run log (by auto_invoke_cycle.sh)
Under assessments/ (inside skill directory):
- assessments/openclaw-assessment.json — compliance check results
- assessments/compliance-summary.json — structured summary for tools/integrations
- assessments/compliance-dashboard.html — human-readable report page
- assessments/port-monitor-latest.json — latest open-port scan output
- assessments/egress-monitor-latest.json — latest outbound connection scan output
Temporary files:
- A short-lived temp file via tempfile.NamedTemporaryFile (by generate_approved_ports.py) — auto-cleaned
No files are written to /usr/, /etc/, or any system directory.
references/least-privilege-policy.mdreferences/port-monitoring-policy.mdreferences/compliance-controls-map.jsonreferences/approved_ports.template.jsonreferences/command-policy.template.jsonreferences/prompt-policy.template.jsonreferences/egress-allowlist.template.jsonscripts/preflight_check.pyscripts/root_session_guard.pyscripts/audit_logger.pyscripts/command_policy.pyscripts/prompt_policy.pyscripts/guarded_privileged_exec.pyscripts/install-openclaw-runtime-hook.shscripts/port_monitor.pyscripts/generate_approved_ports.pyscripts/egress_monitor.pyscripts/notify_on_violation.pyscripts/compliance_dashboard.pyscripts/live_assessment.py來源於7w4.net。
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.這個 Skill 質量不錯,提供了完整的安全治理能力,包括許可權審批、命令過濾、埠監控和合規報告。它有詳細的使用說明和模板,配置靈活但上手需要一定門檻。主要問題是配置比較複雜,安全策略的完全落地需要手動操作,初始評估可能顯示較多待修復項。建議有安全基礎的使用者使用。