Engine edge ditulis dalam Go dengan WAF matcher opsional (Rust, FFI). Panduan ini mencakup instalasi, konfigurasi tiap lapisan pertahanan, admin API, hingga dashboard.
Engine membutuhkan Go 1.24+. WAF matcher Rust bersifat opsional; jika DLL tidak tersedia, engine otomatis memakai matcher bawaan Go. Dashboard ada di folder dashboard/ (Next.js).
# engine
go build -o bin/gs ./cmd/garudashield # Windows: -o bin/gs.exe
cp garudashield.example.json garudashield.json
./bin/gs -config garudashield.json # default :8080
# dashboard (terpisah)
cd dashboard
$env:GS_API_URL="http://localhost:8080" # URL engine
$env:GS_API_KEY="<admin.secret>" # sama dgn config
npm install && npm run build && npm start # http://localhost:3000
# Windows: cukup jalankan run.ps1 (origin + engine + dashboard sekaligus)
./run.ps1Config berbentuk JSON dan kompatibel dengan v2 (config/default.js). Field kosong memakai default aman. Berikut bentuk minimal untuk produksi:
{
"version": "3.0.0",
"server": { "httpPort": 8080, "host": "0.0.0.0", "maxConcurrency": 2048 },
"upstream": { "host": "127.0.0.1", "port": 9000 },
"admin": { "enabled": true, "secret": "GANTI-DENGAN-KEY-KUAT" },
"proxy": { "trustProxy": false },
"defense": {
"waf": { "enabled": true, "sqli": true, "xss": true, "commandInjection": true,
"pathTraversal": true, "lfi": true, "rfi": true, "shellshock": true, "scanners": true },
"rateLimit": { "perIPRPS": 50, "perIPBurst": 100, "globalMaxRPS": 50000, "slidingWindowMs": 1000 },
"layer4": { "bogonFilter": true }
},
"reputation": { "enabled": true, "blockThreshold": 80, "challengeThreshold": 60 },
"access": { "enabled": true, "protectAll": false, "hosts": {} },
"allowedHosts": [],
"whitelist": ["127.0.0.1", "::1"]
}Setiap host dipetakan ke satu site. Engine mengevaluasi keamanan di setiap request (termasuk yang diproxy). Host tak dikenal jatuh ke upstream global.
{
"sites": {
"app.example.com": { "type": "proxy", "upstream": { "host": "10.0.0.5", "port": 8080 } },
"shop.example.com": { "type": "proxy", "upstream": { "host": "10.0.0.6", "port": 3000 } }
},
"upstream": { "host": "127.0.0.1", "port": 9000 }
}IP klien hanya diambil dari X-Forwarded-For / X-Real-IP bila koneksi berasal dari proxy terpercaya. Ini mencegah spoofing IP oleh klien langsung.
{
"proxy": {
"trustProxy": true,
"realIpHeader": "X-Forwarded-For",
"trustedProxies": ["10.0.0.0/24", "192.168.1.10"]
}
}Modul bawaan: SQLi, XSS, Command Injection, Path Traversal, LFI/RFI, Shellshock, Scanner. Skor tiap aturan diakumulasi; total ≥ 50 memblokir request. Payload ter-encode (single, double, plus) dinormalisasi sebelum dicocokkan, jadi tidak bisa di-bypass dengan encoding.
# toggle modul tanpa restart
POST /api/waf {"modules": {"sqli": true, "xss": false}}
# tambah custom rule (regex) — skor >= 50 memblokir
POST /api/rules {"name":"block-bot","pattern":"(?i)evil-agent","score":60}
DELETE /api/rules # hapus semua custom ruleBatas per-IP, per-path, dan global dengan sliding window. RED (Random Early Drop) menurunkan beban sebelum limit keras tercapai. Mode adaptif mengetatkan ambang otomatis saat serangan.
POST /api/ratelimit {
"perIPRPS": 50, "perIPBurst": 100,
"perPathRPS": 200, "globalMaxRPS": 50000,
"slidingWindowMs": 1000
}Interstitial gaya Cloudflare untuk pengunjung pertama. Request tanpa cookie gs_okdijawab challenge ringan; jawaban valid menerbitkan cookie (TTL default 1800 detik). Klien non-browser (curl, skrip) diblokir, bukan di-challenge. Aktifkan per-host dari tab Protect di dashboard, atau nyalakan Protect All untuk seluruh host.
GET /api/access/hosts # daftar host + protectAll
POST /api/access/hosts {"host":"app.example.com","enabled":true}
POST /api/access/protectall {"enabled":true}Blokir di satu node langsung disiarkan ke semua node via shared secret (Redis). Full-sync berkala menjaga konsistensi; tombstone mencegah node stale memasukkan kembali IP yang di-unblock.
{
"cluster": {
"enabled": true,
"nodeId": "edge-ny2",
"redis": { "enabled": true, "address": "127.0.0.1:6379", "keyPrefix": "gs" }
}
}Notifikasi otomatis saat serangan terdeteksi/reda, mode emergency/aggressive/flood berubah, atau ada log kritikal. Filter berdasarkan severity minimum dengan cooldown antar-alert.
{
"alerts": {
"enabled": true, "minSeverity": "warning", "cooldownMs": 60000,
"telegram": { "botToken": "...", "chatId": "..." },
"discord": { "webhookUrl": "https://discord.com/api/webhooks/..." }
}
}
# uji koneksi
POST /api/alerts/testSemua endpoint butuh x-gs-key (atau Authorization: Bearer), kecuali /api/status yang terbuka. Dashboard menyambung via BFF /api/gs/* yang menyuntikkan key di server.
| Method | Endpoint | Fungsi |
|---|---|---|
| GET | /api/status | Health & komponen (terbuka) |
| GET | /api/stats | Statistik lengkap + volume |
| GET | /api/stats/stream | SSE metrik live |
| GET | /api/top | Top IP & path |
| GET | /api/logs | Event keamanan terbaru |
| GET | /api/waf | Konfigurasi & aturan WAF |
| POST | /api/waf | Toggle modul WAF |
| GET | /api/ratelimit | Konfigurasi & stats rate-limit |
| GET | /api/reputation | Skor reputasi per IP |
| POST | /api/block | Blokir IP {ip,reason,duration} |
| POST | /api/unblock | Cabut blokir {ip} |
| POST | /api/whitelist | Tambah whitelist {ip} |
| GET | /api/cluster | Status cluster & peer |
| GET | /api/backup | Ekspor konfigurasi |
| POST | /api/backup/restore | Impor konfigurasi |
| POST | /api/reset | Reset counter/blocklist/reputasi |
Set GS_API_URL & GS_API_KEY, build, lalu buka /login dan masukkan admin key. Konsol /dash memuat Overview, Traffic, Charts, Geo Map, Top, Logs, Reputation, WAF Rules, Rate Limit, Protect, Cluster, Alerts, dan Settings secara live (polling 1 detik). Halaman status publik terpisah di /status — menampilkan uptime, kesehatan 5 komponen, dan riwayat insiden.
POST /api/waf {"modules":{"sqli":false,...}} tanpa restart.trustProxy dan daftarkan rentang IP proxy agar IP klien terbaca benar.Tim teknis membantu konfigurasi dan trial 7 hari.