OpenClaw is powerful. It can read files, execute commands, commit code, and interact with external services. That power means security isn't optional — it's the foundation everything else sits on.

This guide covers the security decisions that matter for production use. Not theoretical threat models. Practical choices that reduce your risk surface without making OpenClaw useless.

Start with Your Risk Profile

Before configuring anything, decide what kind of risk you're willing to accept. There's no universal "secure" setting. Security is always a trade-off against capability.

We classify client setups into three risk profiles:

Profile Who It's For What It Means
Conservative Regulated industries, client-facing systems Read-only repo access, no shell commands, all actions logged and reviewed
Balanced Internal tools, team workflows Read/write repo access, scoped shell commands, automated logging
Operator Solo founders, dev tooling, personal automation Full access with safety nets, fewer approval gates

Pick the profile that matches your actual situation. Then configure OpenClaw to enforce it. Don't start with "Operator" because it's easier and plan to tighten things later. Later never comes.

Access Boundaries: What Can OpenClaw Touch?

Repository Access

Grant OpenClaw access only to the repositories it needs for its current workflows. Use a dedicated machine user or bot account with scoped permissions — never your personal GitHub token.

  • Conservative: Read-only access to specific repos. No fork or branch creation.
  • Balanced: Read/write to designated repos. Branch creation allowed, but no force-push. PR creation allowed, but not merge.
  • Operator: Full access to designated repos. Merge and deploy permissions available through explicit approval commands.

Rule of thumb: If you wouldn't give a new team member this level of access on their first day, don't give it to OpenClaw either.

Tool and Command Permissions

OpenClaw's power comes from its ability to use tools: shell commands, file operations, API calls. Each of these should be explicitly allowed or denied.

# Example: Allow file reads, block shell commands except specific ones
openclaw config set tools.file.read allow
openclaw config set tools.file.write allow
openclaw config set tools.shell.default deny
openclaw config set tools.shell.allow "git,npm,node"

The default-deny approach for shell commands is the single most important security decision you'll make. It means OpenClaw can only run commands you've explicitly approved. Everything else gets blocked and logged.

Channel Access Controls

Not everyone who can message your Telegram or Discord channel should be able to instruct OpenClaw. Set up sender allowlists:

  • Restrict command access to specific user IDs or roles
  • Separate "can view responses" from "can issue commands"
  • Log every command with the sender's identity, not just the command text

Monitoring: Know What's Happening

Security without monitoring is just hope. You need three things running from day one:

1. Action Logging

Every tool invocation, file access, and external API call should be logged with a timestamp, the requesting user, and the result. OpenClaw's built-in logging covers this — but you need to make sure it's actually enabled and writing to persistent storage.

openclaw config set logging.level verbose
openclaw config set logging.output file
openclaw config set logging.path ~/openclaw/logs/

2. Anomaly Alerts

Set up basic alerts for unusual activity:

  • Commands from unrecognized user IDs
  • Access to repos or files outside the normal working set
  • Unusually high command volume (could indicate a loop or misuse)
  • Failed authentication attempts

You don't need a SIEM platform for this. A cron job that greps the log for unexpected patterns and sends you a Telegram message is enough to start.

3. Session Recording

For regulated environments, record full session transcripts. This gives you a complete audit trail of what OpenClaw was asked to do, what it actually did, and what the outcome was.

Rollback: Your Safety Net

Every action OpenClaw takes should be reversible. Here's how to make that practical:

  • Git branches, not direct commits. Configure OpenClaw to work on feature branches, never on main or production. Every change can be reviewed before merge.
  • Snapshot before modify. For non-Git files (configs, environment settings), take a timestamped backup before any modification.
  • Kill switch. Set up a way to immediately suspend OpenClaw's active sessions. A single command or message that halts all operations. Test this before you need it.

The kill switch test: Run openclaw emergency-stop right now. If it works, great. If you've never tested it, it's not a safety net — it's a decoration.

Remote and Gateway Deployments

Running OpenClaw on a remote server or VPS adds another layer of security decisions:

  • SSH access: Use key-based authentication only. Disable password auth. Restrict SSH to specific IP ranges if possible.
  • Network isolation: Run OpenClaw in a dedicated user account with limited system permissions. Don't run it as root. Ever.
  • Firewall rules: Only open the ports OpenClaw actually needs. Outbound HTTPS (443) for API calls and inbound webhook ports for channel integrations. Nothing else.
  • TLS everywhere: If you're running an API gateway in front of OpenClaw, terminate TLS at the gateway. No unencrypted internal traffic.

The Production Security Checklist

  • Risk profile chosen and documented (Conservative / Balanced / Operator)
  • Dedicated bot account created with scoped repo permissions
  • Tool permissions configured with default-deny for shell commands
  • Channel sender allowlist configured
  • Action logging enabled and writing to persistent storage
  • Anomaly alerts set up for unusual activity
  • All changes routed through feature branches, not main
  • Kill switch tested and working
  • Config and .env backed up to a separate, secure location
  • Remote access hardened (SSH keys, firewall, non-root user)

Production security isn't a one-time setup. Review your access logs weekly. Update your allowlists when workflows change. Test your kill switch monthly. The goal isn't to prevent every possible attack — it's to make sure you know what's happening and can respond fast when something looks wrong.