OpenClaw Host Hardening
Overview
Assess and harden the host running OpenClaw, then align it to a user-defined risk tolerance without breaking access. Use OpenClaw security tooling as a first-class signal, but treat OS hardening as a separate, explicit set of steps.
Core rules
- - Recommend running this skill with a state-of-the-art model (e.g., Opus 4.5, GPT 5.2+). The agent should self-check the current model and suggest switching if below that level; do not block execution.
- Require explicit approval before any state-changing action.
- Do not modify remote access settings without confirming how the user connects.
- Prefer reversible, staged changes with a rollback plan.
- Never claim OpenClaw changes the host firewall, SSH, or OS updates; it does not.
- If role/identity is unknown, provide recommendations only.
- Formatting: every set of user choices must be numbered so the user can reply with a single digit.
- System-level backups are recommended; try to verify status.
Workflow (follow in order)
0) Model self-check (non-blocking)
Before starting, check the current model. If it is below state-of-the-art (e.g., Opus 4.5, GPT 5.2+), recommend switching. Do not block execution.
1) Establish context (read-only)
Try to infer 1–5 from the environment before asking. Prefer simple, non-technical questions if you need confirmation.
Determine (in order):
- 1. OS and version (Linux/macOS/Windows), container vs host.
- Privilege level (root/admin vs user).
- Access path (local console, SSH, RDP, tailnet).
- Network exposure (public IP, reverse proxy, tunnel).
- OpenClaw gateway status and bind address.
- Backup system and status (e.g., Time Machine, system images, snapshots).
- Deployment context (local mac app, headless gateway host, remote gateway, container/CI).
- Disk encryption status (FileVault/LUKS/BitLocker).
- OS automatic security updates status.
Note: these are not blocking items, but are highly recommended, especially if OpenClaw can access sensitive data.
- 10. Usage mode for a personal assistant with full access (local workstation vs headless/remote vs other).
First ask once for permission to run read-only checks. If granted, run them by default and only ask questions for items you cannot infer or verify. Do not ask for information already visible in runtime or command output. Keep the permission ask as a single sentence, and list follow-up info needed as an unordered list (not numbered) unless you are presenting selectable choices.
If you must ask, use non-technical prompts:
- - “Are you using a Mac, Windows PC, or Linux?”
- “Are you logged in directly on the machine, or connecting from another computer?”
- “Is this machine reachable from the public internet, or only on your home/network?”
- “Do you have backups enabled (e.g., Time Machine), and are they current?”
- “Is disk encryption turned on (FileVault/BitLocker/LUKS)?”
- “Are automatic security updates enabled?”
- “How do you use this machine?”
Examples:
- Personal machine shared with the assistant
- Dedicated local machine for the assistant
- Dedicated remote machine/server accessed remotely (always on)
- Something else?
Only ask for the risk profile after system context is known.
If the user grants read-only permission, run the OS-appropriate checks by default. If not, offer them (numbered). Examples:
- 1. OS:
uname -a, sw_vers, cat /etc/os-release. - Listening ports:
- Linux:
ss -ltnup (or
ss -ltnp if
-u unsupported).
- macOS:
lsof -nP -iTCP -sTCP:LISTEN.
- 3. Firewall status:
- Linux:
ufw status,
firewall-cmd --state,
nft list ruleset (pick what is installed).
- macOS:
/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate and
pfctl -s info.
- 4. Backups (macOS):
tmutil status (if Time Machine is used).
2) Run OpenClaw security audits (read-only)
As part of the default read-only checks, run openclaw security audit --deep. Only offer alternatives if the user requests them:
- 1.
openclaw security audit (faster, non-probing) - INLINECODE15 (structured output)
Offer to apply OpenClaw safe defaults (numbered):
- 1. INLINECODE16
Be explicit that --fix only tightens OpenClaw defaults and file permissions. It does not change host firewall, SSH, or OS update policies.
If browser control is enabled, recommend that 2FA be enabled on all important accounts, with hardware keys preferred and SMS not sufficient.
3) Check OpenClaw version/update status (read-only)
As part of the default read-only checks, run openclaw update status.
Report the current channel and whether an update is available.
4) Determine risk tolerance (after system context)
Ask the user to pick or confirm a risk posture and any required open services/ports (numbered choices below).
Do not pigeonhole into fixed profiles; if the user prefers, capture requirements instead of choosing a profile.
Offer suggested profiles as optional defaults (numbered). Note that most users pick Home/Workstation Balanced:
- 1. Home/Workstation Balanced (most common): firewall on with reasonable defaults, remote access restricted to LAN or tailnet.
- VPS Hardened: deny-by-default inbound firewall, minimal open ports, key-only SSH, no root login, automatic security updates.
- Developer Convenience: more local services allowed, explicit exposure warnings, still audited.
- Custom: user-defined constraints (services, exposure, update cadence, access methods).
5) Produce a remediation plan
Provide a plan that includes:
- - Target profile
- Current posture summary
- Gaps vs target
- Step-by-step remediation with exact commands
- Access-preservation strategy and rollback
- Risks and potential lockout scenarios
- Least-privilege notes (e.g., avoid admin usage, tighten ownership/permissions where safe)
- Credential hygiene notes (location of OpenClaw creds, prefer disk encryption)
Always show the plan before any changes.
6) Offer execution options
Offer one of these choices (numbered so users can reply with a single digit):
- 1. Do it for me (guided, step-by-step approvals)
- Show plan only
- Fix only critical issues
- Export commands for later
7) Execute with confirmations
For each step:
- - Show the exact command
- Explain impact and rollback
- Confirm access will remain available
- Stop on unexpected output and ask for guidance
8) Verify and report
Re-check:
- - Firewall status
- Listening ports
- Remote access still works
- OpenClaw security audit (re-run)
Deliver a final posture report and note any deferred items.
Required confirmations (always)
Require explicit approval for:
- - Firewall rule changes
- Opening/closing ports
- SSH/RDP configuration changes
- Installing/removing packages
- Enabling/disabling services
- User/group modifications
- Scheduling tasks or startup persistence
- Update policy changes
- Access to sensitive files or credentials
If unsure, ask.
Periodic checks
After OpenClaw install or first hardening pass, run at least one baseline audit and version check:
- - INLINECODE19
- INLINECODE20
- INLINECODE21
Ongoing monitoring is recommended. Use the OpenClaw cron tool/CLI to schedule periodic audits (Gateway scheduler). Do not create scheduled tasks without explicit approval. Store outputs in a user-approved location and avoid secrets in logs.
When scheduling headless cron runs, include a note in the output that instructs the user to call healthcheck so issues can be fixed.
Required prompt to schedule (always)
After any audit or hardening pass, explicitly offer scheduling and require a direct response. Use a short prompt like (numbered):
- 1. “Do you want me to schedule periodic audits (e.g., daily/weekly) via
openclaw cron add?”
If the user says yes, ask for:
- - cadence (daily/weekly), preferred time window, and output location
- whether to also schedule INLINECODE24
Use a stable cron job name so updates are deterministic. Prefer exact names:
- - INLINECODE25
- INLINECODE26
Before creating, openclaw cron list and match on exact name. If found, openclaw cron edit <id> ....
If not found, openclaw cron add --name <name> ....
Also offer a periodic version check so the user can decide when to update (numbered):
- 1.
openclaw update status (preferred for source checkouts and channels) - INLINECODE32 (published npm version)
OpenClaw command accuracy
Use only supported commands and flags:
- - INLINECODE33
- INLINECODE34 / INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38
Do not invent CLI flags or imply OpenClaw enforces host firewall/SSH policies.
Logging and audit trail
Record:
- - Gateway identity and role
- Plan ID and timestamp
- Approved steps and exact commands
- Exit codes and files modified (best effort)
Redact secrets. Never log tokens or full credential contents.
Memory writes (conditional)
Only write to memory files when the user explicitly opts in and the session is a private/local workspace
(per docs/reference/templates/AGENTS.md). Otherwise provide a redacted, paste-ready summary the user can
decide to save elsewhere.
Follow the durable-memory prompt format used by OpenClaw compaction:
- - Write lasting notes to
memory/YYYY-MM-DD.md.
After each audit/hardening run, if opted-in, append a short, dated summary to memory/YYYY-MM-DD.md
(what was checked, key findings, actions taken, any scheduled cron jobs, key decisions,
and all commands executed). Append-only: never overwrite existing entries.
Redact sensitive host details (usernames, hostnames, IPs, serials, service names, tokens).
If there are durable preferences or decisions (risk posture, allowed ports, update policy),
also update MEMORY.md (long-term memory is optional and only used in private sessions).
If the session cannot write to the workspace, ask for permission or provide exact entries
the user can paste into the memory files.
OpenClaw 主机加固
概述
评估并加固运行OpenClaw的主机,在不中断访问的前提下将其调整至用户定义的风险容忍度。将OpenClaw安全工具作为一级信号使用,但将操作系统加固视为独立、明确的步骤集。
核心规则
- - 建议使用最先进的模型(如Opus 4.5、GPT 5.2+)运行此技能。代理应自行检查当前模型,若低于该水平则建议切换;不阻止执行。
- 任何状态变更操作前需获得明确批准。
- 未确认用户连接方式前,不得修改远程访问设置。
- 优先采用可逆、分阶段变更并附带回滚方案。
- 切勿声称OpenClaw会修改主机防火墙、SSH或操作系统更新;它不会。
- 若角色/身份未知,仅提供建议。
- 格式要求:每组用户选项必须编号,以便用户用单个数字回复。
- 建议进行系统级备份;尝试验证状态。
工作流程(按顺序执行)
0)模型自检(非阻塞)
开始前检查当前模型。若低于最先进水平(如Opus 4.5、GPT 5.2+),建议切换。不阻止执行。
1)建立上下文(只读)
在提问前尝试从环境中推断1-5项。如需确认,优先使用简单、非技术性问题。
按顺序确定:
- 1. 操作系统及版本(Linux/macOS/Windows),容器还是主机。
- 权限级别(root/管理员 vs 普通用户)。
- 访问路径(本地控制台、SSH、RDP、tailnet)。
- 网络暴露(公网IP、反向代理、隧道)。
- OpenClaw网关状态及绑定地址。
- 备份系统及状态(如Time Machine、系统镜像、快照)。
- 部署环境(本地Mac应用、无头网关主机、远程网关、容器/CI)。
- 磁盘加密状态(FileVault/LUKS/BitLocker)。
- 操作系统自动安全更新状态。
注意:这些非阻塞项,但强烈建议检查,尤其当OpenClaw可访问敏感数据时。
- 10. 拥有完全访问权限的个人助手使用模式(本地工作站 vs 无头/远程 vs 其他)。
首先一次性请求运行只读检查的权限。若获准,默认执行检查,仅对无法推断或验证的项目提问。不要询问运行时或命令输出中已可见的信息。将权限请求保持为单句,后续所需信息以无序列表(非编号)形式列出,除非提供可选选项。
如需提问,使用非技术性提示:
- - 您使用的是Mac、Windows PC还是Linux?
- 您是直接登录本机,还是从其他电脑连接?
- 此机器是否可从公共互联网访问,还是仅限家庭/网络内?
- 您是否启用了备份(如Time Machine),且备份是否最新?
- 磁盘加密是否已开启(FileVault/BitLocker/LUKS)?
- 是否启用了自动安全更新?
- 您如何使用此机器?
示例:
- 与助手共享的个人机器
- 专用于助手的本地机器
- 远程访问的专用远程机器/服务器(始终在线)
- 其他?
仅在了解系统环境后询问风险概况。
若用户授予只读权限,默认运行适合操作系统的检查。若未授予,提供选项(编号)。示例:
- 1. 操作系统:uname -a、sw_vers、cat /etc/os-release。
- 监听端口:
- Linux:ss -ltnup(若不支持-u则用ss -ltnp)。
- macOS:lsof -nP -iTCP -sTCP:LISTEN。
- 3. 防火墙状态:
- Linux:ufw status、firewall-cmd --state、nft list ruleset(选择已安装的)。
- macOS:/usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate和pfctl -s info。
- 4. 备份(macOS):tmutil status(若使用Time Machine)。
2)运行OpenClaw安全审计(只读)
作为默认只读检查的一部分,运行openclaw security audit --deep。仅在用户要求时提供替代方案:
- 1. openclaw security audit(更快,非探测性)
- openclaw security audit --json(结构化输出)
提供应用OpenClaw安全默认值的选项(编号):
- 1. openclaw security audit --fix
明确说明--fix仅收紧OpenClaw默认设置和文件权限。它不会修改主机防火墙、SSH或操作系统更新策略。
若浏览器控制已启用,建议在所有重要账户上启用双因素认证,优先使用硬件密钥,短信不足够。
3)检查OpenClaw版本/更新状态(只读)
作为默认只读检查的一部分,运行openclaw update status。
报告当前渠道及是否有可用更新。
4)确定风险容忍度(系统环境确定后)
请用户选择或确认风险态势及任何所需开放服务/端口(下方编号选项)。
不要局限于固定配置;若用户偏好,可收集需求而非选择配置。
提供建议配置作为可选默认值(编号)。注意大多数用户选择家庭/工作站平衡型:
- 1. 家庭/工作站平衡型(最常见):防火墙开启并采用合理默认值,远程访问限制在LAN或tailnet内。
- VPS加固型:入站防火墙默认拒绝,最小开放端口,仅密钥SSH,禁止root登录,自动安全更新。
- 开发者便捷型:允许更多本地服务,附带明确暴露警告,仍进行审计。
- 自定义:用户定义的约束条件(服务、暴露范围、更新频率、访问方式)。
5)生成修复方案
提供包含以下内容的方案:
- - 目标配置
- 当前状态摘要
- 与目标的差距
- 分步修复步骤及精确命令
- 访问保持策略和回滚方案
- 风险及可能的锁定场景
- 最小权限说明(如避免管理员使用、在安全前提下收紧所有权/权限)
- 凭证卫生说明(OpenClaw凭证位置,优先使用磁盘加密)
始终在变更前展示方案。
6)提供执行选项
提供以下选项之一(编号以便用户用单个数字回复):
- 1. 为我执行(引导式,逐步批准)
- 仅展示方案
- 仅修复关键问题
- 导出命令供后续使用
7)带确认执行
每一步:
- - 显示精确命令
- 说明影响和回滚方案
- 确认访问将保持可用
- 遇到意外输出时停止并请求指导
8)验证并报告
重新检查:
- - 防火墙状态
- 监听端口
- 远程访问仍正常工作
- OpenClaw安全审计(重新运行)
提供最终状态报告并记录任何延期项。
必需确认(始终)
以下操作需明确批准:
- - 防火墙规则变更
- 打开/关闭端口
- SSH/RDP配置变更
- 安装/移除软件包
- 启用/禁用服务
- 用户/组修改
- 调度任务或启动持久化
- 更新策略变更
- 访问敏感文件或凭证
如有疑问,请询问。
定期检查
OpenClaw安装或首次加固后,至少运行一次基线审计和版本检查:
- - openclaw security audit
- openclaw security audit --deep
- openclaw update status
建议持续监控。使用OpenClaw cron工具/CLI调度定期审计(网关调度器)。未经明确批准不得创建计划任务。将输出存储在用户批准的位置,避免在日志中包含密钥。
调度无头cron运行时,在输出中包含一条提示,指示用户调用healthcheck以便修复问题。
调度提示(始终)
在任何审计或加固通过后,明确提供调度选项并要求直接回复。使用类似(编号)的简短提示:
- 1. 您是否希望我通过openclaw cron add调度定期审计(如每天/每周)?
若用户同意,询问:
- - 频率(每天/每周)、首选时间窗口和输出位置
- 是否同时调度openclaw update status
使用稳定的cron作业名称以确保更新确定性。优先使用精确名称:
- - healthcheck:security-audit
- healthcheck:update-status
创建前,运行openclaw cron list并匹配精确name。若找到,使用openclaw cron edit ...。
若未找到,使用openclaw cron add --name ...。
同时提供定期版本检查选项,以便用户决定何时更新(编号):
- 1. openclaw update status(适用于源码检出和渠道)
- npm view openclaw version(已发布的npm版本)
OpenClaw命令准确性
仅使用支持的命令和标志:
- - openclaw security audit [--deep] [--fix] [--json]
- openclaw status / openclaw status --deep
-