Independent Field Manual — Not affiliated with, endorsed by, or operated by OpenClaw
Navigation

security

Understanding OpenClaw Gateway Port 18789

Why OpenClaw uses port 18789, why you should never expose it publicly without authentication, and how to access your dashboard safely using SSH tunnels or Tailscale.

Read in Hinglish
Difficulty
intermediate
Duration
15 minutes
Tested On
Ubuntu 24.04 LTS with OpenClaw Gateway
Access Mode
Localhost only
Pre-flight status
Pre-Flight Approved
Risk high
Gateway Private
On this page
High-risk guide Covers a critical security topic. Exposing port 18789 publicly gives the internet full access to your Gateway. This guide explains how to keep it private.

Short answer

OpenClaw Gateway listens on port 18789 by default. This port serves the dashboard, the API, and the channel coordination layer. By default, it binds to 127.0.0.1 (localhost only), which means only processes on the same server can reach it.

Never open this port in your firewall. Use an SSH tunnel or Tailscale to access the dashboard from your laptop.

Who this is for

  • You just installed OpenClaw and want to access the web dashboard.
  • You are getting ERR_CONNECTION_REFUSED when trying to open the dashboard.
  • You found a tutorial that suggests running ufw allow 18789 — and you want to understand why that is dangerous.
  • You need persistent dashboard access without exposing your server.

Prerequisites

What port 18789 exposes

The Gateway is not a simple web page. When you expose port 18789, you expose:

What is accessibleRisk
Dashboard UIAnyone can view your conversations, config, and logs
Channel tokensTelegram bot tokens and WhatsApp sessions can be read
API key referencesModel provider keys may be visible in config views
Tool executionConnected tools (file access, shell, APIs) can be triggered
Agent controlAnyone can send messages that the agent will process

This is fundamentally different from exposing a normal website on port 80 or 443.

How to access the dashboard safely

An SSH tunnel forwards a port from your VPS to your local machine through an encrypted connection. No firewall changes needed.

On your laptop (not on the VPS), open a terminal and run:

bash
ssh -L 18789:localhost:18789 clawuser@your_server_ip

Replace 'clawuser' and 'your_server_ip' with your actual values. Keep this terminal open while using the dashboard.

Then open your browser and go to http://localhost:18789. The traffic is encrypted and completely private — the port is never exposed to the internet.

Windows users: If using PowerShell or WSL, the same command works. If using PuTTY, configure an SSH tunnel in Connection → SSH → Tunnels: source port 18789, destination localhost:18789.

If you need always-on dashboard access without running an SSH tunnel every time, install Tailscale on both your VPS and your laptop. Tailscale creates a secure private network between them.

  1. Install Tailscale and authenticate on both machines.
  2. Find your VPS’s Tailscale IP (e.g., 100.x.y.z).
  3. Start the Gateway bound to the Tailscale IP:
bash
openclaw start --host 100.x.y.z

The Tailscale IP is only reachable by machines on your private Tailscale network — not the public internet.

  1. Access the dashboard at http://100.x.y.z:18789 from your laptop.

See the full Tailscale setup guide for detailed instructions.

Method 3: Reverse proxy with TLS and auth (advanced users only)

For production deployments where multiple team members need access, you can use Nginx as a reverse proxy with TLS (HTTPS) and HTTP Basic Auth or OAuth. This is significantly more complex and is not recommended for beginners.

Check your current exposure

Run this command on your VPS to see how the Gateway is bound:

bash
sudo ss -tulpn | grep 18789

Good output (safe — Gateway is private):

tcp   LISTEN   0   511   127.0.0.1:18789   0.0.0.0:*   users:(("node",pid=1234,fd=18))

The key is 127.0.0.1:18789 — this means the Gateway only accepts connections from inside the server.

Bad output (exposed — take action immediately):

tcp   LISTEN   0   511   0.0.0.0:18789     0.0.0.0:*   users:(("node",pid=1234,fd=18))

0.0.0.0:18789 means the Gateway is listening on all network interfaces, including the public internet.

If you accidentally exposed port 18789

Step 1: Stop the Gateway

bash
openclaw stop

Step 2: Remove the UFW rule

bash
sudo ufw delete allow 18789

If you did not add this rule, this command will return 'Could not delete non-existent rule'. That is fine — it means the rule was never added.

Step 3: Check your provider’s firewall

Most VPS providers (Hetzner, DigitalOcean, AWS, Hostinger) have a web-based firewall in addition to UFW. Log into your provider’s control panel and verify that no external allow rule for port 18789 exists in their firewall settings.

Step 4: Rotate credentials

If the Gateway was exposed for any period of time, rotate:

  • All AI model API keys (Anthropic, OpenAI, etc.)
  • Telegram bot tokens (revoke via BotFather, create new ones)
  • WhatsApp sessions (re-pair with a new QR code)
  • Any other tokens or secrets in your .env file

Step 5: Restart safely

Restart the Gateway bound to localhost:

bash
openclaw start

By default, this binds to 127.0.0.1:18789. Verify with `sudo ss -tulpn | grep 18789`.

Provider-specific firewall notes

ProviderWhere to checkNotes
DigitalOceanNetworking → FirewallsDroplet firewalls are separate from UFW. Check both.
HetznerFirewalls → your-firewallHetzner cloud firewalls override UFW. If port 18789 is allowed in Hetzner’s panel, UFW cannot block it from the outside.
AWS LightsailNetworking → IPv4 FirewallLightsail has its own firewall UI. UFW runs inside the instance.
HostingerVPS → Manage → FirewallHostinger’s panel firewall is independent of UFW.

What not to do

  • Do not bind to 0.0.0.0 unless you have TLS, auth, and reverse proxy hardening in place.
  • Do not run sudo ufw allow 18789 as a fix for “dashboard not opening.” The fix is an SSH tunnel.
  • Do not disable UFW to troubleshoot Gateway access.
  • Do not share screenshots of your dashboard or ss output without redacting IPs and PIDs.
  • Do not assume your provider’s firewall protects you — always verify with ss on the server itself.

Prevention checklist

  • Gateway is bound to 127.0.0.1 (verify with sudo ss -tulpn | grep 18789)
  • UFW does not have a rule for port 18789 (verify with sudo ufw status numbered)
  • Provider’s web-panel firewall does not allow 18789
  • Dashboard access is via SSH tunnel or Tailscale only
  • .env file has chmod 600 permissions
  • API keys and tokens are not committed to Git

When to ask for help

If you suspect your Gateway has been exposed, or if you are unsure whether your setup is safe, request a Config Review. We can check your network exposure, firewall rules, and access patterns using only redacted logs — we will never ask for your raw API keys, bot tokens, or passwords.

Sources

ClawReady.in is an independent educational resource and setup service. It is not affiliated with, endorsed by, or operated by OpenClaw.