Security Hardening Walkthrough
Step-by-step production hardening for OpenClaw
Step-by-step production hardening for OpenClaw
This walkthrough turns the Security Hardening Checklist into a concrete sequence: you perform each step in order and end with a harder, production-style setup. Plan for about 25–35 minutes. The checklist remains the source of truth; this page is the “do this, then this” version.
~/.clawdbot/moltbot.json; see ConfigurationEnsure the Gateway never runs with no auth when reachable from the network.
gateway.auth (or equivalent). Set gateway.auth.mode to "token" (or your chosen mode)—never "none" if the Gateway is exposed.127.0.0.1 (or a private IP) so the Gateway isn’t directly reachable from the internet. Use a reverse proxy (Caddy, nginx) with TLS for public access.Reference: Hardening checklist — Gateway & Auth.
Control who can message your assistant.
dmPolicy: "pairing" (default) so unknown users get a pairing code and you approve explicitly.allowFrom to restrict which users or channels can send messages. Avoid "*" unless you understand the risk.dmPolicy: "open" if you have strong sandboxing and isolation (e.g. dedicated VM, restricted tools).Reference: Hardening checklist — DM Policy & Allowlists.
For group chats or untrusted channels, run agent tools in a sandbox so bash and tools run inside Docker instead of on the host.
sandbox.mode: "non-main" for the sessions/channels you want sandboxed.Reference: Hardening checklist — Sandboxing.
Keep API keys and secrets out of plaintext config.
openclaw secrets or SecretRef for provider API keys and other secrets. See Secrets.Reference: Hardening checklist — Credentials & API Keys.
Let OpenClaw check your setup for common issues.
openclaw security audit --deep
Fix any reported issues. Use --fix for auto-fixable items (e.g. gateway.http.no_auth). Re-run after config changes.
If you run OpenClaw in Docker:
--read-only and --cap-drop=ALL where possible. Example:docker run --read-only --cap-drop=ALL \
-v openclaw-data:/app/data \
openclaw/openclaw:latest
Reference: Hardening checklist — Docker; Docker deployment.
Security guide — Overview and SHIELD. SHIELD framework. Security Hardening Checklist — Full checklist. Configuration — Config reference.