Expose service public — Traefik endor
Hors DR critique. Workflow pour rendre un service interne accessible depuis Internet via le reverse-proxy public Traefik sur endor.
Contexte
Pipeline trafic public:
Internet → DNS *.sta4ck.eu → IP publique → Box SFR forward 443
→ OPNsense WAN → DNAT vers endor:443
→ Traefik endor → backend interne (tatooine:port ou autre VM)
endor (Mac Mini, 10.0.1.15) = host Traefik public séparé de tatooine (Traefik interne *.minfra.in). Pourquoi séparation:
- endor toujours up (Mac Mini low-power), tatooine peut down/restart
- Traefik public expose uniquement services choisis (whitelist)
- TLS cert Let’s Encrypt sur endor (domaine public sta4ck.eu)
Prérequis
- endor up + Traefik public running (
docker ps | grep traefik) - DNS public configuré (record
*.sta4ck.eu→ IP publique chez registrar) - Box SFR forward 443/80 → 192.168.1.2 (OPNsense WAN)
- OPNsense FW WAN→endor:443/80 actif (cf
09-opnsense-config)
curl -sk https://mariage-as.sta4ck.eu/ -o /dev/null -w "%{http_code}\n"
Verify: dig +short mariage-as.sta4ck.eu (doit retourner IP publique)
Exposer un service
task expose NAME=jellyfin BACKEND=http://10.0.2.50:8096
Args:
NAME: sous-domaine (devientjellyfin.sta4ck.eu)BACKEND: URL interne (IP DMZ + port)AUTH=authentik(optionnel) : ajoute forward-auth Authentik (SSO requis)INSECURE=true(optionnel) : skip TLS verify backend
Workflow:
- Ajoute fichier
<NAME>.ymldans dossier Traefik dynamique endor - Reload Traefik (auto via file provider watch)
- Let’s Encrypt génère cert pour
<NAME>.sta4ck.eu(HTTP-01 challenge) - Service accessible publiquement
Verify: curl -kI https://jellyfin.sta4ck.eu/ | head -1
Avec Authentik SSO
Force connexion Authentik avant accès backend:
task expose NAME=jellyfin BACKEND=http://10.0.2.50:8096 AUTH=authentik
Visiteurs → redirected vers authentik.minfra.in → login OIDC → cookie retourné → accès jellyfin.
Verify: curl -kI https://jellyfin.sta4ck.eu/ | grep -i location | grep -i authentik
Retirer service exposé
task unexpose NAME=jellyfin
Supprime le fichier dynamique Traefik endor. Cert reste en cache (auto-renew Let’s Encrypt continue inutilement — clean acme.json si besoin garbage).
Verify: curl -sk https://jellyfin.sta4ck.eu/ —max-time 3 (doit timeout / 404)
Lister services exposés
ssh sacha@endor 'ls /opt/traefik/dynamic/*.yml'
Verify: ssh sacha@endor ‘curl -s http://localhost:8080/api/http/routers | jq ”.[].name“‘
Debug Traefik endor
ssh sacha@endor 'docker logs traefik --tail 50 | grep -iE "error|cert"'
ssh sacha@endor 'docker logs traefik | grep -i "<NAME>.sta4ck.eu"'
Verify: ssh sacha@endor ‘docker exec traefik traefik healthcheck’
Renouvellement cert Let’s Encrypt
Auto via Traefik ACME (90 jours). Force renew manuel si problème:
ssh sacha@endor 'docker exec traefik rm /etc/traefik/acme.json && docker restart traefik'
Verify: ssh sacha@endor ‘docker logs traefik —tail 20 | grep -i acme’
Suite logique
- Centraliser ACL via Authentik (groups + applications)
- Rate-limit Traefik middleware (anti-brute-force)
- Logs centralisés vers Loki (
kalevalamonitoring stack)
Hors périmètre
- Cloudflare Proxy en front (homelab direct OK pour test)
- WAF (ModSecurity/Crowdsec)
- IPv6 expose (IPv4 only Box SFR)
- Multi-domain certs (1 cert par sous-domaine OK)