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

security

Performing an OpenClaw Security Audit

A comprehensive checklist and workflow for conducting a security audit of your OpenClaw setup, including using openclaw doctor and manual server checks.

Difficulty
advanced
Duration
25-40 minutes
Tested On
Ubuntu 22.04 LTS
Access Mode
Private access
Pre-flight status
Pre-Flight Approved
Risk high
Gateway Private
On this page

Auditing your OpenClaw setup ensures that there are no unsafe defaults lingering on your VPS. This guide combines the automated openclaw doctor checks with manual network verification to give you a complete picture of your security posture.

1. Automated Health Check

OpenClaw ships with a built-in diagnostic tool. SSH into your VPS and navigate to the directory where your OpenClaw .env file lives.

bash
openclaw doctor
[OK] Environment variables loaded
[OK] Node.js version is supported (v20+)
[WARN] Gateway listening on 0.0.0.0
[OK] Telegram DM policy set to 'strict'

How to read the output:

  • [OK]: The configuration is safe and expected.
  • [WARN]: The configuration is potentially unsafe depending on context (e.g. 0.0.0.0 might be okay if placed behind a strictly configured Reverse Proxy, but highly unsafe if port 18789 is open).
  • [FAIL]: Critical misconfiguration that must be fixed immediately.

2. Manual Network Exposure Check

The most critical part of the audit is verifying your network exposure. openclaw doctor only checks application configuration, not your VPS firewall.

Run this command to check what ports are actively listening to the public internet:

bash
sudo ss -tlnp

Look for the OpenClaw Gateway port (usually 18789).

Unsafe Output: If the Local Address is *:18789 or 0.0.0.0:18789, the Gateway is exposed to the entire internet!

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

Safe Output (Tailscale/Localhost): If the Local Address is your Tailscale IP (100.x.x.x) or Localhost (127.0.0.1), the Gateway is protected.

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

3. Firewall (UFW) Verification

If you are using Ubuntu, check your Uncomplicated Firewall (UFW) status to ensure the port isn’t explicitly opened.

bash
sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

If you see 18789/tcp ALLOW Anywhere, run sudo ufw delete allow 18789/tcp immediately.

4. Token & Secrets Audit

Review your .env file manually. Look for the following issues:

  1. Hardcoded API Keys in code: Ensure all LLM provider keys (OpenAI, Anthropic) and messaging tokens (Telegram, WhatsApp) are ONLY located in .env, not hardcoded in custom scripts or agents.
  2. File permissions: Your .env file should not be readable by other users on the server.

Enforce strict permissions on your .env:

bash
chmod 600 .env

This ensures only the owner (the user running OpenClaw) can read or write to the file.

5. Channel Security (Telegram/WhatsApp)

If you are using Telegram, verify your dmPolicy in your .env.

bash
grep DM_POLICY .env

It should be set to strict or allowlist. If it is missing or set to public, anyone who finds your bot on Telegram can talk to your OpenClaw instance and execute tools!

For WhatsApp, ensure you are using a dedicated number (not your personal phone number) to prevent personal messages from being ingested by the AI.

Remediation

If any part of this audit failed, stop your Gateway immediately (pm2 stop openclaw-gateway), apply the fixes, and run the audit again before bringing the system back online.

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