How to Secure Your OpenClaw Deployment
Learn how to secure your OpenClaw deployment with authentication, access controls, sandboxing, and monitoring. Protect your AI agents from prompt injection and unauthorized access.
OpenClaw agents can execute shell commands, read files, and access network services. This guide covers essential security configurations to protect your deployment from unauthorized access and prompt injection attacks.
Step 1: Run a Security Audit
Start by running OpenClaw's built-in security audit to identify vulnerabilities:
# Standard audit
openclaw security audit
# Deep audit with live probing
openclaw security audit --deep
# Auto-fix common issues
openclaw security audit --fixStep 2: Configure Gateway Authentication
Always require authentication for gateway access. Generate a strong random token:
{
"gateway": {
"mode": "local",
"bind": "loopback",
"port": 18789,
"auth": {
"mode": "token",
"token": "your-long-random-token-here"
}
}
}Step 3: Lock Down Channel Access
Use 'pairing' or 'allowlist' mode for DM access. Never use 'open' unless building a public bot:
{
"channels": {
"whatsapp": {
"dmPolicy": "pairing",
"groups": {
"*": { "requireMention": true }
}
},
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["123456789", "987654321"]
}
}
}Step 4: Enable Sandboxing
Run agent code in Docker containers to isolate from your host system:
{
"agents": {
"defaults": {
"sandbox": {
"mode": "all",
"scope": "agent",
"workspaceAccess": "ro"
}
}
}
}Sandbox scope options:
agent
Each agent gets its own container. Recommended for most deployments.
session
Each conversation session gets a fresh container. Maximum isolation.
shared
Single container for all agents. Use only for trusted environments.
Step 5: Restrict Tools
Limit which tools your agents can use. Disable dangerous tools for untrusted inputs:
{
"tools": {
"deny": [
"web_search",
"web_fetch",
"browser"
],
"elevated": {
"allowFrom": []
}
}
}Step 6: Enable Logging Redaction
Prevent sensitive data from appearing in logs:
{
"logging": {
"redactSensitive": "tools",
"redactPatterns": [
"Bearer [a-zA-Z0-9-._]+",
"sk-[a-zA-Z0-9]+",
"password=\\S+"
]
}
}Step 7: Choose Secure Models
Larger, newer models are more resistant to prompt injection. Anthropic Claude Opus 4.5 is recommended for tool-enabled bots.
Complete Secure Configuration
{
"gateway": {
"mode": "local",
"bind": "loopback",
"port": 18789,
"auth": {
"mode": "token",
"token": "your-secure-token"
}
},
"channels": {
"whatsapp": {
"dmPolicy": "pairing",
"groups": { "*": { "requireMention": true } }
},
"telegram": {
"dmPolicy": "pairing",
"groups": { "*": { "requireMention": true } }
}
},
"agents": {
"defaults": {
"sandbox": { "mode": "all", "scope": "agent" },
"model": { "primary": "anthropic/claude-opus-4-5" }
}
},
"tools": {
"deny": ["browser"],
"elevated": { "allowFrom": [] }
},
"logging": {
"redactSensitive": "tools"
}
}Enterprise security, zero configuration
clawd.new deploys OpenClaw with VPC isolation, automatic security updates, and enterprise-grade protection.
Deploy Securely →