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:

ComponentPurpose
OpenClawAI agents
Apache2Webserver for websites
WordPressRequired for AgentHub plugin
Nextcloud (optional)Used for appointment booking
LinuxOperating 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

PathOwnerRights
/var/www/nextcloud/root:www-data0755
/var/www/nextcloud/config/config.phproot:www-data0640
/var/nextcloud-datawww-data:www-data0770

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

VulnerabilityDescription
RCE (CVE-2026-25253)Critical remote code execution
Malicious SkillsCommunity skills contain malware
Exposed GatewaysUnsafe Docker defaults expose ports
Prompt InjectionHidden instructions manipulate AI
Plain CredentialsAPI 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:

  1. Go to: Fail2Ban Module → Filters → Actions → Jails
  2. Find: webmin-auth
  3. 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:

SettingValue
Filteropenclaw
Log path/home/claw/.openclaw/logs/openclaw.json
Port8000/8080
Max retries5
Ban time7200 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:

SettingValue
Log path/var/log/apache2/access.log
Porthttp,https
Max retries3
Ban time86400 (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-admin login URL to secret address
  • 99% of bots run into empty
  • Server load reduced immediately

9. Quick Reference

ComponentProtection Method
WebminFail2Ban webmin-auth jail
OpenClawSystemd sandbox, SSH tunnel
NextcloudFail2Ban filter + jail
WordPressLoginizer Pro, Fail2Ban, Hide Login
SSHEd25519 keys, password disabled

Stand / Status: 2026-07-06