← 返回
安全合规 中文

OpenClaw Security Check

Security self-check for OpenClaw deployments. Audits openclaw.json config and host security in one pass: gateway exposure, auth mode, token strength, channel...
对OpenClaw部署的安全自检,一次审计openclaw.json配置和主机安全:网关暴露、认证模式、令牌强度、通道等。
guoqunabc
安全合规 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 958
下载
💾 6
安装
1
版本
#latest

概述

OpenClaw Security Check

Fast 10-point security audit for OpenClaw config + host. Read-only by default, optional auto-fix.

Quick Start

Run the bundled script for a non-interactive report:

scripts/security-check.sh        # human-readable
scripts/security-check.sh --json # structured output

Or tell the agent: "run a security check" / "audit my OpenClaw config".

What It Checks

#CheckSeverity if failedWhat it looks at
-----------------------------------------------
1Gateway BindCRITICALgateway.bind — must be loopback, not 0.0.0.0
2Gateway AuthCRITICALgateway.auth.mode — must not be off/none
3Token StrengthHIGHgateway.auth.token — must be ≥32 chars
4DM PolicyHIGHPer-channel dmPolicyopen without allowFrom is dangerous
5Group PolicyHIGHPer-channel groupPolicyopen/any allows strangers to trigger the agent
6Config PermissionsMEDIUMFile mode of openclaw.json — should be 600 or 400
7Plaintext SecretsMEDIUMScans config values for keys matching password/secret/apiKey/privateKey
8Host FirewallHIGHUFW or firewalld must be installed and active
9SSH HardeningMEDIUMPasswordAuthentication and PermitRootLogin in sshd_config
10Exposed PortsMEDIUMCount of non-loopback listening ports (>8 = FAIL)

Auto-Fix Flow

If any item is FAIL or WARN, offer fixes. Always confirm with the user first.

Fix Recipes

#1 Gateway Bind → FAIL:

Set gateway.bind to "loopback". Use openclaw CLI if available, otherwise edit openclaw.json.

#2 Gateway Auth → FAIL:

Set gateway.auth.mode to "token". Generate a strong token if missing:

openssl rand -hex 24

#3 Token Strength → FAIL/WARN:

Replace with a new 48-char hex token: openssl rand -hex 24.

Warn user that paired clients will need the new token.

#4 DM Policy → FAIL:

Set affected channels to "dmPolicy": "pairing", or add specific IDs to allowFrom.

#5 Group Policy → FAIL:

Set affected channels to "groupPolicy": "allowlist".

#6 Config Permissions → FAIL/WARN:

chmod 600 ~/.openclaw/openclaw.json

#7 Plaintext Secrets → WARN:

Cannot auto-fix safely. Advise moving secrets to environment variables or .env.local.

#8 Host Firewall → FAIL:

sudo apt install ufw -y
sudo ufw default deny incoming
sudo ufw default allow outgoing
# IMPORTANT: Allow SSH before enabling!
sudo ufw allow from <trusted_ip_or_subnet> to any port 22 proto tcp
sudo ufw enable

#9 SSH Hardening → WARN:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo sed -i 's/^#*PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo sed -i 's/^#*PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config
sudo sshd -t && sudo systemctl reload ssh

CRITICAL: Ensure key-based SSH access works in a separate session before closing current one.

#10 Exposed Ports → WARN/FAIL:

Review with ss -ltnp, close unnecessary services, or restrict with firewall rules.

Fix Rules

  • Backup first: cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak
  • Merge, don't overwrite: Modify only the specific keys, preserve everything else.
  • SSH changes need special care: Always test access in a second session before closing the first.
  • Firewall: allow SSH first, enable second. Getting this backwards locks you out.
  • After config changes: openclaw gateway restart to apply.
  • Re-run the check after fixes to confirm everything passes.

Integration

Heartbeat

Add to HEARTBEAT.md for periodic checks:

- Every heartbeat: Run scripts/security-check.sh, alert on any FAIL

Cron

Schedule via OpenClaw cron for standalone audits:

openclaw cron add --name "security-check" --schedule "0 8 * * *" --task "Run scripts/security-check.sh and report results"

Combining with healthcheck skill

This skill focuses on fast config + host audit (10 checks, <5 seconds).

The built-in healthcheck skill provides a full hardening workflow (risk profiling, remediation planning, guided execution).

Use this skill for quick checks; escalate to healthcheck for comprehensive hardening.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 04:56 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,704
developer-tools

Gateway Watchdog

guoqunabc
通过检测日志异常错误率监控OpenClaw网关健康状态。适用场景:(1) 设置网关错误监控,(2) 诊断API重复失败...
★ 0 📥 1,411
security-compliance

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 89 📥 30,594