Skip to content

Sécurité - Vue d'Ensemble

Posture sécurité du serveur homelab Proxmox et containers LXC.

Niveau de Sécurité Actuel

Type d'environnement : Homelab privé LAN
Exposition internet : Aucune (192.168.1.0/24 seulement)
Users : Admin unique

Évaluation Risques

Vecteur Exposition Mitigation Status
Accès réseau externe ❌ Aucune Pas de port forwarding ✅ Sécurisé
SSH brute force 🟡 LAN seulement Password + potential key-based ⚠️ À améliorer
Services Docker 🟡 Ports LAN Pas d'auth sur certains ⚠️ À améliorer
Proxmox Web 🟡 LAN HTTPS Password auth ⚠️ À améliorer
Updates système 🟡 Manuelles Debian stable ⚠️ À monitorer

Architecture Sécurité

graph TB
    A[Internet] -->|BLOQUÉ| B[Routeur/Firewall]
    B --> C[LAN 192.168.1.0/24]
    C --> D[Proxmox Host<br/>192.168.1.21]
    D --> E1[LXC 100<br/>docker-media]
    D --> E2[LXC 101<br/>management]
    D --> E3[LXC 102<br/>PBS]

    F[Admin Workstation<br/>LAN] --> C
    F -.SSH.-> D
    F -.HTTPS.-> D
    F -.HTTP.-> E1
    F -.HTTP.-> E2

    style A fill:#ff6b6b
    style B fill:#ffe6a8
    style D fill:#d4edda
    style F fill:#94c9ff

Proxmox Host

Accès SSH

Port : 22 (standard)
Auth : Password (root)
Exposition : LAN uniquement

# Status SSH
systemctl status sshd

# Connexions actives
who

Recommandations :

  • SSH key-based authentication
  • Disable root password login
  • Change default port 22 → 2222
  • fail2ban installation

→ Voir SSH Hardening

Proxmox Web UI

URL : https://192.168.1.21:8006
Auth : PAM (Linux users)
Certificate : Self-signed (warning browser normal)

Users :

  • root@pam - Full admin access

Recommandations :

  • Créer user admin non-root
  • 2FA authentication (TOTP)
  • Valid SSL certificate (Let's Encrypt)

Firewall Host

# Status firewall
iptables -L -n -v

# Proxmox firewall (si activé)
pve-firewall status

Configuration actuelle : Firewall Proxmox non activé (LAN trust)

Règles recommandées (si activation) :

Allow:
  - SSH (22) from LAN
  - HTTPS (8006) from LAN
  - Ping from LAN
Deny:
  - All from external

LXC Containers

LXC 100 - docker-media

Services exposés :

  • Jellyfin :8096 (HTTP, pas d'auth requise pour LAN users)
  • Sonarr :8989 (API key required)
  • Radarr :7878 (API key required)
  • Prowlarr :9696 (API key required)
  • SABnzbd :8080 (API key required)
  • Bazarr :6767 (API key required)

Sécurité :

  • ✅ API keys pour apps *Arr
  • ⚠️ Jellyfin accessible sans auth (par design homelab)
  • ✅ Pas d'exposition internet

LXC 101 - management

Services exposés :

  • Portainer :9000 (admin password)
  • Homepage :3000 (pas d'auth)
  • MkDocs :8001 (pas d'auth)

Sécurité :

  • ✅ Portainer avec auth
  • ⚠️ Homepage/MkDocs publics LAN (acceptable homelab)

LXC 102 - PBS

Services exposés :

  • PBS Web :8007 (HTTPS, root@pam auth)

Sécurité :

  • ✅ HTTPS natif
  • ✅ Authentication requise
  • ✅ Backup encryption possible

Docker Containers

User Permissions

Environment:
  PUID: 1000
  PGID: 1000

Tous containers tournent avec user 1000:1000 (non-root).

Network Isolation

Mode : Bridge (docker0)
Isolation : Containers isolés entre eux par défaut
Exposition : Ports mappés sur LXC host

# Liste networks
pct exec 100 -- docker network ls

# Inspect
pct exec 100 -- docker network inspect bridge

Volumes & Data

# Configs sensibles
/root/docker-compose/*/config/
  - Jellyfin database
  - Sonarr/Radarr databases
  - API keys

# Permissions
pct exec 100 -- ls -la /root/docker-compose/

Recommandations :

  • Backup encrypted configs
  • Restrict /root permissions
  • Secrets management (Docker secrets ou vault)

Mises à Jour

Proxmox Host

# Check updates
apt update
apt list --upgradable

# Apply updates
apt upgrade

# Kernel updates
pve-kernel-X.X.X disponible  reboot requis

Fréquence actuelle : Manuelle ad-hoc
Recommandé : Mensuelle

LXC OS

# LXC 100 (Debian)
pct exec 100 -- apt update
pct exec 100 -- apt upgrade

# LXC 101 (Debian)
pct exec 101 -- apt update
pct exec 101 -- apt upgrade

# LXC 102 (Debian)
pct exec 102 -- apt update
pct exec 102 -- apt upgrade

Docker Images

# Update all containers
pct exec 100 -- bash -c "cd /root/docker-compose && docker compose pull && docker compose up -d"

# Check outdated images
pct exec 100 -- docker images

Fréquence : Mensuelle recommandée

Logs & Monitoring

Logs Système

# Proxmox host
journalctl -xe
tail -f /var/log/syslog

# SSH login attempts
grep "sshd" /var/log/auth.log | tail -50

Logs Docker

# Container specific
pct exec 100 -- docker logs --tail 100 jellyfin

# Failed login attempts
pct exec 100 -- docker logs jellyfin | grep -i "failed\|error"

fail2ban (TODO)

Protection brute-force SSH à installer :

apt install fail2ban

# Config
/etc/fail2ban/jail.local:
  [sshd]
  enabled = true
  maxretry = 3
  bantime = 3600

→ Voir fail2ban Configuration

Bonnes Pratiques

Actuellement Appliquées ✅

  • Pas d'exposition internet (0 ports forwarded)
  • Containers non-root (PUID/PGID 1000)
  • API keys pour apps critiques
  • HTTPS pour Proxmox/PBS
  • Backups réguliers (PBS quotidien)

À Implémenter ⚠️

  • SSH key-based auth + disable password
  • fail2ban anti-brute-force
  • Monitoring tentatives connexion
  • 2FA Proxmox Web UI
  • Updates automatiques sécurité
  • Firewall Proxmox activé (optionnel LAN)

Nice-to-Have 🔮

  • VPN access (WireGuard) si besoin externe
  • IDS/IPS (Suricata)
  • Centralized logging (ELK stack)
  • Vulnerability scanning (OpenVAS)

Scénarios Incident

Compromission SSH

# 1. Changer password root immédiatement
passwd root

# 2. Review connexions actives
who
pkill -u suspicious_user

# 3. Check backdoors
ls -la /root/.ssh/authorized_keys
crontab -l

# 4. Review logs
grep "Accepted" /var/log/auth.log

Container Compromis

# 1. Stop container
pct exec 100 -- docker stop <container>

# 2. Backup current state
pct exec 100 -- docker commit <container> compromised-backup

# 3. Restore depuis PBS
# (voir backup-strategy.md)

# 4. Investigate logs
pct exec 100 -- docker logs <container>

Checklist Sécurité

Hebdomadaire

  • Review SSH login attempts
  • Check container logs errors
  • Vérifier espace disque backups

Mensuelle

  • Apply system updates (Proxmox + LXC)
  • Update Docker images
  • Review user access
  • Test backup restoration

Trimestrielle

  • Audit permissions fichiers
  • Review firewall rules
  • Password rotation
  • Security posture assessment

Ressources