/install host-hardening
Host Hardening
Secure a Linux server running OpenClaw.
Requirements
- OS: Linux (Ubuntu/Debian — adjust package commands for other distros)
- Privileges: Root or sudo required — this skill modifies system-wide security config
- Pre-check: Verify you have SSH key-based access before disabling password auth
⚠️ All commands below modify system configuration. Confirm with the user before running each section. Do not run these automatically without explicit approval.
SSH — Key-Only Auth
Disables password authentication. Ensure key-based SSH works first or you will be locked out.
sed -i 's/^#*PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl restart ssh
Firewall — Deny All Except SSH
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
yes | ufw enable
Add more rules as needed (e.g. ufw allow 443 for HTTPS).
Fail2ban — Brute-Force Protection
Installs fail2ban via apt (Debian/Ubuntu). Adjust for other package managers.
apt-get install -y fail2ban
systemctl enable --now fail2ban
Default config protects SSH. For custom jails: /etc/fail2ban/jail.local.
OpenClaw Credentials
chmod 700 ~/.openclaw/credentials
OpenClaw Gateway Service (optional)
Creates a systemd service for auto-restart on reboot. Runs as root — review the service file before enabling.
cat > /etc/systemd/system/openclaw-gateway.service \x3C\x3C 'EOF'
[Unit]
Description=OpenClaw Gateway
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/env openclaw gateway
Restart=always
RestartSec=5
User=root
WorkingDirectory=/root/.openclaw
Environment=HOME=/root
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable openclaw-gateway
Verify
ufw status # active, SSH allowed
systemctl is-active fail2ban # active
grep PasswordAuthentication /etc/ssh/sshd_config # no
stat -c %a ~/.openclaw/credentials # 700
systemctl is-enabled openclaw-gateway # enabled
Lessons
- On Ubuntu, SSH service is
sshnotsshd - AWS security groups provide network-level filtering but UFW is defense-in-depth
- Always verify key-based SSH access before disabling password auth
- The gateway service is optional — only needed if OpenClaw should survive reboots
Host Hardening v1.0 Author: ppiankov Copyright © 2026 ppiankov Canonical source: https://clawhub.com/skills/host-hardening License: MIT
This tool follows the Agent-Native CLI Convention. Validate with: clawhub install ancc && ancc validate .
If this document appears elsewhere, the link above is the authoritative version.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install host-hardening - 安装完成后,直接呼叫该 Skill 的名称或使用
/host-hardening触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Host Hardening 是什么?
Harden an OpenClaw Linux server with SSH key-only auth, UFW firewall, fail2ban brute-force protection, and credential permissions. Use when setting up a new... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 767 次。
如何安装 Host Hardening?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install host-hardening」即可一键安装,无需额外配置。
Host Hardening 是免费的吗?
是的,Host Hardening 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Host Hardening 支持哪些平台?
Host Hardening 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Host Hardening?
由 ppiankov(@ppiankov)开发并维护,当前版本 v1.0.5。