10. Lampiran & Cheat Sheet

10. Lampiran & Cheat Sheet

Referensi cepat untuk port, path file, dan contoh konfigurasi lengkap.

8.1 Tabel Referensi Port

Service Port Akses Dari Peran
SSH 22 TRUSTED + GREY Admin
HTTP 80 Public Web
HTTPS 443 Public Web
MySQL 3306 TRUSTED only Database
PostgreSQL 5432 TRUSTED only Database
MongoDB 27017 TRUSTED only Database
Valkey 6379 Public (IoT) Database
AMQP/S 5671, 5672 Public (IoT) Message Broker
MQTT/S 1883, 8883 Public (IoT) Message Broker
STOMP/S 61613, 61614 Public (IoT) Message Broker
RabbitMQ 15672 TRUSTED + GREY Mgmt UI
SFTP 2222 TRUSTED only Storage

8.2 Path File Konfigurasi Penting

  • SSH Hardening: /etc/ssh/sshd_config.d/hardening.conf
  • UFW Rules: /etc/ufw/user.rules
  • Caddyfile: /etc/caddy/Caddyfile
  • PHP-FPM: /etc/php/<VERSION>/fpm/pool.d/www.conf
  • CrowdSec Bouncer: /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml

8.3 Skrip Setup Cepat UFW

Simpan sebagai setup-ufw.sh dan jalankan sebagai root:

#!/bin/bash
# Default policy
sudo ufw default deny incoming
sudo ufw allow outgoing

# SSH dari jaringan terpercaya
# Protected LAN
sudo ufw allow from <YOUR_PRIVATE_LAN> to any port 22 proto tcp
# Cloudflare CGNAT (Virtual Mesh) - Carrier-Grade NAT space untuk WARP
sudo ufw allow from <CLOUDFLARE_MESH_SUBNET> to any port 22 proto tcp
# Tambahkan IP GREY Anda di sini
# sudo ufw allow from <YOUR_CAMPUS_IP_PATTERN> to any port 22 proto tcp

# Port layanan lainnya (HTTP/S, DB, dll) dikonfigurasi per-role.
# Lihat bagian 4-8 untuk detailnya.

# Aktifkan
sudo ufw enable

8.4 Template Caddy Security Headers

header {
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "DENY"
    Referrer-Policy "strict-origin-when-cross-origin"
    Permissions-Policy "interest-cohort=(), geolocation=(), microphone=(), camera=()"
    -Server
}

Dokumentasi ini adalah bagian dari standar infrastruktur <YOUR_ORG_NAME>.