____ ____ _
/ ___| ___ ___ _ _ _ __ ___ / ___|| | __ ___ __
\___ \ / _ \/ __| | | | '__/ _ \ | | |/ _` \ \ /\ / /
___) | __/ (__| |_| | | | __/ |___ | | (_| |\ V V /
|____/ \___|\___|\__,_|_| \___|\_____||_|\__,_| \_/\_/
Developed by Granus Labs
Features β’ Quick Start β’ Security Tiers β’ Why Secure? β’ How It Works β’ Post-Install β’ Contributing
SecureClaw is an interactive hardened installer that deploys OpenClaw inside a hardened container (rootless by default) with 7 layers of defense-in-depth security.
It supports both Podman (rootless) and Docker (rootless or standard+hardened), giving you full control over your container runtime while maintaining maximum security.
Designed for VPS deployments where secure defaults matter, SecureClaw applies multiple protective boundaries to reduce risk and help protect your host system, API keys, and data.
curl -fsSL https://raw.githubusercontent.com/InverseAltruism/SecureClaw/main/install.sh | sudo bash- The installer can fetch OpenClaw automatically (users do not need to clone OpenClaw).
- Default flow is Quick Secure Install for non-technical users.
- Quick mode uses the Balanced tier by default (secure + full OpenClaw compatibility).
- Control UI access defaults to Strict pairing (secure by default).
- Use β/β + Enter for guided menus, or press the number key directly.
- Press Enter to accept recommended secure defaults.
- By default, SecureClaw installs the latest stable OpenClaw release tag.
- You can override with
--openclaw-ref <ref>to installmain, a specific tag, or a commit.
git clone https://github.com/InverseAltruism/SecureClaw.git
cd SecureClaw
sudo bash install.sh --advancedsudo secureclaw-uninstallIf /usr/local/bin/secureclaw-uninstall is unavailable, run sudo bash uninstall.sh from this repo.
The uninstaller removes SecureClaw-generated services, containers/images, install directories, paranoid-tier host artifacts, and (when it was created by SecureClaw) the dedicated system user plus namespace mappings. It can also purge runtime packages that were installed by SecureClaw.
sudo secureclaw-panicIf /usr/local/bin/secureclaw-panic is unavailable, run sudo bash panic.sh from this repo.
sudo secureclaw-update
# optional channel alignment with OpenClaw semantics:
sudo secureclaw-update --channel stable
sudo secureclaw-update --channel beta
sudo secureclaw-update --channel devIf /usr/local/bin/secureclaw-update is unavailable, run sudo bash update.sh from this repo.
Note: OpenClaw has a native
openclaw update --channel stable|beta|devflow for direct CLI installs. SecureClaw runs OpenClaw in a hardened container, so usesecureclaw-updatefor this deployment model.
sudo secureclaw-backupRestore on the same or another host:
sudo secureclaw-backup --restore /var/backups/secureclaw/secureclaw-backup-YYYYMMDD-HHMMSS.tar.gzIf /usr/local/bin/secureclaw-backup is unavailable, run sudo bash backup.sh from this repo.
Running OpenClaw (or any AI coding agent) without proper isolation is dangerous. Here's what can go wrong:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β INSECURE DEPLOYMENT β
β β
β βββββββββββββ Full Access ββββββββββββββββββββββββ β
β β OpenClaw β ββββββββββββββββββββ β Your Host System β β
β β (AI Agent)β β β’ Root filesystem β β
β β β No Limits β β’ All network β β
β β β ββββββββββββββββββββ β β’ SSH keys β β
β β β β β’ All API keys β β
β β β Unrestricted β β’ Other services β β
β β β ββββββββββββββββββββ β β’ Cloud metadata β β
β βββββββββββββ ββββββββββββββββββββββββ β
β β
β π Container escape = full host compromise β
β π Malicious code runs with your privileges β
β π API keys exposed in environment variables β
β π Network access to cloud metadata (169.254.x.x) β
β π Lateral movement to other services on your network β
β π No resource limits = denial of service β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
SECURECLAW DEPLOYMENT β
β β
β βββββββββββββ ββββββββββββββββββββββββ β
β β OpenClaw β βββ 7 Security βββββ β Protected Host β β
β β (Isolated)β Layers β β β
β β β β β
Read-only root β β
β β Rootless β βββ Egress βββββββββ β β
Egress firewall β β
β β Containerβ Firewall β β
Audit logging β β
β β β β β
No capabilities β β
β β No caps β βββ Resource βββββββ β β
Resource limits β β
β β No privs β Limits β β
User namespace β β
β βββββββββββββ ββββββββββββββββββββββββ β
β β
β π Container runs as unprivileged user (no root daemon*) β
β π Read-only filesystem prevents persistence β
β π Egress firewall blocks cloud metadata & lateral movement β
β π All capabilities dropped + no-new-privileges β
β π Resource limits prevent denial of service β
β π Audit monitoring catches suspicious behavior β
β β
β * Podman and Docker rootless mode β no root daemon at all β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Bottom line: Without SecureClaw, a single prompt injection or malicious code execution gives an attacker full access to your system, API keys, and network. With SecureClaw, even a complete container compromise is contained within multiple security boundaries.
| Feature | Description |
|---|---|
| π Rootless-First Runtime | Podman/Docker rootless supported; hardened fallback for standard Docker |
| π³ Runtime Choice | Choose Podman, Docker rootless, or Docker standard+hardened |
| π¦ Read-only Filesystem | Prevents persistence of malicious modifications |
| π« All Capabilities Dropped | cap-drop=ALL β minimal privileges |
| π‘οΈ No New Privileges | no-new-privileges β cannot escalate access |
| π Egress Firewall | nftables rules block cloud metadata & RFC1918 |
| π Audit Monitoring | auditd + cron network anomaly detection |
| ποΈ Agent Sandboxing | Per-agent isolation with double containerization |
| β‘ 4 Security Tiers | Standard β Balanced β Hardened (strict) β Paranoid |
| π Auto-generated Tokens | Cryptographically secure 256-bit gateway tokens |
| π Systemd Integration | Quadlet (Podman) or systemd service (Docker) auto-start |
| π₯οΈ System Detection | Auto-detects OS, architecture, RAM, CPU cores |
SecureClaw lets you choose your preferred container runtime during installation:
| Runtime | Security Level | Root Daemon? | Best For |
|---|---|---|---|
| Podman (rootless) | π’ Highest | No | Maximum security, VPS deployments |
| Docker (rootless) | π’ High | No | Docker familiarity + strong security |
| Docker (standard+hardened) | π‘ Good | Yes | Compatibility, existing Docker setups |
Root Daemon (Traditional Docker) Rootless (Podman / Docker Rootless)
βββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββ
βββββββββββ βββββββββββ
β docker β Talks to root daemon β podman/ β No daemon at all
β CLI β βββββββββββ β docker β βββ Direct process
βββββββββββ β βββββββββββ
βΌ
ββββββββββββββββββββ User Namespace
β dockerd (ROOT) β ββββββββββββββββββββ
β β β Container runs β
β Full host β β as UID 100000+ β
β access possible β β No host access β
ββββββββββββββββββββ ββββββββββββββββββββ
β Exploit in daemon = root on host β
Exploit = unprivileged user
β Docker socket = root shell β
No socket to exploit
Recommendation: Use Podman (rootless) for maximum security. Use Docker (rootless) if you prefer Docker's tooling. Only use Docker standard if rootless isn't an option on your system.
Choose your security posture during installation:
| Layer | Standard | Balanced (recommended) | Hardened (strict) | Paranoid |
|---|---|---|---|---|
| Container user isolation (rootless on supported runtimes) | β | β | β | β |
| Gateway token auth | β | β | β | β |
Host port binding to 127.0.0.1 |
β | β | β | β |
| Read-only root filesystem | β | β | β | β |
| All capabilities dropped | β | β | β | β |
| No new privileges | β | β | β | β |
| Resource limits (CPU/RAM/PIDs) | β | β | β | β |
Writable ~/.openclaw (channels/credentials/onboarding) |
β | β | β | β |
| Workspace-only file/tool restrictions | β | β | β | β |
| Network isolation | β | β | β | β |
| Host egress firewall (nftables) | β | β | β | β |
| Audit logging (auditd + cron) | β | β | β | β |
| Agent-level sandboxing | β | β | β | β |
π‘ Recommendation: Use Balanced for production by default (secure + full-feature OpenClaw). Use Hardened (strict) or Paranoid only when you explicitly accept feature restrictions.
- Standard: Full OpenClaw compatibility with baseline container isolation.
- Balanced (recommended): Full OpenClaw compatibility with strong container hardening.
- Hardened (strict): Restrictive profile; features needing writes outside workspace can be impacted (for example onboarding/channel credential flows).
- Paranoid: Highest lockdown; may impact browser/nodes/channels due firewall and sandbox/network constraints.
The installer will guide you through 10 interactive setup sections:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INSTALLATION WORKFLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π Section 1/10 System Information β
β ββ Auto-detected OS, RAM, CPUs β
β π³ Section 2/10 Container Runtime β
β ββ Podman / Docker rootless / Docker β
β π Section 3/10 Security Level β
β ββ Standard / Balanced / Hardened (strict) / Paranoid β
β π Section 4/10 Installation Directory β
β ββ Where to install OpenClaw β
β π€ Section 5/10 System User β
β ββ Dedicated service user β
β π Section 6/10 Gateway Port & Token β
β ββ Network port + auth token β
β π Section 7/10 Control UI Access Mode β
β ββ Strict pairing (default) / Compatibility mode β
β π Section 8/10 API Keys β
β ββ LLM provider keys (optional) β
β βοΈ Section 9/10 Systemd Auto-Start β
β ββ Boot persistence β
β πΎ Section 10/10 Resource Limits β
β ββ CPU/RAM/PID constraints β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π‘ Tip: Default choices are optimized for security. Use β/β + Enter in menu screens, or type the numeric choice directly.
| Requirement | Details |
|---|---|
| OS | Debian 12+ or Ubuntu 22.04+ |
| Privileges | Root or sudo access (only during installation) |
| Hardware | VPS with 2GB+ RAM, 2+ CPU cores recommended |
| Network | Internet access for package installation and LLM API calls |
| Runtime | Podman or Docker (installed automatically if not present) |
The installer implements 7 layers of defense-in-depth security:
π§ Layer 1: System User & Dependencies
- β Installs your chosen runtime (Podman or Docker) and required tools
- β
For Docker rootless: sets up
dockerd-rootless-setuptool.sh - β
Creates dedicated
openclawsystem user (no shell, no sudo) - β Configures subuid/subgid mappings for user namespace isolation
- β Enables systemd linger for rootless container persistence
π¦ Layer 2: Container Image
- β Uses local OpenClaw source or clones the requested upstream OpenClaw ref (default: latest stable release)
- β Builds OpenClaw container image using official Dockerfile
- β Builds image directly in the service user's rootless store
- β Ensures proper XDG_RUNTIME_DIR setup
π‘οΈ Layer 3: Container Hardening
Configures container with tier-appropriate security flags:
All tiers:
- π Rootless user namespace isolation
- π Localhost-only port binding
- π Init process (proper signal handling)
Balanced/Hardened (strict)/Paranoid:
- π Read-only root filesystem
- π tmpfs for writable directories
- π All capabilities dropped (
cap-drop=ALL) - π Memory/CPU/PID limits
- π Network isolation
π₯ Layer 4: Host Firewall (Paranoid only)
- β Installs and configures nftables egress filtering
- β Blocks cloud metadata endpoints (169.254.0.0/16)
- β Blocks RFC1918 private networks (lateral movement prevention)
- β Allows only DNS, HTTPS (443), and established connections
π Layer 5: Monitoring (Paranoid only)
- β Installs auditd and adds syscall monitoring rules
- β Watches all process execution from openclaw UID
- β Cron job checks for unauthorized network connections every minute
βοΈ Layer 6: Configuration
- β
Generates
.envfile with gateway token and API keys (mode 600) - β
Creates
openclaw.jsonwith tier-specific security settings - β Creates workspace directory structure with proper permissions
π Layer 7: Systemd & Launch
Podman:
- β Creates systemd Quadlet unit for auto-start
Docker rootless:
- β Creates user-level systemd service
Docker standard:
- β Creates system-level systemd service
All runtimes:
- β
Generates
launch-openclaw.shhelper script - β Starts the container and verifies successful launch
SecureClaw defends against common attack vectors:
| Attack Vector | Standard | Balanced | Hardened (strict) | Paranoid | Mitigation |
|---|---|---|---|---|---|
| Container escape | π‘ | π’ | π’ | π’π’ | Rootless user namespace + capability drop |
| API key theft | π‘ | π’ | π’π’ | π’π’ | Resource limits + mount policy + egress filtering |
| Lateral movement | π΄ | π‘ | π‘ | π’ | Network isolation + RFC1918 blocking |
| Cloud metadata access | π΄ | π΄ | π΄ | π’ | Nftables egress rules |
| Resource exhaustion | π΄ | π’ | π’ | π’ | CPU/memory/PID limits |
| Privilege escalation | π‘ | π’ | π’ | π’ | no-new-privileges + capability drop |
| Filesystem persistence | π΄ | π’ | π’ | π’ | Read-only root + tmpfs |
| Feature compatibility | π’π’ | π’π’ | π‘ | π΄ | Writable config vs strict workspace-only and network policies |
π’π’ = Strongest Β· π’ = Strong Β· π‘ = Moderate Β· π΄ = Weak
After installation, do these steps in order:
- Confirm the gateway port shown at the end of installation (default
18789, but it may auto-change if busy). - Create an SSH tunnel from your PC to the VPS.
- Open the dashboard in your local browser (
http://localhost:<port>). - Authenticate with your gateway token from
~/.openclaw/.envon the VPS. - If you selected Strict pairing and see pairing required (
1008), approve the pending device from the container:- Podman list:
sudo -u openclaw XDG_RUNTIME_DIR=/run/user/$(id -u openclaw) podman exec openclaw sh -lc 'if [ -f openclaw.mjs ]; then node openclaw.mjs devices list --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"; else node dist/index.js devices list --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"; fi' - Podman approve:
sudo -u openclaw XDG_RUNTIME_DIR=/run/user/$(id -u openclaw) podman exec openclaw sh -lc 'if [ -f openclaw.mjs ]; then node openclaw.mjs devices approve <device-id> --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"; else node dist/index.js devices approve <device-id> --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"; fi'
- Podman list:
- If you selected Compatibility mode, keep access tunnel-only (SSH/Tailscale), never public, and rotate gateway tokens regularly.
- If you skipped API keys during install, add them to
.envand restart OpenClaw.
SecureClaw binds to 127.0.0.1 only for security. For most VPS setups, this is the recommended way to access OpenClaw from your PC:
# From your local machine, create an SSH tunnel
ssh -L 18789:127.0.0.1:18789 user@your-vps-ip
# Then open in your browser
http://localhost:18789Replace
18789if your install summary showed a different gateway port.
π Important: Your gateway token is stored in
$INSTALL_DIR/.envwith mode600. Save it securely - you'll need it to authenticate.
Run one of these on your PC (not on the VPS) to create the SSH tunnel with guided prompts:
curl -fsSL https://raw.githubusercontent.com/InverseAltruism/SecureClaw/main/connect-openclaw-linux.sh -o connect-openclaw-linux.sh
bash connect-openclaw-linux.shcurl -fsSL https://raw.githubusercontent.com/InverseAltruism/SecureClaw/main/connect-openclaw-macos.sh -o connect-openclaw-macos.sh
bash connect-openclaw-macos.shiwr -UseBasicParsing https://raw.githubusercontent.com/InverseAltruism/SecureClaw/main/connect-openclaw-windows.ps1 -OutFile connect-openclaw-windows.ps1
powershell -ExecutionPolicy Bypass -File .\connect-openclaw-windows.ps1All helper variants will:
- Try to auto-detect the gateway port from
/etc/secureclaw-public.envon your VPS - Fall back to port
18789if detection is unavailable - Start the secure SSH tunnel and print the local dashboard URL
If you need to check current config paths later:
sudo ls -la /etc/secureclaw/install.env
sudo sed -n '1,20p' /etc/secureclaw/install.envPodman
# With systemd
sudo -u openclaw systemctl --user status openclaw
# Direct logs
sudo -u openclaw podman logs -f openclawDocker (rootless)
# With systemd
sudo -u openclaw systemctl --user status openclaw
# Direct logs
sudo -u openclaw DOCKER_HOST=unix:///run/user/$(id -u openclaw)/docker.sock docker logs -f openclawDocker (standard)
# With systemd
systemctl status openclaw
# Direct logs
docker logs -f openclawPodman / Docker (rootless)
sudo -u openclaw systemctl --user stop openclaw
sudo -u openclaw systemctl --user start openclawDocker (standard)
systemctl stop openclaw
systemctl start openclaw# View blocked network attempts
sudo journalctl -t openclaw-alert -f
# View nftables logs
sudo journalctl -k | grep openclaw-blocked
# Audit logs
sudo ausearch -k openclaw_execSecureClaw generates two configuration files:
Location: $INSTALL_DIR/.env
OPENCLAW_GATEWAY_TOKEN=your-256-bit-hex-token
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
# ... other API keysSecurity: Mode 600, owned by openclaw user. Never commit to version control.
Location: $INSTALL_DIR/openclaw.json
Configures OpenClaw behavior based on security tier:
- Gateway settings: Port, bind mode (loopback/lan), token authentication
- Tool restrictions: Workspace-only file access, disabled elevated tools (hardened+)
- Sandbox settings: Per-agent containerization, resource limits (paranoid)
Tip: You can manually edit this file and restart the container to adjust settings.
After installation:
- π IP-restrict your API keys at provider dashboards (OpenAI, Anthropic, etc.)
- π° Set spending limits on all LLM API accounts
- π Use dedicated API keys β Don't reuse keys from other projects
- π Monitor usage via provider dashboards for anomalies
- π Keep OpenClaw updated β Watch the OpenClaw repo for security patches
- π Review logs regularly (especially on paranoid tier)
- π Use SSH tunnels β Never expose the gateway port to the internet
We welcome contributions! See CONTRIBUTING.md for guidelines.
Areas for improvement:
- Additional Linux distro support (Fedora, Arch, Alpine)
- SELinux policy integration
- Automated security testing
- Documentation improvements
- Docker Compose support
MIT License β see LICENSE file for details.
Copyright Β© 2025 SecureClaw Contributors
- OpenClaw β The AI coding agent we're securing
- Granus Labs β Development and maintenance of SecureClaw
- Built with π‘οΈ by security-conscious developers who believe in defense-in-depth
"Security is a journey, not a destination."