Install
openclaw skills install hostguardCheck whether OpenClaw is listening beyond localhost or running with elevated privileges, then offer a conservative lockdown fix. 检查OpenClaw安全配置。
openclaw skills install hostguardSecurity assistant for OpenClaw. Check whether the local OpenClaw service is reachable beyond localhost and whether it is running with elevated privileges.
# Find OpenClaw process and check binding
PORT=${OPENCLAW_PORT:-18789}
echo "Checking port $PORT..."
lsof -i :$PORT -P -n 2>/dev/null | grep LISTEN || echo "No listener on port $PORT"
# Check if running as root
if [ "$(id -u)" = "0" ]; then
echo "⚠️ Running as root (elevated privileges)"
else
echo "✅ Running as user $(whoami) (uid=$(id -u))"
fi
# Check env files for HOST setting
for f in .env.local .env.development .env.production .env; do
if [ -f "$f" ]; then
HOST_VAL=$(grep -E "^(OPENCLAW_HOST|HOST)=" "$f" 2>/dev/null | cut -d= -f2)
if [ -n "$HOST_VAL" ]; then
echo "Found HOST=$HOST_VAL in $f"
fi
fi
done
# Run all checks
echo "🛡️ ClawGuard Security Check"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━"
# 1. Check user
echo ""
echo "🔐 User/Privilege:"
if [ "$(id -u)" = "0" ]; then
echo " ⚠️ Running as root"
else
echo " ✅ Running as $(whoami) (uid=$(id -u))"
fi
# 2. Check port
PORT=${OPENCLAW_PORT:-18789}
echo ""
echo "🔌 Network Binding (port $PORT):"
LISTEN_INFO=$(lsof -i :$PORT -P -n 2>/dev/null | grep LISTEN)
if [ -n "$LISTEN_INFO" ]; then
echo " $LISTEN_INFO"
if echo "$LISTEN_INFO" | grep -q "127.0.0.1"; then
echo " ✅ Loopback only (safe)"
elif echo "$LISTEN_INFO" | grep -q "0.0.0.0\|::"; then
echo " ⚠️ Listening on all interfaces (may be exposed)"
else
echo " ℹ️ Check binding manually"
fi
else
echo " ℹ️ No listener detected"
fi
# 3. Check config
echo ""
echo "📋 Configuration:"
for f in .env.local .env.development .env.production .env; do
if [ -f "$f" ]; then
HOST_VAL=$(grep -E "^(OPENCLAW_HOST|HOST)=" "$f" 2>/dev/null | cut -d= -f2)
if [ -n "$HOST_VAL" ]; then
echo " $f: HOST=$HOST_VAL"
fi
fi
done
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━"
Read local env files in this order:
.env.local.env.development.env.production.envLook for:
OPENCLAW_HOST or HOSTOPENCLAW_PORT or PORT18789Use system commands to check if the port is listening:
lsof -i :{port} (macOS/Linux)netstat -tlnp | grep {port} (Linux)netstat -ano | findstr :{port} (Windows)Classify the binding:
Check if running with elevated privileges:
uid == 0 (root)0.0.0.0 or ::HOST or OPENCLAW_HOST entry is present.bak backup beside the file127.0.0.1🛡️ ClawGuard Security Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Configuration
├─ Host: 127.0.0.1 (from .env)
├─ Port: 18789
└─ Status: ✅ Loopback only
🔌 Network Binding
├─ Listening: Yes
├─ Binding: 127.0.0.1:18789
└─ Assessment: ✅ Local only
🔐 Privileges
├─ User: bingo (uid=501)
└─ Status: ✅ Not elevated
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 Conclusion: ✅ Secure configuration
No env file found → "⚠️ No configuration file found"
Port not listening → "ℹ️ No active listener detected"
Permission denied → "❌ Cannot check privileges"
Command not available → "⚠️ Required tool not available"