Deploy OpenClaw with a firewall

Run your own OpenClaw behind the open-source ControlClaw firewall, on a VPS, with Docker Compose, Coolify, Dokploy, Linode, Hetzner, DigitalOcean, Oracle Cloud, Railway, Fly.io or Render.

The ControlClaw firewall is open source (AGPL-3.0) and runs on your own server, next to OpenClaw. Every request OpenClaw makes goes through it. In the firewall's panel you allow or block sites, write rules as sentences, approve risky actions, and keep passwords and API keys on the firewall, so the agent only holds a placeholder.

These guides set up a new OpenClaw and its firewall together. On a server or a Compose platform, the firewall is OpenClaw's only way to the internet: a shell command or a script that ignores the proxy gets nowhere. On Railway, Fly.io and Render it is OpenClaw's proxy only, as their guides explain.

Rather not run a server?

ControlClaw cloud runs each agent on its own machine behind your organization's firewall, and keeps them updated. See What is ControlClaw.

Pick a guide

WhereHow it installsGuide
Any Linux server with DockerOne Compose fileDocker Compose
CoolifyPaste the Compose file as a new resourceCoolify
DokployImport the templateDokploy
Akamai / Linodenpx controlclaw up --all on a new LinodeLinode
Hetzner CloudCloud-init script on a new serverHetzner
DigitalOceanUser data script on a new DropletDigitalOcean
Oracle CloudCloud-init script on an Always Free Arm instanceOracle Cloud
Railway (proxy only)Two services on a private networkRailway
Fly.io (proxy only)Two Fly apps on a private networkFly.io
Render (proxy only)Two web services on a private networkRender

Three kinds of setup

On a plain server (Linode, Hetzner, DigitalOcean, Oracle Cloud), the controlclaw command does the install. npx controlclaw up --all starts the firewall and OpenClaw as two Docker containers. OpenClaw's container is on a network whose only other member is the firewall. This is the strongest setup, and the panel can also manage OpenClaw: set its model keys and bots, and stop it.

On a Compose platform (plain Docker Compose, Coolify, Dokploy), one Compose file holds three services: the firewall, OpenClaw, and a small egress service. OpenClaw runs inside egress's network, where a packet filter drops everything except traffic to the firewall. OpenClaw can't change that filter, even as root in its container. This works on platforms that add their own networks to every service, which Coolify and Dokploy do.

On a platform that runs each service on its own (Railway, Fly.io, Render), the firewall is OpenClaw's proxy and nothing more. OpenClaw's own requests go through it and follow its rules, but a command that ignores the proxy goes straight out. Use it to see what OpenClaw does, not to stop it. The upside is that one firewall can serve several OpenClaw services, with one panel for all their traffic and rules.

A Compose or proxy setup has two limits compared with up --all:

  • The panel can't set OpenClaw's model or bots, or stop it. Model keys go in OpenClaw's own settings or its environment.
  • OpenClaw's requests show in the panel without an agent name, so rules and secrets that you give to one named agent don't apply to it. Rules for every agent do.

What you need

  • A server with 4 GB of RAM or more. The firewall uses about 200 MB; OpenClaw uses the rest.
  • An API key for OpenClaw's model, such as Anthropic, OpenAI or OpenRouter.
  • SSH access to the server. The panel and OpenClaw's Control UI listen on the server's loopback only, and you open them through an SSH tunnel. The Coolify, Dokploy, Railway, Fly.io and Render guides give them a domain instead.

After the install

  1. Open the panel's link and set the admin password straight away. Until then, anyone with the link's one-time setup token can set it.
  2. A new firewall allows every site and logs it. To allow only the sites you choose, open Internet access and set Every other site to Block. Model keys and bots you add in the panel get their own rule. A key you keep in OpenClaw needs its provider's host allowed, for example api.anthropic.com.
  3. Ask OpenClaw something that needs the web. The request shows in the panel's Activity.

How the firewall's rules work: The firewall. The source and the templates are on GitHub.

On this page