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 HinglishOn this page
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_REFUSEDwhen 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
- A running OpenClaw Gateway instance (see Install OpenClaw on Ubuntu VPS)
- SSH access to your server
- Basic familiarity with terminal commands
What port 18789 exposes
The Gateway is not a simple web page. When you expose port 18789, you expose:
| What is accessible | Risk |
|---|---|
| Dashboard UI | Anyone can view your conversations, config, and logs |
| Channel tokens | Telegram bot tokens and WhatsApp sessions can be read |
| API key references | Model provider keys may be visible in config views |
| Tool execution | Connected tools (file access, shell, APIs) can be triggered |
| Agent control | Anyone can send messages that the agent will process |
This is fundamentally different from exposing a normal website on port 80 or 443.
The following commands are the most common way beginners accidentally expose their setup. Do not run them unless you have TLS, authentication, and reverse proxy hardening in place.
# DO NOT run this — exposes Gateway to the entire internet
openclaw start --host 0.0.0.0
# DO NOT run this — opens port to public internet scanners
sudo ufw allow 18789 How to access the dashboard safely
Method 1: SSH tunnel (recommended for quick checks)
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:
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.
Method 2: Tailscale / private VPN (recommended for persistent access)
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.
- Install Tailscale and authenticate on both machines.
- Find your VPS’s Tailscale IP (e.g.,
100.x.y.z). - Start the Gateway bound to the Tailscale IP:
openclaw start --host 100.x.y.z The Tailscale IP is only reachable by machines on your private Tailscale network — not the public internet.
- Access the dashboard at
http://100.x.y.z:18789from 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:
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
If your Gateway has been bound to 0.0.0.0, or if you ran ufw allow 18789, assume your session data, API keys, and channel tokens have been visible to the internet. Stop the Gateway, close the port, and rotate all credentials.
Step 1: Stop the Gateway
openclaw stop Step 2: Remove the UFW rule
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
.envfile
Step 5: Restart safely
Restart the Gateway bound to localhost:
openclaw start By default, this binds to 127.0.0.1:18789. Verify with `sudo ss -tulpn | grep 18789`.
Provider-specific firewall notes
| Provider | Where to check | Notes |
|---|---|---|
| DigitalOcean | Networking → Firewalls | Droplet firewalls are separate from UFW. Check both. |
| Hetzner | Firewalls → your-firewall | Hetzner cloud firewalls override UFW. If port 18789 is allowed in Hetzner’s panel, UFW cannot block it from the outside. |
| AWS Lightsail | Networking → IPv4 Firewall | Lightsail has its own firewall UI. UFW runs inside the instance. |
| Hostinger | VPS → Manage → Firewall | Hostinger’s panel firewall is independent of UFW. |
What not to do
- Do not bind to
0.0.0.0unless you have TLS, auth, and reverse proxy hardening in place. - Do not run
sudo ufw allow 18789as 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
ssoutput without redacting IPs and PIDs. - Do not assume your provider’s firewall protects you — always verify with
sson the server itself.
Prevention checklist
- Gateway is bound to
127.0.0.1(verify withsudo 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
-
.envfile haschmod 600permissions - 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.
Related guides
- OpenClaw VPS Security Checklist
- Fix: Dashboard Not Opening
- Fix: Gateway Not Running
- Tailscale Setup for OpenClaw
- Glossary: Port
- Glossary: SSH
Sources
- OpenClaw Docs — Security: https://docs.openclaw.ai/gateway/security (Checked on 2026-06-23)
- OpenClaw Docs — Remote Access: https://docs.openclaw.ai/gateway/remote (Checked on 2026-06-23)
- Tailscale Docs: https://tailscale.com/kb/ (Checked on 2026-06-23)
ClawReady.in is an independent educational resource and setup service. It is not affiliated with, endorsed by, or operated by OpenClaw.