Security Manual AgentHub
AgentHub Server absichern / Securing AgentHub Server
1. Overview / Übersicht
The basis for our AgentHub software on the VPS server is Linux with the following components:
| Component | Purpose |
|---|---|
| OpenClaw | AI agents |
| Apache2 | Webserver for websites |
| WordPress | Required for AgentHub plugin |
| Nextcloud (optional) | Used for appointment booking |
| Linux | Operating system |
This manual covers securing all five software components.
2. General / Allgemeines
Webmin Installation
For better administrative overview, install Webmin:
sudo apt-get install webmin
Access via: https://your-server-ip:10000
3. WordPress Security
Recommended Software
- Loginizer Pro (recommended)
- OR alternatively: Wordfence
Optional: IP Region Blocking
# iptables to exclude IP regions (optional)
4. Nextcloud Security
Data Directory
Data directory outside of Nextcloud installation:
# /var/nextcloud-data (instead of /var/www/nextcloud)
Owner and Rights
| Path | Owner | Rights |
|---|---|---|
/var/www/nextcloud/ | root:www-data | 0755 |
/var/www/nextcloud/config/config.php | root:www-data | 0640 |
/var/nextcloud-data | www-data:www-data | 0770 |
App Installation (Terminal)
Since with these rights Nextcloud apps cannot be installed via browser, install apps in terminal:
Calendar App Example:
sudo php /var/www/nextcloud/occ app:install calendar
List all installed apps:
sudo -u www-data php /var/www/nextcloud/occ app:list
Update app:
sudo -u www-data php /var/www/nextcloud/occ app:update calendar
5. OpenClaw Security
Known Vulnerabilities
| Vulnerability | Description |
|---|---|
| RCE (CVE-2026-25253) | Critical remote code execution |
| Malicious Skills | Community skills contain malware |
| Exposed Gateways | Unsafe Docker defaults expose ports |
| Prompt Injection | Hidden instructions manipulate AI |
| Plain Credentials | API keys stored in plaintext |
5.1 Strict Localhost-Binding & SSH-Tunneling
Problem: Websocket ports (8000/8080) open to internet.
Solution:
# Configure OpenClaw to ONLY listen on 127.0.0.1 (NOT 0.0.0.0)
Access via SSH-Tunnel:
ssh -L 8000:127.0.0.1:8000 user@vps-ip
This keeps ports completely closed from outside.
5.2 Systemd Sandbox
Create global service:
sudo nano /etc/systemd/system/openclaw-gateway.service
Service content:
[Unit]
Description=OpenClaw Gateway Protected System Service
After=network-online.target
[Service]
Type=simple
User=claw
Group=claw
WorkingDirectory=/home/claw
Environment=PATH=/home/claw/.npm-global/bin:/usr/local/bin:/usr/bin:/bin
ExecStart=/home/claw/.npm-global/bin/openclaw gateway run
Restart=always
# ==========================================
# SYSTEMD HARDENING (RCE-SCHUTZ)
# ==========================================
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/claw/.openclaw
PrivateTmp=true
NoNewPrivileges=true
CapabilityBoundingSet=~CAP_SYS_ADMIN ~CAP_SYS_CHROOT ~CAP_NET_ADMIN
[Install]
WantedBy=multi-user.target
Enable service:
# Stop old user service
systemctl --user stop openclaw-gateway.service
systemctl --user disable openclaw-gateway.service
# Reload systemd
sudo systemctl daemon-reload
# Start new system service
sudo systemctl start openclaw-gateway.service
sudo systemctl enable openclaw-gateway.service
5.3 Firewall (UFW)
ufw default deny incoming
ufw default allow outgoing
ufw allow from [Firmen-IP] to any port 22 comment 'SSH nur für die Firma'
ufw enable
5.4 Update Handling
After every OpenClaw update, check for ghost instances:
# After updates always run to block user service:
systemctl --user stop openclaw-gateway.service 2>/dev/null
systemctl --user disable openclaw-gateway.service 2>/dev/null
6. SSH Key Authentication
Ed25519 Key Setup
Step 1: Create key pair (local PC):
ssh-keygen -t ed25519 -C "vps-zugang"
Press Enter three times.
Step 2: Copy public key to VPS:
ssh-copy-id user@vps-ip
OR manually copy content to ~/.ssh/authorized_keys.
Step 3: Anti-lockout test
Open a separate terminal window:
ssh user@vps-ip
If login succeeds without password, test was successful.
Step 4: Disable password login (VPS):
sudo nano /etc/ssh/sshd_config
Add/modify:
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
KbdInteractiveAuthentication no
Restart SSH:
sudo systemctl restart ssh
7. Fail2Ban Integration
7.1 Installation via Webmin
In Webmin go to: Unused Modules → Fail2Ban Intrusions Detector
Click: Install Now
7.2 Nextcloud Filter
sudo nano /etc/fail2ban/filter.d/nextcloud.conf
Content:
[Definition]
_groupsre = (?:(?:,?\s*"\b\w+\b":(?:"[^"]*"|\d+))*)
failregex = ^\{%(_groupsre)s\s*"message"\s*:\s*"Login failed:\s*[^"]*"\s*%(_groupsre)s\s*,\s*"remoteAddr"\s*:\s*"<HOST>"%(_groupsre)s\s*\}$
^\{%(_groupsre)s\s*"remoteAddr"\s*:\s*"<HOST>"%(_groupsre)s\s*,\s*"message"\s*:\s*"Login failed:\s*[^"]*"%(_groupsre)s\s*\}$
Create jail:
sudo nano /etc/fail2ban/jail.local
7.3 Webmin Auth Filter
In Webmin:
- Go to: Fail2Ban Module → Filters → Actions → Jails
- Find:
webmin-auth - Enable: Yes
7.4 OpenClaw Filter (Optional)
Only needed if OpenClaw is exposed via internet.
Filter creation:
Filter name: openclaw
Failregex:
^.*"level":"error".*"message":".*unauthorized.*".*"ip":"<HOST>".*$
^.*"level":"warn".*"message":".*auth failure.*".*"ip":"<HOST>".*$
Jail settings:
| Setting | Value |
|---|---|
| Filter | openclaw |
| Log path | /home/claw/.openclaw/logs/openclaw.json |
| Port | 8000/8080 |
| Max retries | 5 |
| Ban time | 7200 seconds |
8. WordPress Integration
8.1 WP Fail2Ban Plugin
Filter creation:
Filter name: wordpress
Failregex:
<HOST>.*POST.*(wp-login\.php|xmlrpc\.php|account\/signin).* 200
Jail settings:
| Setting | Value |
|---|---|
| Log path | /var/log/apache2/access.log |
| Port | http,https |
| Max retries | 3 |
| Ban time | 86400 (24 hours) |
8.2 Loginizer Extension
Add additional protection:
Regex extension:
<HOST>.*POST.*(wp-login\.php|xmlrpc\.php).* (200|403|302)
Effect:
- Loginizer blocks bot (403)
- Fail2ban counts request immediately
- IP blocked after 3 requests
8.3 Hide Login Function
Activate in Loginizer:
- Change
wp-adminlogin URL to secret address - 99% of bots run into empty
- Server load reduced immediately
9. Quick Reference
| Component | Protection Method |
|---|---|
| Webmin | Fail2Ban webmin-auth jail |
| OpenClaw | Systemd sandbox, SSH tunnel |
| Nextcloud | Fail2Ban filter + jail |
| WordPress | Loginizer Pro, Fail2Ban, Hide Login |
| SSH | Ed25519 keys, password disabled |
Stand / Status: 2026-07-06