Tutorial Lengkap: Amankan OpenClaw Kamu dengan Security Hardening Checklist

Tutorial Lengkap: Amankan OpenClaw Kamu dengan Security Hardening Checklist
14 menit baca — Beginner to Intermediate
OpenClaw itu powerful. Connects frontier AI models ke messaging apps yang real, dan ngasih bot akses ke tools yang real juga. That power comes with responsibility.
Guide ini bukan soal paranoia. Ini soal deliberate decisions. Siapa yang boleh ngobrol sama bot kamu. Di mana bot boleh bertindak. Apa yang bot boleh akses.
Kita mulai dari quick wins, terus turun ke detail setiap layer. Semua command dan config udah diverifikasi dari official OpenClaw docs di docs.openclaw.ai.
Threat Model dalam Bahasa Sederhana
Sebelum hardening, kamu perlu paham apa yang kamu lindungi.
Goal-nya bukan "perfectly secure". Nggak ada yang seperti itu. Goal-nya adalah setiap keputusan akses jadi intentional.
Step 1: Jalankan Security Audit (30 Detik)
Hal tercepat yang bisa kamu lakuin sekarang:
openclaw security audit
openclaw security audit --deep
openclaw security audit --fix
openclaw security audit --json
Fungsi masing-masing:
Flag --fix itu sempit dan aman. Dia akan:
- Flip open group policies ke allowlists
- Restore
logging.redactSensitive: "tools" - Tighten state/config/include-file permissions
- Use Windows ACL resets instead of chmod on Windows
Dia mendeteksi footguns umum:
- Gateway auth exposure
- Browser control exposure
- Elevated allowlists
- Filesystem permissions issues
- Permissive exec approvals
- Open-channel tool exposure
Step 2: Apply Hardened Baseline (60 Detik)
Official docs nyediain hardened baseline config yang work untuk meisten single-user setups. Tambah ini ke openclaw.json kamu:
{
"gateway": {
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token",
"token": "replace-with-long-random-token"
}
},
"session": {
"dmScope": "per-channel-peer"
},
"tools": {
"profile": "messaging",
"deny": [
"group:automation",
"group:runtime",
"group:fs",
"sessions_spawn",
"sessions_send"
],
"fs": {
"workspaceOnly": true
},
"exec": {
"security": "deny",
"ask": "always"
},
"elevated": {
"enabled": false
}
},
"channels": {
"whatsapp": {
"dmPolicy": "pairing",
"groups": {
"*": {
"requireMention": true
}
}
}
}
}
Penjelasan apa yang masing-masing lakukan:
- Gateway mode local, bind loopback — Cuma bisa diakses dari localhost, nggak exposed ke internet
- Token auth — Setiap API call butuh token. Use a long random string, bukan something guessable
- dmScope per-channel-peer — Kalau lebih dari satu orang DM bot kamu, masing-masing dapet isolated session sendiri. No cross-contamination
- Tools profile messaging — Start dengan messaging tool set, baru selectively add lebih
- Deny list — Block automation groups, runtime access, filesystem access, dan session manipulation tools
- fs workspaceOnly — File operations cuma bisa ngapain di workspace, bukan system files
- exec deny, ask always — Any exec command butuh explicit approval every single time
- elevated disabled — No privilege escalation
- WhatsApp dmPolicy pairing — Orang harus paired dulu sebelum bisa DM. No open DMs dari strangers
- requireMention in groups — Bot cuma respond pas di-mention, bukan every message
Step 3: Gateway Authentication
Gateway auth adalah first line of defense. Dia ngalin siapa yang boleh akses gateway API.
Auth Modes
OpenClaw support beberapa auth mode:
Generate Token yang Kuat
Jangan pernah pakai password simple. Generate long random token:
# Generate 64-character random token
openssl rand -hex 32
# Atau pakai node
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Simpen token ini dengan aman. Kalau di VPS, taruh di environment variables, bukan di config file yang bisa ke-commit ke git.
Lindungi Gateway Port
Kalau gateway kamu butuh diakses remotely:
{
"gateway": {
"bind": "0.0.0.0",
"auth": {
"mode": "token",
"token": "your-long-random-token-here"
}
}
}
Lalu lindungi portnya pakai firewall. Cuma expose gateway port ke IP tertentu, atau taruh di belakang VPN.
Step 4: Session Isolation
Kalau banyak orang bisa message bot kamu, session isolation itu critical.
Masalahnya
Kalau kamu punya shared bot dan nggak set dmScope, semua DM masuk ke session yang sama. Conversation context Person A bocor ke conversation Person B. Biasanya bukan ini yang kamu mau.
Fix-nya
{
"session": {
"dmScope": "per-channel-peer"
}
}
Pilihan yang tersedia:
Verifikasi dengan Security Audit
openclaw security audit
Ini akan flag kalau DM isolation nggak dikonfigurasi di setup multi-user.
Step 5: Tool Access Control
Tools adalah bagian paling powerful dari OpenClaw. Mereka bikin bot bisa execute commands, read files, browse web, dan lebih. Each tool is a potential attack surface.
Tool Profiles
OpenClaw punya predefined tool profiles:
Start sempit, widen kalau perlu:
{
"tools": {
"profile": "messaging"
}
}
Tolak Specific Tools
Even within a profile, kamu bisa deny specific tools:
{
"tools": {
"deny": [
"group:automation",
"group:runtime",
"group:fs",
"sessions_spawn",
"sessions_send",
"exec"
]
}
}
Filesystem Hardening
Kalau bot kamu butuh filesystem access, lock down:
{
"tools": {
"fs": {
"workspaceOnly": true,
"deny": ["/etc", "/root", "/home/*/.ssh"],
"allow": []
}
}
}
workspaceOnly: true artinya bot cuma bisa read/write files di dalam workspace directory. Nggak bisa akses system files, SSH keys, atau lokasi sensitif lainnya.
Exec Hardening
Exec adalah tool paling dangerous. Dia runs shell commands di server kamu.
{
"tools": {
"exec": {
"security": "deny",
"ask": "always"
}
}
}
Even when allowed, require approval setiap kali:
{
"tools": {
"exec": {
"allow": [],
"ask": "always"
}
}
}
Step 6: Channel-Specific Policies
Setiap channel punya security policy masing-masing. Ini yang paling penting:
{
"channels": {
"whatsapp": {
"dmPolicy": "pairing",
"groups": {
"*": {
"requireMention": true
}
}
}
}
}
Pilihan dmPolicy:
Telegram
{
"channels": {
"telegram": {
"dmPolicy": "pairing",
"groups": {
"*": {
"requireMention": true
}
}
}
}
}
Discord
Discord punya permission requirements yang lebih complex. Kalau kamu run public Discord bot, pakai strict allowlists:
{
"channels": {
"discord": {
"dmPolicy": "allowlist",
"allowlist": ["user-id-1", "user-id-2"]
}
}
}
Step 7: Pairing dan Allowlist Management
Pairing adalah gimana kamu grant access ke specific users. Kayak SSH authorized_keys list.
Pair a User
openclaw pair --name "Fanani" --channel telegram --id 220924719
List Paired Users
openclaw pair list
Cabut Access
openclaw pair revoke --name "Fanani"
Kapan Pakai Allowlist vs Pairing
Step 8: Logging dan Monitoring
Kamu nggak bisa protect apa yang nggak bisa kamu lihat. Enable comprehensive logging:
{
"logging": {
"level": "info",
"redactSensitive": "tools",
"handlers": {
"file": {
"path": "/var/log/openclaw/gateway.log"
}
}
}
}
redactSensitive: "tools" prevents sensitive data dari muncul di logs.
Yang Perlu Dimonitor
- Failed authentication attempts
- Unusual exec commands
- Access dari new IPs
- Session anomalies
Jadwal Audit Regular
Step 9: VPS Hardening (SSH + Firewall)
OpenClaw gateway kamu jalan di VPS. VPS itu sendiri butuh hardening.
SSH Hardening
# Disable password authentication
sudo sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
# Disable root login
sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
# Use non-standard port
sudo sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config
# Restart SSH
sudo systemctl restart sshd
Firewall Setup
# Allow only necessary ports
sudo ufw allow 2222/tcp # SSH
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw deny 8080/tcp # Block gateway port dari public
# Enable firewall
sudo ufw enable
Fail2Ban
Install fail2ban buat block brute force attacks:
sudo apt install -y fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
Step 10: Formal Verification (For the Paranoid)
OpenClaw punya formal verification project pakai TLA+. Ini adalah machine-checked security regression suite.
# Clone the models repo
git clone https://github.com/vignesh07/openclaw-formal-models
cd openclaw-formal-models
# Java 11+ required (TLC runs on JVM)
make gateway-exposure-v2
make nodes-pipeline
make pairing
Ini memverifikasi:
- Gateway exposure butuh token auth
- Node exec pipeline butuh allowlist plus approval
- Pairing requests respect TTL dan pending-request caps
Ini advanced stuff. Kalau kamu running high-security deployment, ini ngasih mathematical confidence dalam security model.
Complete Checklist
Butuh VPS buat OpenClaw?
Jalankan OpenClaw yang udah diamankan 24/7 butuh VPS yang reliable. Kita recommend SumoPod:
Daftar SumoPod VPS — Cepat, affordable, perfect buat jalankan OpenClaw dengan security yang proper.
Untuk versi English yang lebih teknis:
Read English Version on GitHub — Full technical checklist with all commands and configs.
Referensi dan Baca Lanjutan
- OpenClaw Security Documentation
- Official Security Audit Command
- Hardened Baseline Config
- Formal Verification Models
- OpenClaw Sessions Management
Related Tutorials
- OpenClaw Session Maintenance Guide — Cara bersihkan session yang berantakan
- WhatsApp Customer Care untuk UMKM — Setup auto-reply bot
- Auto-Reply Bot Setup — Panduan lengkap auto-reply
Guide ini diverifikasi terhadap official OpenClaw security documentation (docs.openclaw.ai). Semua commands dan configs dikonfirmasi dari official source.
Tutorial ini bagian dari project OpenClaw Sumopod — membuat automation accessible untuk UMKM Indonesia.
Last Updated: April 2026 Version: 1.0 Author: Radian IT Team
Peringatan penting: OpenClaw security guidance assumes one trusted operator per gateway. Kalau kamu butuh hostile-user isolation, split by trust boundary dengan separate gateways atau separate OS users/hosts.
Ada Pertanyaan? Yuk Ngobrol!
Butuh bantuan setup OpenClaw, konsultasi IT, atau mau diskusi project engineering? Book a call langsung — gratis.
Book a Call — Gratisvia Cal.com • WITA (UTC+8)
📬 Subscribe Newsletter
FreeDapat alert setiap ada artikel baru langsung ke inbox kamu. Free, no spam. 🚀
👥 Join 0+ engineers & tech enthusiasts
Zainul Fanani
Founder, Radian Group. Engineering & tech enthusiast.

💬 Komentar