Host Security Audit
Run a comprehensive security audit on the machine hosting OpenClaw. Checks OS-level security, OpenClaw configuration, and common misconfigurations.
Quick Start
Run the full audit:
CODEBLOCK0
Run with JSON output:
CODEBLOCK1
What It Checks
OS Security
- - Firewall — macOS Application Firewall or Linux ufw/firewalld
- Disk encryption — FileVault (macOS) or LUKS (Linux)
- Auto-updates — macOS SoftwareUpdate or unattended-upgrades
- Open ports — listening services on all interfaces
- Suspicious processes — crypto miners, reverse shells, unexpected listeners
OpenClaw Security
- - OpenClaw version — current vs latest available
- API key exposure — plaintext keys in config files
- Gateway bind address — flags 0.0.0.0 binding (exposed to network)
- File permissions — secrets directory permissions
System Health
- - Disk usage — warns at 80%, critical at 90%
- Brew outdated — packages with available updates (macOS)
- Time Machine — backup status and last backup time (macOS)
Scheduling Monthly Audits
Create an OpenClaw cron job for the 1st Monday of each month at 9 AM:
CODEBLOCK2
Remediation
The audit reports findings but does not auto-fix. For each finding:
- - CRITICAL — Act immediately (exposed API keys, no firewall, no encryption)
- WARNING — Schedule fix within a week (outdated packages, disk usage)
- OK — No action needed
To auto-fix OpenClaw-specific issues:
openclaw security audit --fix
This only tightens OpenClaw defaults and file permissions. It does not modify host firewall, SSH, or OS settings.
主机安全审计
对运行OpenClaw的主机进行全面安全审计。检查操作系统级安全、OpenClaw配置以及常见错误配置。
快速开始
运行完整审计:
bash
bash scripts/security-audit.sh
以JSON格式输出运行:
bash
bash scripts/security-audit.sh --json
检查内容
操作系统安全
- - 防火墙 — macOS应用程序防火墙或Linux ufw/firewalld
- 磁盘加密 — FileVault(macOS)或LUKS(Linux)
- 自动更新 — macOS SoftwareUpdate或unattended-upgrades
- 开放端口 — 所有接口上的监听服务
- 可疑进程 — 加密货币挖矿程序、反向Shell、意外监听器
OpenClaw安全
- - OpenClaw版本 — 当前版本与最新可用版本对比
- API密钥泄露 — 配置文件中的明文密钥
- 网关绑定地址 — 标记0.0.0.0绑定(暴露于网络)
- 文件权限 — secrets目录权限
系统健康
- - 磁盘使用率 — 80%时警告,90%时严重
- Brew过期包 — 有可用更新的软件包(macOS)
- Time Machine — 备份状态和上次备份时间(macOS)
安排月度审计
创建OpenClaw定时任务,每月第一个周一上午9点执行:
schedule: 0 9 1-7 * 1
payload: 运行完整主机安全审计。执行:bash /scripts/security-audit.sh — 按严重级别(严重/警告/正常)报告发现。仅在有严重或警告发现时通知用户。如果全部通过,则不执行任何操作(NO_REPLY)。
修复措施
审计报告发现但不会自动修复。针对每项发现:
- - 严重 — 立即处理(暴露的API密钥、无防火墙、无加密)
- 警告 — 一周内安排修复(过期软件包、磁盘使用率)
- 正常 — 无需操作
要自动修复OpenClaw特定问题:
bash
openclaw security audit --fix
此操作仅收紧OpenClaw默认设置和文件权限。不会修改主机防火墙、SSH或操作系统设置。