VPS Security Hardening for OpenClaw
Production-ready security hardening for AI agent deployments on VPS.
⚠️ CRITICAL WARNINGS
DO NOT run OpenClaw on servers/machines with sensitive personal data. Use a dedicated machine (VPS, bare-metal, or on-premise server dedicated to OpenClaw).
Supported OS: Ubuntu 20.04+, Debian 11+. Not for Windows (use WSL2) or macOS.
⚠️ Choose Your SSH Port First
You must choose a custom SSH port (1024-65535) before installing. This makes you conscious of the security decision.
# Choose your port (example: 4848)
export SSH_PORT=4848
# Install
cd ~/.openclaw/skills/vps-openclaw-security-hardening
sudo ./scripts/install.sh
# Verify
./scripts/verify.sh
# Test SSH (new terminal)
ssh -p ${SSH_PORT} root@your-vps-ip
What It Does
| Layer |
Protection |
Implementation |
| Network |
Firewall, SSH hardening |
UFW, custom port (your choice), key-only |
| System |
Auto-updates, monitoring |
unattended-upgrades, auditd |
| Secrets |
Credential management |
Centralized .env, 600 permissions |
| Monitoring |
Audit logging, alerting |
Kernel-level audit, multi-channel alerts |
Requirements
- OS: Ubuntu 20.04+ or Debian 11+ (Linux only)
- NOT supported: Windows (use WSL2), macOS
- Root access
- Existing SSH key authentication
- Alert channel (optional): Telegram, Discord, Slack, Email, or Webhook
- Custom SSH port of your choice (1024-65535)
Security Changes
SSH
- Port: 22 → ${SSH_PORT} (your choice, 1024-65535)
- Auth: Keys only (no passwords)
- Root login: Disabled
- Max retries: 3
- Fail2ban: Brute-force protection
Firewall
- Default: Deny incoming
- Allow: Your chosen SSH port only
Services
- CUPS (printing): Stopped & disabled
- Fail2ban: Intrusion detection enabled
- Auto-updates: Security patches automatic
Monitoring
- Credential file access tracking
- SSH config change detection
- Privilege escalation alerts
- Daily security briefing
Resource Usage
| Component |
RAM |
Disk |
| Auditd |
~2 MB |
40 MB max |
| UFW |
~1 MB |
Negligible |
| Scripts |
~5 MB |
Negligible |
| Total |
<10 MB |
<50 MB |
Files
scripts/install.sh - Main installation
scripts/verify.sh - Verify installation
scripts/rollback-ssh.sh - Emergency rollback
scripts/critical-alert.sh - Telegram alerts
scripts/daily-briefing.sh - Daily reports
rules/audit.rules - Audit configuration
Documentation
See README.md for full documentation.
License
MIT - See LICENSE file
1---
2name: vps-openclaw-security-hardening
3description: Production-ready security hardening for VPS running OpenClaw AI agents. Includes SSH hardening (custom port), firewall, audit logging, credential management, and intelligent alerting. Follows BSI IT-Grundschutz and NIST guidelines with minimal resource overhead.
4version: 1.0.6
5author: OpenClaw Community
6homepage: https://github.com/MarcusGraetsch/vps-openclaw-security-hardening
7metadata:
8 source: https://skillmd.com/skills/modbender/vps-openclaw-security-hardening
9 openclaw:
10 emoji: 🛡️
11 requires:
12 bins: ["ssh", "ufw", "auditd", "systemctl", "apt-get"]
13 optional: ["fail2ban"]
14 os: ["ubuntu", "debian"]
15 tags: ["security", "hardening", "vps", "audit", "monitoring", "firewall", "ssh", "fail2ban"]
16 install: "SSH_PORT=4848 ./scripts/install.sh"
17 verify: "./scripts/verify.sh"
18 warning: "DO NOT use on machines with sensitive personal data. Use dedicated VPS only. Test in VM first."
19---
20
21# VPS Security Hardening for OpenClaw
22
23Production-ready security hardening for AI agent deployments on VPS.
24
25## ⚠️ CRITICAL WARNINGS
26
27**DO NOT run OpenClaw on servers/machines with sensitive personal data.** Use a dedicated machine (VPS, bare-metal, or on-premise server dedicated to OpenClaw).
28
29**Supported OS:** Ubuntu 20.04+, Debian 11+. Not for Windows (use WSL2) or macOS.
30
31## ⚠️ Choose Your SSH Port First
32
33**You must choose a custom SSH port (1024-65535) before installing.** This makes you conscious of the security decision.
34
35```bash
36# Choose your port (example: 4848)
37export SSH_PORT=4848
38
39# Install
40cd ~/.openclaw/skills/vps-openclaw-security-hardening
41sudo ./scripts/install.sh
42
43# Verify
44./scripts/verify.sh
45
46# Test SSH (new terminal)
47ssh -p ${SSH_PORT} root@your-vps-ip
48```
49
50## What It Does
51
52| Layer | Protection | Implementation |
53|-------|------------|----------------|
54| **Network** | Firewall, SSH hardening | UFW, custom port (your choice), key-only |
55| **System** | Auto-updates, monitoring | unattended-upgrades, auditd |
56| **Secrets** | Credential management | Centralized .env, 600 permissions |
57| **Monitoring** | Audit logging, alerting | Kernel-level audit, multi-channel alerts |
58
59## Requirements
60
61- **OS:** Ubuntu 20.04+ or Debian 11+ (Linux only)
62- **NOT supported:** Windows (use WSL2), macOS
63- Root access
64- Existing SSH key authentication
65- Alert channel (optional): Telegram, Discord, Slack, Email, or Webhook
66- **Custom SSH port of your choice (1024-65535)**
67
68## Security Changes
69
70### SSH
71- Port: 22 → ${SSH_PORT} (your choice, 1024-65535)
72- Auth: Keys only (no passwords)
73- Root login: Disabled
74- Max retries: 3
75- Fail2ban: Brute-force protection
76
77### Firewall
78- Default: Deny incoming
79- Allow: Your chosen SSH port only
80
81### Services
82- CUPS (printing): Stopped & disabled
83- Fail2ban: Intrusion detection enabled
84- Auto-updates: Security patches automatic
85
86### Monitoring
87- Credential file access tracking
88- SSH config change detection
89- Privilege escalation alerts
90- Daily security briefing
91
92## Resource Usage
93
94| Component | RAM | Disk |
95|-----------|-----|------|
96| Auditd | ~2 MB | 40 MB max |
97| UFW | ~1 MB | Negligible |
98| Scripts | ~5 MB | Negligible |
99| **Total** | **<10 MB** | **<50 MB** |
100
101## Files
102
103- `scripts/install.sh` - Main installation
104- `scripts/verify.sh` - Verify installation
105- `scripts/rollback-ssh.sh` - Emergency rollback
106- `scripts/critical-alert.sh` - Telegram alerts
107- `scripts/daily-briefing.sh` - Daily reports
108- `rules/audit.rules` - Audit configuration
109
110## Documentation
111
112See [README.md](README.md) for full documentation.
113
114## License
115
116MIT - See LICENSE file