OpenClaw Security Audit
Original requested prompt, preserved verbatim:
"Effectuez un audit de sécurité tous les soirs à 23h faite un cron."
Use this skill when the user wants a repeatable OpenClaw host security audit, a nightly cron job, or immediate remediation of common hardening gaps.
Workflow
- 1. First install or verify the CLI so the agent uses a stable interface:
npm install -g nxtsecure-openclaw
then verify with:
nxtsecure openclaw doctor
- 2. If the CLI cannot be installed globally, fall back to the repository copy in
{baseDir}/../../bin/nxtsecure.mjs. - From the repository root, create the local configuration with
nxtsecure openclaw config init --output ./openclaw-security-audit.conf or copy {baseDir}/references/openclaw-security-audit.conf.example. - Run
nxtsecure openclaw audit --config ./openclaw-security-audit.conf to execute the audit and remediation workflow. - Install the nightly 23:00 cron entry with
nxtsecure openclaw cron install --log ~/openclaw-security-audit.log. - If every check passes, print exactly
audit de sécurité réussi. - If a check fails, explain the issue, attempt remediation immediately, and rerun the relevant verification.
Checks
The audit must verify:
- 1. Firewall enabled.
- INLINECODE8 active and total banned IP count collected.
- If SSH is used, password authentication must be disabled, public key authentication must be available, and the SSH service must not listen on port
22. - Unexpected listening ports identified and, when configured, blocked.
- Docker containers reviewed when Docker is present, with unexpected containers stopped only when an allowlist is configured.
- Disk usage below
80% on persistent filesystems. - Failed login attempts during the last 24 hours.
- Automatic security package updates enabled on the host.
- If VirusTotal is configured, URLs and files in scope must be checked before being trusted.
SSH hardening guidance
When SSH is enabled, the agent must help the user migrate safely instead of changing access blindly.
- 1. Explain the goal: SSH on a non-default port and key-only authentication.
- Ask or infer the target SSH port from configuration. Use
2222 only as a fallback example, not a forced default. - Help the user generate a key pair if needed:
ssh-keygen -t ed25519 -C "openclaw-admin"
- 4. Help the user install the public key on the server:
ssh-copy-id -p <new-port> <user>@<host>
or append the public key to
~/.ssh/authorized_keys with correct permissions.
- 5. Update SSH to use the chosen non-default port and disable password authentication.
- Make sure the firewall allows the new SSH port before reloading SSH.
- Tell the user to open a second terminal and verify:
ssh -p <new-port> <user>@<host>
- 8. Only after the new key-based login works, remove any temporary legacy access and confirm the hardening is complete.
If the agent cannot verify that key-based access on the new port works, it must explain the exact manual steps still required and avoid risky lockout actions.
VirusTotal guidance
When the user wants file or link reputation checks, the agent must use VirusTotal without an API key:
- 1. Use the OpenClaw
browser tool, not the VirusTotal API. - Ensure the OpenClaw browser tool is enabled before starting the workflow.
- For files, compute the SHA-256 locally first and prefer the public report page for an existing report.
- Only upload a file through the VirusTotal website when the user has explicitly allowed it, because website uploads may disclose the sample outside the organization.
- For URLs, open the public VirusTotal URL page in the browser tool and submit the URL for analysis through the web interface.
- If a file or URL is malicious, explain the verdict. For files, ask the user whether to keep or remove the file. For URLs, recommend blocking the URL or domain.
- If an item is suspicious, explain the risk and require explicit user confirmation before trusting it.
- For nightly automation, treat VirusTotal as browser-assisted review.
- If VirusTotal flags a file as malicious or suspicious, the agent must ask the user whether to keep or remove the file. The user always decides.
- Do not claim that a URL or file was cleared automatically when the agent has only prepared the VirusTotal browser workflow and not inspected the result page.
Use the bundled helper:
- - INLINECODE17
- INLINECODE18
- fallback: INLINECODE19
- fallback: INLINECODE20
OpenClaw browser flow:
- 1. INLINECODE21
- INLINECODE22 or
browser.navigate to https://www.virustotal.com/gui/home/url for URLs - INLINECODE25 or
browser.navigate to https://www.virustotal.com/gui/home/upload for files - Use
browser.snapshot and browser.act to type, upload, and inspect detection results
Operational notes
- - Run the audit as
root when possible. Some remediations require privileged access. - Adjust expected ports and allowed Docker containers before enabling strict enforcement.
- The bundled script prefers
ufw, then firewalld, then a non-empty nftables ruleset for firewall detection. - The script uses
sshd -T when available and falls back to SSH config files. - The bundled SSH policy expects a non-default port whenever SSH is enabled. Port
22 is treated as non-compliant. - The audit should enable automatic security updates when supported by the distribution, such as
unattended-upgrades on Debian or Ubuntu and dnf-automatic on RPM-based hosts. - Failed logins are collected from
journalctl, lastb, or /var/log/auth.log, depending on what the host exposes. - VirusTotal checks in this skill are intentionally API-free and rely on the public website plus the OpenClaw browser tool.
- The nightly cron line installed by the helper is
0 23 * * *.
Files
- -
{baseDir}/../../package.json: npm package definition for the nxtsecure openclaw CLI. - INLINECODE44 : npm CLI entrypoint for audit, cron, VirusTotal, and config init.
- INLINECODE45 : audit and remediation runner.
- INLINECODE46 : VirusTotal URL and file reputation helper.
- INLINECODE47 : idempotent cron installer for
23:00 every day. - INLINECODE49 : baseline configuration template.
OpenClaw 安全审计
原始请求提示,逐字保留:
Effectuez un audit de sécurité tous les soirs à 23h faite un cron.
当用户需要可重复的 OpenClaw 主机安全审计、夜间 cron 任务或常见加固漏洞的即时修复时,使用此技能。
工作流程
- 1. 首先安装或验证 CLI,以便代理使用稳定接口:
npm install -g nxtsecure-openclaw
然后使用以下命令验证:
nxtsecure openclaw doctor
- 2. 如果无法全局安装 CLI,则回退到 {baseDir}/../../bin/nxtsecure.mjs 中的仓库副本。
- 从仓库根目录,使用 nxtsecure openclaw config init --output ./openclaw-security-audit.conf 创建本地配置,或复制 {baseDir}/references/openclaw-security-audit.conf.example。
- 运行 nxtsecure openclaw audit --config ./openclaw-security-audit.conf 执行审计和修复工作流程。
- 使用 nxtsecure openclaw cron install --log ~/openclaw-security-audit.log 安装夜间 23:00 cron 条目。
- 如果所有检查均通过,则精确输出 audit de sécurité réussi。
- 如果检查失败,则解释问题,立即尝试修复,并重新运行相关验证。
检查项
审计必须验证:
- 1. 防火墙已启用。
- fail2ban 处于活动状态,并收集被封禁 IP 总数。
- 如果使用 SSH,必须禁用密码认证,必须启用公钥认证,且 SSH 服务不得监听端口 22。
- 识别意外监听端口,并在配置后予以阻止。
- 当存在 Docker 时审查 Docker 容器,仅在配置了允许列表时停止意外容器。
- 持久化文件系统的磁盘使用率低于 80%。
- 过去 24 小时内的失败登录尝试。
- 主机上已启用自动安全包更新。
- 如果配置了 VirusTotal,在信任范围内的 URL 和文件之前必须进行检查。
SSH 加固指南
当 SSH 启用时,代理必须帮助用户安全迁移,而不是盲目更改访问方式。
- 1. 解释目标:SSH 使用非默认端口和仅密钥认证。
- 从配置中询问或推断目标 SSH 端口。仅将 2222 作为回退示例,而非强制默认值。
- 如有需要,帮助用户生成密钥对:
ssh-keygen -t ed25519 -C openclaw-admin
- 4. 帮助用户在服务器上安装公钥:
ssh-copy-id -p <新端口> <用户>@<主机>
或将公钥以正确权限追加到 ~/.ssh/authorized_keys。
- 5. 更新 SSH 以使用选定的非默认端口并禁用密码认证。
- 在重新加载 SSH 之前,确保防火墙允许新的 SSH 端口。
- 告知用户打开第二个终端并验证:
ssh -p <新端口> <用户>@<主机>
- 8. 仅在新密钥登录正常工作后,才移除任何临时遗留访问权限,并确认加固完成。
如果代理无法验证新端口上的密钥访问是否正常工作,则必须解释仍需执行的确切手动步骤,并避免有风险的锁定操作。
VirusTotal 指南
当用户需要文件或链接信誉检查时,代理必须使用 VirusTotal 而无需 API 密钥:
- 1. 使用 OpenClaw browser 工具,而非 VirusTotal API。
- 在开始工作流程前确保 OpenClaw 浏览器工具已启用。
- 对于文件,先在本地计算 SHA-256,并优先使用现有报告的公开展示页面。
- 仅在用户明确允许时,才通过 VirusTotal 网站上传文件,因为网站上传可能会将样本泄露到组织外部。
- 对于 URL,在浏览器工具中打开公开的 VirusTotal URL 页面,并通过网页界面提交 URL 进行分析。
- 如果文件或 URL 是恶意的,解释判定结果。对于文件,询问用户是保留还是删除文件。对于 URL,建议阻止该 URL 或域名。
- 如果项目可疑,解释风险,并在信任前要求用户明确确认。
- 对于夜间自动化,将 VirusTotal 视为浏览器辅助审查。
- 如果 VirusTotal 将文件标记为恶意或可疑,代理必须询问用户是保留还是删除文件。用户始终拥有决定权。
- 当代理仅准备了 VirusTotal 浏览器工作流程而未检查结果页面时,不得声称 URL 或文件已自动清除。
使用捆绑的辅助工具:
- - nxtsecure openclaw vt url https://example.test
- nxtsecure openclaw vt file /path/to/sample.bin
- 回退:{baseDir}/scripts/openclawvirustotalcheck.sh --url https://example.test
- 回退:{baseDir}/scripts/openclawvirustotalcheck.sh --file /path/to/sample.bin
OpenClaw 浏览器流程:
- 1. browser.start
- browser.open 或 browser.navigate 到 https://www.virustotal.com/gui/home/url(对于 URL)
- browser.open 或 browser.navigate 到 https://www.virustotal.com/gui/home/upload(对于文件)
- 使用 browser.snapshot 和 browser.act 进行输入、上传和检查检测结果
操作说明
- - 尽可能以 root 身份运行审计。某些修复需要特权访问。
- 在启用严格强制执行之前,调整预期端口和允许的 Docker 容器。
- 捆绑脚本优先使用 ufw,然后是 firewalld,最后是非空的 nftables 规则集进行防火墙检测。
- 脚本在可用时使用 sshd -T,否则回退到 SSH 配置文件。
- 只要 SSH 启用,捆绑的 SSH 策略就要求使用非默认端口。端口 22 被视为不合规。
- 审计应在发行版支持时启用自动安全更新,例如 Debian 或 Ubuntu 上的 unattended-upgrades,以及基于 RPM 的主机上的 dnf-automatic。
- 失败登录从 journalctl、lastb 或 /var/log/auth.log 收集,具体取决于主机暴露的内容。
- 此技能中的 VirusTotal 检查有意不使用 API,而是依赖公共网站和 OpenClaw 浏览器工具。
- 辅助工具安装的夜间 cron 行为 0 23 *。
文件
- - {baseDir}/../../package.json:nxtsecure openclaw CLI 的 npm 包定义。
- {baseDir}/../../bin/nxtsecure.mjs:用于审计、cron、VirusTotal 和配置初始化的 npm CLI 入口点。
- {baseDir}/scripts/openclawsecurityaudit.sh:审计和修复运行器。
- {baseDir}/scripts/openclawvirustotalcheck.sh:VirusTotal URL 和文件信誉辅助工具。
- {baseDir}/scripts/install_cron.sh:用于每天 23:00 的幂等 cron 安装程序。
- {baseDir}/references/openclaw-security-audit.conf.example:基线配置模板。