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

security

OpenClaw VPS Security Checklist

The mandatory security hardening checklist for your Ubuntu VPS before you connect OpenClaw to the internet. Covers SSH keys, UFW, non-root users, and secret management.

Read in Hinglish
Difficulty
advanced
Duration
30 minutes
Tested On
Ubuntu 24.04 LTS
Access Mode
SSH
Pre-flight status
Pre-Flight Approved
Risk high
Gateway Private
On this page
High-risk guide Do not skip this checklist. Running an AI agent with tool access on an unsecured server will lead to compromise.

Why this checklist is mandatory

When you install OpenClaw, you are deploying an agent that can read files, execute code, and spend your API credits. It connects to external messaging channels. If a bot or automated scanner compromises your VPS, they don’t just get an empty server — they get access to your AI infrastructure, your bot tokens, and your billing accounts.

This checklist covers the absolute minimum hardening required for an internet-facing OpenClaw server.


Phase 1: Access Control

1. Disable Root Login

You should never log in as root. You should log in as a standard user with sudo privileges.

  • Open /etc/ssh/sshd_config
  • Set PermitRootLogin no
  • Restart SSH: sudo systemctl restart ssh

2. Disable Password Authentication

Passwords can be brute-forced. SSH keys cannot.

  • Ensure your SSH public key is in ~/.ssh/authorized_keys for your non-root user.
  • Open /etc/ssh/sshd_config
  • Set PasswordAuthentication no
  • Restart SSH: sudo systemctl restart ssh

Phase 2: Firewall (UFW)

Your server must drop all incoming traffic by default, except for SSH.

3. Configure UFW Rules

Check current status:

bash
sudo ufw status

If it is inactive, set the default policies and allow SSH:

bash
sudo ufw default deny incoming && sudo ufw default allow outgoing
bash
sudo ufw allow OpenSSH

Or 'sudo ufw allow 22/tcp' depending on your config.

Enable the firewall:

bash
sudo ufw enable

4. Verify Gateway Binding

Even with a firewall, defense-in-depth requires that the Gateway process itself does not listen on the public network interface.

Run:

bash
sudo ss -tulpn | grep 18789

Ensure the output shows 127.0.0.1:18789 (or a Tailscale IP), and not 0.0.0.0:18789. If it says 0.0.0.0, open your .env file, set OPENCLAW_HOST=127.0.0.1, and restart the Gateway.


Phase 3: Secret Management

5. Protect the .env File

Your .env file contains your AI model API keys and channel tokens. It must be locked down.

Navigate to your workspace and restrict permissions:

bash
chmod 600 .env

This ensures only the owner of the file can read or write to it. Group and global permissions are removed.

6. Do Not Commit Secrets

If you use Git to backup or version your workspace, ensure .env is in your .gitignore file. If you accidentally commit an API key to a public GitHub repo, it will be scraped and used within seconds.


Phase 4: System Hygiene

Fail2Ban automatically blocks IP addresses that fail SSH logins too many times.

bash
sudo apt install fail2ban -y
bash
sudo systemctl enable --now fail2ban

8. Enable Unattended Upgrades

Keep your Ubuntu server patched automatically for security updates.

bash
sudo apt install unattended-upgrades -y
bash
sudo dpkg-reconfigure --priority=low unattended-upgrades

Phase 5: OpenClaw Specifics

9. Configure Channel Allowlists

Do not leave your Telegram or WhatsApp bots open to the public unless that is explicitly your product. Configure TELEGRAM_ALLOWLIST in your .env file using your numeric User ID.

10. Audit Tool Permissions

If your agent does not need to execute shell commands, do not enable the shell execution tool. If it does not need to write files, restrict it to read-only. Grant the principle of least privilege.


Monthly Maintenance Checklist

Set a calendar reminder to do this once a month:

  • SSH into the server and run sudo apt update && sudo apt upgrade -y
  • Check Gateway logs for unusual activity (pm2 logs openclaw)
  • Reboot the server (sudo reboot) to ensure PM2 and the Gateway recover automatically.
  • Check billing limits on your Anthropic/OpenAI accounts to ensure no unexpected spikes.

What not to do

  • Do not use chmod 777 on your workspace folder to fix “permission denied” errors. Use chown to fix the owner instead.
  • Do not post unredacted logs. If you ask for help, replace IPs and tokens with XXX.
  • Do not share your root password with anyone offering to “fix it for you.”

When to ask for help

If you are unsure whether your firewall is configured correctly, or if you suspect your server has been compromised, ask for a Security Audit via the Setup Help service. We can review redacted ss and ufw outputs to verify your posture.

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