Skip to content

Sécurité - Fail2ban & UFW

Fail2ban

Protection anti-bruteforce déployée sur LXC 103.

Jails actives

  • sshd : Protection SSH (maxretry=3, bantime=1h)
  • npm-general : Protection NPM HTTP/HTTPS (maxretry=5, bantime=10m)
  • npm-docker : Protection NPM Admin WebUI port 81 (maxretry=3, bantime=30m)
  • authelia : Protection authentification SSO (maxretry=5, bantime=1h)

Configuration

  • Bantime global : 10min (SSH 1h, npm-docker 30min)
  • Findtime : 10min
  • Maxretry : 5 (SSH 3, npm-docker 3)
  • Backend : systemd
  • Action : email + whois + logs (action_mwl)
  • Email : nicolas.liautaud@gmail.com

Commandes utiles

# Status global
pct exec 103 -- fail2ban-client status

# Status jail spécifique
pct exec 103 -- fail2ban-client status sshd
pct exec 103 -- fail2ban-client status authelia

# IPs bannies
pct exec 103 -- fail2ban-client banned

# Débannir IP
pct exec 103 -- fail2ban-client set sshd unbanip 1.2.3.4

# Logs
pct exec 103 -- tail -f /var/log/fail2ban.log

UFW Firewall

Firewall applicatif actif sur LXC 103.

Règles actives

  • Policy : DENY incoming, ALLOW outgoing
  • Port 22 (SSH) : ALLOW from 192.168.1.0/24 (LAN uniquement)
  • Port 80 (HTTP) : ALLOW from Anywhere
  • Port 443 (HTTPS) : ALLOW from Anywhere
  • Port 51820/UDP (WireGuard) : ALLOW from Anywhere

Sécurité

✅ SSH accessible uniquement depuis LAN (192.168.1.0/24)
✅ Services web publics (80/443)
✅ VPN public (51820/UDP)
✅ Tout le reste bloqué par défaut

Commandes utiles

# Status
pct exec 103 -- ufw status verbose

# Ajouter règle
pct exec 103 -- ufw allow from 10.13.13.0/24 to any port 9091

# Supprimer règle
pct exec 103 -- ufw delete allow 80/tcp

# Désactiver
pct exec 103 -- ufw disable

# Logs
pct exec 103 -- tail -f /var/log/ufw.log

QoS

Non implémenté - Débit FTTH suffisant (700-800 Mbps).

Si nécessaire : Utiliser wondershaper (limitation interface) ou tc qdisc (Proxmox host). Voir wondershaper documentation.