Conversation
…rker Co-authored-by: TheToto <12860648+TheToto@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Secure Traefik dashboard and remove Docker socket privileges
Security: protect Traefik dashboard with Authentik and remove root Docker socket access from Authentik worker
Mar 16, 2026
Owner
|
pour le socket docker je prefere que tu fqsse son propre proxy avec les permissions necessaires |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Traefik dashboard was publicly accessible (middleware line commented out), and the Authentik worker had unrestricted root access to the Docker socket — equivalent to host root on the VPS.
Changes
Traefik dashboard (
vps/traefik.yml,media/traefik.yml)traefik.http.routers.api.middlewares=authentik@dockeron both stacks to enforce Authentik SSO on the dashboardAuthentik worker hardening (
vps/auth.yml)user: root/var/run/docker.sockvolume mountsocket_dockerto the worker'snetworks— routes Docker API calls through the existingtecnativa/docker-socket-proxyinsteadsocket_dockerasexternal: truein the file'snetworks:blockOriginal prompt
Please secure the Traefik dashboard and remove the root/Docker socket privileges from the Authentik worker in the
TheToto/selfhostedrepository.Here are the specific changes to make:
1. Secure Traefik API/Dashboard in
vps/traefik.ymlFind the commented out middleware line for the Traefik API and uncomment it.
Change:
#- 'traefik.http.routers.api.middlewares=authentik@docker'To:
- 'traefik.http.routers.api.middlewares=authentik@docker'2. Secure Traefik API/Dashboard in
media/traefik.ymlFind the commented out middleware line for the Traefik API and uncomment it.
Change:
#- 'traefik.http.routers.api.middlewares=authentik@docker'To:
- 'traefik.http.routers.api.middlewares=authentik@docker'3. Isolate Authentik Worker in
vps/auth.ymlIn the
workerservice block:user: root- /var/run/docker.sock:/var/run/docker.sockfrom thevolumeslist.socket_dockerto thenetworkslist for theworkerservice.socket_dockeris declared in thenetworks:block withexternal: true(alongsideglobal_netandauthentikif applicable).Example of expected
workerconfiguration:And in the
networks:block at the end of the file:The following is the prior conversation context from the user's chat exploration (may be truncated):
User: fait une recherche approfondie de vulnerabilités dans mon repo selfhosted
Assistant: J'ai effectué une analyse approfondie de votre dépôt
TheToto/selfhosteden examinant les fichiers de configuration Docker Compose (via la recherche de code).Dans l'ensemble, votre configuration démontre d'excellentes pratiques de sécurité. Vous avez mis en place de très bonnes défenses, mais voici quelques points d'attention et vulnérabilités potentielles que j'ai pu identifier :
🟢 Les excellents points de sécurité (à conserver) :
${CF_API_KEY},${PG_PASS},${REDIS_PASSWORD}). Ils sont correctement gérés par des variables d'environnement. (Assurez-vous juste que vos fichiers.envsont bien dans votre.gitignore).vps/traefik.yml, Traefik ne monte pas directement le socket Docker root (/var/run/docker.sock) mais passe partecnativa/docker-socket-proxy. C'est une excellente pratique pour limiter la surface d'attaque si Traefik venait à être compromis.ALLOW_PASSWORD_LOGIN: False(ex: Mealie), ce qui empêche le contournement du SSO.media/jellyfin.ymletmedia/plex.yml, les middlewares Traefik intègrent d'excellents en-têtes de sécurité (SSLRedirect,browserXSSFilter,frameDeny,STSPreload, etc.) pour vous protéger contre le XSS et le clickjacking.1. Traefik Dashboard potentiellement exposé sans authentification
Dans vos fichiers
vps/traefik.ymletmedia/traefik.yml, l'accès à l'API/Dashboard Traefik n'est pas protégé :Le problème : L'authentification par
authentik@dockerest commentée. Comme vous avez défini unedefaultRulesurHost(traefik.${APP_DOMAIN}), cela signifie que n'importe qui accédant à l'URL de votre dashboard Traefik aura potentiellement un accès complet sans aucun mot de passe.Correction : Décommentez la ligne du middleware ou configurez une authentification
basicAuthminimale.2. Socket Docker exposé au Worker Authentik (Privilege Escalation)
Dans
vps/auth.yml, le serviceworkera accès au socket Docker en tant que compteroot:Le problème : Monter le socket Docker directement dans un conteneur en tant que root équivaut à lui donner les droits
rootsur la machine hôte complète (votre ...This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.