Security Configuration
Protect your OpenClaw deployment with proper security settings.
Hosted Networking Split
For hosted OpenClaw VPS, security now follows a fixed network split:
- Public web chat uses Cloudflare
- Private web chat uses the customer’s own Tailscale tailnet
- Telegram stays public-only
- OpenClaw operator access uses OpenClaw’s separate internal tailnet and is not shared with customer bots
That means customer bot traffic never reuses the OpenClaw ops tailnet.
Authentication
Web API Key
Protect web access with an API key:
WEB_API_KEY=your-secret-key-hereGenerate a secure key:
openssl rand -base64 32Cloudflare Access
For Cloudflare deployments, use Cloudflare Access for zero-trust authentication.
Rate Limiting
Prevent abuse with rate limiting:
RATE_LIMIT_ENABLED=true
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=60000 # 1 minutePer-User Limits
RATE_LIMIT_PER_USER=50
RATE_LIMIT_PER_IP=200Network Security
HTTPS
Always use HTTPS in production:
FORCE_HTTPS=trueCORS
Configure allowed origins:
CORS_ORIGINS=https://your-domain.com,https://app.your-domain.comTrusted Proxies
If behind a reverse proxy:
TRUSTED_PROXIES=true
TRUSTED_PROXY_IPS=10.0.0.0/8,172.16.0.0/12API Key Security
Never commit API keys to version control. Use environment variables or secret management.
Best Practices
- Use separate keys for development and production
- Rotate keys periodically
- Set up key expiration alerts
- Monitor usage for anomalies
Key Rotation
To rotate your provider API key:
- Generate a new key in your provider console
- Update your environment variable
- Restart OpenClaw
- Revoke the old key
Logging
Security Logging
Enable detailed security logs:
LOG_SECURITY_EVENTS=true
LOG_LEVEL=infoLogged events:
- Authentication attempts
- Rate limit violations
- Unusual access patterns
- Error conditions
Audit Trail
For compliance, enable audit logging:
ENABLE_AUDIT_LOG=true
AUDIT_LOG_PATH=/var/log/openclaw/audit.logFirewall Rules
VPS Deployment
Recommended iptables rules:
# Allow SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Allow HTTPS
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Block everything else
iptables -A INPUT -j DROPCloudflare Tunnel
No firewall rules needed - all traffic goes through Cloudflare.
Tailscale For Hosted Bots
If you enable private networking on a hosted bot:
- the bot joins the customer-owned tailnet
- the bot receives a one-off join key minted from the customer OAuth client
- the bot runtime does not store the customer OAuth secret
- private web chat stays on the tailnet instead of being published on the public internet
Security Checklist
- API keys stored securely (not in code)
- HTTPS enabled
- Rate limiting configured
- Authentication enabled for web UI
- Logs monitored
- Regular key rotation scheduled
- Firewall rules in place (VPS)