The Jesse's audit #1

Merged
Djeex merged 20 commits from the-jesse-audit into main 2026-09-07 15:07:21 +02:00
10 changed files with 401 additions and 46 deletions
Showing only changes of commit 81c54c9afc - Show all commits
+77 -4
View File
@@ -94,15 +94,52 @@ services:
container_name: dockge container_name: dockge
ports: ports:
- 3555:5001 # LAN-accessible port will be 3555 - 3555:5001 # LAN-accessible port will be 3555
environment:
- DOCKER_HOST=tcp://docker-socket-proxy:2375
- DOCKGE_STACKS_DIR=/srv/docker
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /srv/docker/dockge/data:/app/data - /srv/docker/dockge/data:/app/data
- /srv/docker:/srv/docker - /srv/docker:/srv/docker
networks:
- dockge-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-dockge
security_opt:
- no-new-privileges:true
networks:
- dockge-internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
- DOCKGE_STACKS_DIR=/srv/docker - CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- VOLUMES=1
- EXEC=1
- INFO=1
- SYSTEM=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
dockge-internal:
name: dockge-internal
``` ```
::warning
Dockge needs access to the Docker API to manage every other stack on this server, which is effectively root access to your host. Instead of mounting `/var/run/docker.sock` directly, this config sits **Docker Socket Proxy** in front of it, only allowing the specific permissions Dockge needs (containers, images, networks, volumes, exec, lifecycle actions), on their own internal network. Dockge has no built-in login by default, so never expose port `3555` beyond your LAN without putting it behind [TinyAuth](/serveex/security/tinyauth) or [Authentik](/serveex/advanced/authentik) first.
::
Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit. Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit.
#### Launch the container #### Launch the container
@@ -149,12 +186,44 @@ services:
- WATCHTOWER_LABEL_ENABLE=true - WATCHTOWER_LABEL_ENABLE=true
- WATCHTOWER_CLEANUP=true - WATCHTOWER_CLEANUP=true
- WATCHTOWER_REMOVE_VOLUMES=true - WATCHTOWER_REMOVE_VOLUMES=true
- DOCKER_HOST=tcp://docker-socket-proxy:2375
# Discord notifications - uncomment if used # Discord notifications - uncomment if used
#- WATCHTOWER_NOTIFICATIONS=slack #- WATCHTOWER_NOTIFICATIONS=slack
#- WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=Watchtower #- WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=Watchtower
#- WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=${WH_URL} #- WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=${WH_URL}
networks:
- watchtower-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-watchtower
security_opt:
- no-new-privileges:true
networks:
- watchtower-internal
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- VOLUMES=1
- INFO=1
- SYSTEM=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
watchtower-internal:
name: watchtower-internal
``` ```
::warning ::warning
@@ -162,6 +231,10 @@ services:
`WATCHTOWER_REMOVE_VOLUMES=true` deletes a container's anonymous volumes as soon as it's updated. Combined with a `latest` tag, an automatic update can silently wipe data for any app that still stores something in an anonymous (unnamed) volume instead of a bind mount. `WATCHTOWER_REMOVE_VOLUMES=true` deletes a container's anonymous volumes as soon as it's updated. Combined with a `latest` tag, an automatic update can silently wipe data for any app that still stores something in an anonymous (unnamed) volume instead of a bind mount.
:: ::
::note
This config sits **Docker Socket Proxy** in front of the Docker API instead of mounting `/var/run/docker.sock` directly, so Watchtower only gets the permissions it actually needs (list/pull images, recreate containers) rather than full root-equivalent access to the host.
::
#### Set your environment variables #### Set your environment variables
Fill in the `.env` section in Dockge with the following: Fill in the `.env` section in Dockge with the following:
+32 -1
View File
@@ -43,10 +43,41 @@ services:
- .env - .env
environment: environment:
- DOZZLE_HOSTNAME=${DOMAIN} - DOZZLE_HOSTNAME=${DOMAIN}
- DOCKER_HOST=tcp://docker-socket-proxy:2375
networks:
- dozzle-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-dozzle
security_opt:
- no-new-privileges:true
networks:
- dozzle-internal
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- INFO=1
- EVENTS=1
- ALLOW_LOGS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
dozzle-internal:
name: dozzle-internal
``` ```
::note
Dozzle only ever reads container logs, so this config sits **Docker Socket Proxy** in front of the Docker API instead of mounting `/var/run/docker.sock` directly, keeping `POST` disabled entirely: Dozzle can list containers and stream their logs, and nothing else.
::
::tip{icon=""} ::tip{icon=""}
✨ __Tip:__ Add the watchtower label to each container to automate updates ✨ __Tip:__ Add the watchtower label to each container to automate updates
+42 -3
View File
@@ -53,13 +53,35 @@ services:
network_mode: host network_mode: host
volumes: volumes:
- ./socket:/beszel_socket - ./socket:/beszel_socket
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
LISTEN: /beszel_socket/beszel.sock LISTEN: /beszel_socket/beszel.sock
DOCKER_HOST: tcp://127.0.0.1:2375
# Do not remove quotes around the key # Do not remove quotes around the key
KEY: ${KEY} KEY: ${KEY}
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-beszel
security_opt:
- no-new-privileges:true
ports:
- 127.0.0.1:2375:2375
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
``` ```
::note
`beszel-agent` runs with `network_mode: host`, so it can't join a dedicated internal network like the other proxied stacks on this site; instead, **Docker Socket Proxy** publishes its API on `127.0.0.1` only, reachable from the agent via the host's own loopback interface, with just `CONTAINERS=1` enabled since the agent only needs to read container stats.
::
::tip{icon=""} ::tip{icon=""}
✨ __Tip:__ Add the Watchtower label to each container to automate updates. ✨ __Tip:__ Add the Watchtower label to each container to automate updates.
@@ -122,11 +144,28 @@ services:
container_name: beszel-agent container_name: beszel-agent
restart: unless-stopped restart: unless-stopped
network_mode: host network_mode: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
LISTEN: ${PORT} LISTEN: ${PORT}
KEY: ${KEY} KEY: ${KEY}
DOCKER_HOST: tcp://127.0.0.1:2375
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-beszel
security_opt:
- no-new-privileges:true
ports:
- 127.0.0.1:2375:2375
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
``` ```
And in `.env`: And in `.env`:
@@ -19,7 +19,7 @@ Authentik also supports multi-factor authentication, including TOTP (a code gene
It's a great alternative to VPNs for securely exposing services, especially ones that lack MFA or login protection (e.g., the SWAG dashboard). It's a great alternative to VPNs for securely exposing services, especially ones that lack MFA or login protection (e.g., the SWAG dashboard).
Authentik has [extensive documentation](https://docs.goauthentik.io/docs/installation/docker-compose) and [great tutorials from Cooptonian](https://www.youtube.com/@cooptonian). Here, well cover the basics using Dockge as an example. Authentik has [extensive documentation](https://docs.goauthentik.io/install-config/install/docker-compose) and [great tutorials from Cooptonian](https://www.youtube.com/@cooptonian). Here, well cover the basics using Dockge as an example.
There are two main modes you should know: There are two main modes you should know:
@@ -156,24 +156,54 @@ services:
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
# `user: root` and the docker socket volume are optional. # `user: root` and the Docker integration below are optional, only needed if you
# See more for the docker socket integration here: # want Authentik to auto-manage embedded outposts on this host. See:
# https://goauthentik.io/docs/outposts/integrations/docker # https://goauthentik.io/docs/outposts/integrations/docker
# Removing `user: root` also prevents the worker from fixing the permissions # Removing `user: root` also prevents the worker from fixing the permissions
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID # on the mounted folders, so when removing this make sure the folders have the correct UID/GID
# (1000:1000 by default) # (1000:1000 by default)
user: root user: root
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./media:/media - ./media:/media
- ./certs:/certs - ./certs:/certs
- ./custom-templates:/templates - ./custom-templates:/templates
- ./ssh:/authentik/.ssh - ./ssh:/authentik/.ssh
networks:
- default
- authentik-internal
env_file: env_file:
- .env - .env
depends_on: depends_on:
- postgresql - postgresql
- redis - redis
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-authentik
security_opt:
- no-new-privileges:true
networks:
- authentik-internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- INFO=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
authentik-internal:
name: authentik-internal
volumes: volumes:
database: database:
@@ -182,6 +212,10 @@ volumes:
driver: local driver: local
``` ```
::note
This adds **Docker Socket Proxy** so the optional Docker integration never needs `/var/run/docker.sock` mounted directly into the worker. If you enable it, set the connection's Docker URL in the admin UI to `http://docker-socket-proxy:2375` instead of the local socket path, as [Authentik's own docs recommend](https://goauthentik.io/docs/outposts/integrations/docker) for socket-proxy setups.
::
### Begin the initial setup ### Begin the initial setup
In the `.env` file, the `PG_PASS` and `AUTHENTIK_SECRET_KEY` variables are already set. In the `.env` file, the `PG_PASS` and `AUTHENTIK_SECRET_KEY` variables are already set.
@@ -322,7 +356,7 @@ Go to _Settings_, click the _MFA_ section, then _Register_. Choose a method like
Youll now be prompted to enter a one-time code at every login. Youll now be prompted to enter a one-time code at every login.
## Protecting a Native App ## Protecting a Native App
Authentik is natively compatible with several applications. You can find the list and [support here](https://docs.goauthentik.io/integrations/services/). Authentik is natively compatible with several applications. You can find the list and [support here](https://integrations.goauthentik.io/).
## Protecting an App via Reverse Proxy ## Protecting an App via Reverse Proxy
SWAG lets you insert Authentiks login page between a request and access to your service. To do this: SWAG lets you insert Authentiks login page between a request and access to your service. To do this:
@@ -436,9 +470,9 @@ We assume youve already installed [Docker](/serveex/core/docker) and [SWAG](/
### Create the stack folder ### Create the stack folder
On your remote machine, use [Dockge](/serveex/core/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs) to create a stack named `authentik-outpost`. On your remote machine, use [Dockge](/serveex/core/docker/#install-dockge-to-manage-and-deploy-containers) to create a stack named `authentik-outpost`.
If you havent installed [Dockge](/serveex/core/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), create a folder `/srv/docker/authentik-outpost`, or directly via command line: If you havent installed [Dockge](/serveex/core/docker/#install-dockge-to-manage-and-deploy-containers), create a folder `/srv/docker/authentik-outpost`, or directly via command line:
```bash [Terminal] ```bash [Terminal]
sudo mkdir -P /srv/docker/authentik-outpost sudo mkdir -P /srv/docker/authentik-outpost
@@ -515,7 +549,7 @@ We assume the Dockge network name is `authentik-outpost_default`.
### Restart SWAG ### Restart SWAG
If using [Dockge](/serveex/core/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), restart SWAG. If using [Dockge](/serveex/core/docker/#install-dockge-to-manage-and-deploy-containers), restart SWAG.
Otherwise, via terminal: Otherwise, via terminal:
+2 -2
View File
@@ -6,7 +6,7 @@ description: Install Arcane, a modern Docker and Compose management web UI, as a
:ellipsis{left=0px width=40rem top=10rem blur=140px zIndex=60} :ellipsis{left=0px width=40rem top=10rem blur=140px zIndex=60}
::note{to="/serveex/core/docker#installer-dockge-pour-gérer-et-déployer-les-conteneurs"} ::note{to="/serveex/core/docker#install-dockge-to-manage-and-deploy-containers"}
This is an advanced alternative to **Dockge**: it can manage several remote Docker hosts from a single instance, and supports OIDC login natively instead of relying on a separate forward-auth proxy. This is an advanced alternative to **Dockge**: it can manage several remote Docker hosts from a single instance, and supports OIDC login natively instead of relying on a separate forward-auth proxy.
:: ::
@@ -72,7 +72,7 @@ services:
docker-socket-proxy: docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest image: lscr.io/linuxserver/socket-proxy:latest
container_name: arcane-docker-proxy container_name: docker-socket-proxy-arcane
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
networks: networks:
+77 -4
View File
@@ -94,15 +94,52 @@ services:
container_name: dockge container_name: dockge
ports: ports:
- 3555:5001 # le port accessible sur le réseau local sera 3555 - 3555:5001 # le port accessible sur le réseau local sera 3555
environment:
- DOCKER_HOST=tcp://docker-socket-proxy:2375
- DOCKGE_STACKS_DIR=/srv/docker
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /srv/docker/dockge/data:/app/data - /srv/docker/dockge/data:/app/data
- /srv/docker:/srv/docker - /srv/docker:/srv/docker
networks:
- dockge-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-dockge
security_opt:
- no-new-privileges:true
networks:
- dockge-internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
- DOCKGE_STACKS_DIR=/srv/docker - CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- VOLUMES=1
- EXEC=1
- INFO=1
- SYSTEM=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
dockge-internal:
name: dockge-internal
``` ```
::warning
Dockge a besoin d'accéder à l'API Docker pour gérer toutes les autres stacks de ce serveur, ce qui équivaut à un accès root sur l'hôte. Plutôt que de monter directement `/var/run/docker.sock`, cette config place **Docker Socket Proxy** devant, qui n'autorise que les permissions dont Dockge a réellement besoin (conteneurs, images, réseaux, volumes, exec, actions de cycle de vie), sur leur propre réseau interne. Dockge n'a pas d'authentification intégrée par défaut, n'exposez donc jamais le port `3555` au-delà de votre réseau local sans le placer derrière [TinyAuth](/serveex/security/tinyauth) ou [Authentik](/serveex/advanced/authentik).
::
Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et :kbd{value="Ctrl+X"} pour quitter. Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et :kbd{value="Ctrl+X"} pour quitter.
#### Lancer le conteneur #### Lancer le conteneur
@@ -149,12 +186,44 @@ services:
- WATCHTOWER_LABEL_ENABLE=true - WATCHTOWER_LABEL_ENABLE=true
- WATCHTOWER_CLEANUP=true - WATCHTOWER_CLEANUP=true
- WATCHTOWER_REMOVE_VOLUMES=true - WATCHTOWER_REMOVE_VOLUMES=true
- DOCKER_HOST=tcp://docker-socket-proxy:2375
# Notifications Discord - décommentez si utilisées # Notifications Discord - décommentez si utilisées
#- WATCHTOWER_NOTIFICATIONS=slack #- WATCHTOWER_NOTIFICATIONS=slack
#- WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=Watchtower #- WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=Watchtower
#- WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=${WH_URL} #- WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=${WH_URL}
networks:
- watchtower-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-watchtower
security_opt:
- no-new-privileges:true
networks:
- watchtower-internal
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- VOLUMES=1
- INFO=1
- SYSTEM=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
watchtower-internal:
name: watchtower-internal
``` ```
::warning ::warning
@@ -162,6 +231,10 @@ services:
`WATCHTOWER_REMOVE_VOLUMES=true` supprime les volumes anonymes d'un conteneur dès qu'il est mis à jour. Combiné à un tag `latest`, une mise à jour automatique peut silencieusement effacer les données de toute app qui stocke encore quelque chose dans un volume anonyme (sans nom) plutôt qu'un bind mount. `WATCHTOWER_REMOVE_VOLUMES=true` supprime les volumes anonymes d'un conteneur dès qu'il est mis à jour. Combiné à un tag `latest`, une mise à jour automatique peut silencieusement effacer les données de toute app qui stocke encore quelque chose dans un volume anonyme (sans nom) plutôt qu'un bind mount.
:: ::
::note
Cette config place **Docker Socket Proxy** devant l'API Docker plutôt que de monter directement `/var/run/docker.sock`, afin que Watchtower n'obtienne que les permissions dont il a réellement besoin (lister/tirer les images, recréer les conteneurs) plutôt qu'un accès root complet à l'hôte.
::
#### Renseigner vos variables d'environnement #### Renseigner vos variables d'environnement
Remplissez la section `.env` dans Dockge avec ce qui suit : Remplissez la section `.env` dans Dockge avec ce qui suit :
+35 -4
View File
@@ -43,10 +43,41 @@ services:
- .env - .env
environment: environment:
- DOZZLE_HOSTNAME=${DOMAIN} - DOZZLE_HOSTNAME=${DOMAIN}
- DOCKER_HOST=tcp://docker-socket-proxy:2375
networks:
- dozzle-internal
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-dozzle
security_opt:
- no-new-privileges:true
networks:
- dozzle-internal
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- INFO=1
- EVENTS=1
- ALLOW_LOGS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
dozzle-internal:
name: dozzle-internal
``` ```
::note
Dozzle ne fait que lire les logs des conteneurs, donc cette config place **Docker Socket Proxy** devant l'API Docker plutôt que de monter directement `/var/run/docker.sock`, en gardant `POST` totalement désactivé : Dozzle peut lister les conteneurs et streamer leurs logs, rien de plus.
::
::tip{icon=""} ::tip{icon=""}
✨ __Astuce :__ ajoutez le label watchtower à chaque conteneur pour automatiser les mises à jour ✨ __Astuce :__ ajoutez le label watchtower à chaque conteneur pour automatiser les mises à jour
@@ -189,7 +220,7 @@ Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et
Et voilà, Dozzle est maintenant exposé ! Et voilà, Dozzle est maintenant exposé !
## Protéger Dozzle avec TinyAuth ## Protéger Dozzle avec TinyAuth
Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `dozzle.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy) : Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `dozzle.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protéger-une-application-via-le-reverse-proxy) :
```nginx [dozzle.subdomain.conf]{26-38,41-42} ```nginx [dozzle.subdomain.conf]{26-38,41-42}
## Version 2023/12/19 ## Version 2023/12/19
@@ -259,11 +290,11 @@ server {
} }
``` ```
::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} ::note{to="/serveex/security/tinyauth#exposer-tinyauth-avec-swag"}
Le bloc `location /tinyauth` s'exécute dans le conteneur de SWAG lui-même, SWAG doit donc être sur le réseau Docker de TinyAuth pour le joindre par son nom (`tinyauth` ici). Cela devrait déjà être en place depuis **l'exposition de TinyAuth**. Si vous rencontrez une erreur, revérifiez que le fichier compose de SWAG a toujours ce réseau rattaché. Le bloc `location /tinyauth` s'exécute dans le conteneur de SWAG lui-même, SWAG doit donc être sur le réseau Docker de TinyAuth pour le joindre par son nom (`tinyauth` ici). Cela devrait déjà être en place depuis **l'exposition de TinyAuth**. Si vous rencontrez une erreur, revérifiez que le fichier compose de SWAG a toujours ce réseau rattaché.
:: ::
::tip{icon=""} ::tip{icon=""}
✨ __Astuce :__ vous pouvez protéger cette application avec [Authentik](/serveex/advanced/authentik) plutôt que TinyAuth, en ouvrant `dozzle.subdomain.conf` et en retirant le `#` devant `include /config/nginx/authentik-server.conf;`{lang=nginx} et `include /config/nginx/authentik-location.conf;`{lang=nginx}. N'oubliez pas de [créer une application et un provider dans Authentik](/serveex/advanced/authentik#protecting-an-app-via-reverse-proxy). ✨ __Astuce :__ vous pouvez protéger cette application avec [Authentik](/serveex/advanced/authentik) plutôt que TinyAuth, en ouvrant `dozzle.subdomain.conf` et en retirant le `#` devant `include /config/nginx/authentik-server.conf;`{lang=nginx} et `include /config/nginx/authentik-location.conf;`{lang=nginx}. N'oubliez pas de [créer une application et un provider dans Authentik](/serveex/advanced/authentik#protéger-une-app-par-reverse-proxy).
:: ::
+45 -6
View File
@@ -53,13 +53,35 @@ services:
network_mode: host network_mode: host
volumes: volumes:
- ./socket:/beszel_socket - ./socket:/beszel_socket
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
LISTEN: /beszel_socket/beszel.sock LISTEN: /beszel_socket/beszel.sock
DOCKER_HOST: tcp://127.0.0.1:2375
# Ne retirez pas les guillemets autour de la clé # Ne retirez pas les guillemets autour de la clé
KEY: ${KEY} KEY: ${KEY}
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-beszel
security_opt:
- no-new-privileges:true
ports:
- 127.0.0.1:2375:2375
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
``` ```
::note
`beszel-agent` tourne avec `network_mode: host`, il ne peut donc pas rejoindre un réseau interne dédié comme les autres stacks proxifiées de ce site ; à la place, **Docker Socket Proxy** publie son API sur `127.0.0.1` uniquement, joignable depuis l'agent via l'interface de loopback de l'hôte, avec seulement `CONTAINERS=1` activé puisque l'agent n'a besoin que de lire les statistiques des conteneurs.
::
::tip{icon=""} ::tip{icon=""}
✨ __Astuce :__ ajoutez le label Watchtower à chaque conteneur pour automatiser les mises à jour. ✨ __Astuce :__ ajoutez le label Watchtower à chaque conteneur pour automatiser les mises à jour.
@@ -122,11 +144,28 @@ services:
container_name: beszel-agent container_name: beszel-agent
restart: unless-stopped restart: unless-stopped
network_mode: host network_mode: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
LISTEN: ${PORT} LISTEN: ${PORT}
KEY: ${KEY} KEY: ${KEY}
DOCKER_HOST: tcp://127.0.0.1:2375
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-beszel
security_opt:
- no-new-privileges:true
ports:
- 127.0.0.1:2375:2375
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
``` ```
Et dans le `.env` : Et dans le `.env` :
@@ -253,7 +292,7 @@ Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et
Et voilà ! Beszel est maintenant exposé ! Et voilà ! Beszel est maintenant exposé !
## Protéger Beszel avec TinyAuth ## Protéger Beszel avec TinyAuth
Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `beszel.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy) : Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `beszel.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protéger-une-application-via-le-reverse-proxy) :
```nginx [beszel.subdomain.conf]{26-38,41-42} ```nginx [beszel.subdomain.conf]{26-38,41-42}
## Version 2023/12/19 ## Version 2023/12/19
@@ -316,11 +355,11 @@ server {
} }
``` ```
::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} ::note{to="/serveex/security/tinyauth#exposer-tinyauth-avec-swag"}
Le bloc `location /tinyauth` s'exécute dans le conteneur de SWAG lui-même, SWAG doit donc être sur le réseau Docker de TinyAuth pour le joindre par son nom (`tinyauth` ici). Cela devrait déjà être en place depuis **l'exposition de TinyAuth**. Si vous rencontrez une erreur, revérifiez que le fichier compose de SWAG a toujours ce réseau rattaché. Le bloc `location /tinyauth` s'exécute dans le conteneur de SWAG lui-même, SWAG doit donc être sur le réseau Docker de TinyAuth pour le joindre par son nom (`tinyauth` ici). Cela devrait déjà être en place depuis **l'exposition de TinyAuth**. Si vous rencontrez une erreur, revérifiez que le fichier compose de SWAG a toujours ce réseau rattaché.
:: ::
::tip{icon=""} ::tip{icon=""}
✨ Vous pouvez protéger cette application avec [Authentik](/serveex/advanced/authentik) plutôt que TinyAuth, en ouvrant `beszel.subdomain.conf` et en retirant le `#` devant `include /config/nginx/authentik-server.conf;` et `include /config/nginx/authentik-location.conf;`. N'oubliez pas de [créer une application et un provider dans Authentik](/serveex/advanced/authentik#protecting-an-app-via-reverse-proxy). ✨ Vous pouvez protéger cette application avec [Authentik](/serveex/advanced/authentik) plutôt que TinyAuth, en ouvrant `beszel.subdomain.conf` et en retirant le `#` devant `include /config/nginx/authentik-server.conf;` et `include /config/nginx/authentik-location.conf;`. N'oubliez pas de [créer une application et un provider dans Authentik](/serveex/advanced/authentik#protéger-une-app-par-reverse-proxy).
:: ::
+46 -11
View File
@@ -19,7 +19,7 @@ Authentik gère aussi l'authentification multifacteur, dont le TOTP (un code gé
C'est une excellente alternative au VPN pour exposer des services en toute sécurité, en particulier ceux qui n'ont ni MFA ni protection de connexion (le tableau de bord de SWAG par exemple). C'est une excellente alternative au VPN pour exposer des services en toute sécurité, en particulier ceux qui n'ont ni MFA ni protection de connexion (le tableau de bord de SWAG par exemple).
Authentik dispose d'une [documentation fournie](https://docs.goauthentik.io/docs/installation/docker-compose) et de [très bons tutoriels de Cooptonian](https://www.youtube.com/@cooptonian). Ici, nous verrons les bases en prenant Dockge comme exemple. Authentik dispose d'une [documentation fournie](https://docs.goauthentik.io/install-config/install/docker-compose) et de [très bons tutoriels de Cooptonian](https://www.youtube.com/@cooptonian). Ici, nous verrons les bases en prenant Dockge comme exemple.
Il y a deux modes principaux à connaître : Il y a deux modes principaux à connaître :
@@ -156,24 +156,55 @@ services:
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik} AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik} AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
# `user: root` and the docker socket volume are optional. # `user: root` et l'intégration Docker ci-dessous sont optionnels, uniquement
# See more for the docker socket integration here: # nécessaires si vous voulez qu'Authentik gère automatiquement des outposts
# intégrés sur cet hôte. Voir :
# https://goauthentik.io/docs/outposts/integrations/docker # https://goauthentik.io/docs/outposts/integrations/docker
# Removing `user: root` also prevents the worker from fixing the permissions # Retirer `user: root` empêche aussi le worker de corriger les permissions
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID # sur les dossiers montés, donc si vous le retirez, assurez-vous que ces
# (1000:1000 by default) # dossiers ont le bon UID/GID (1000:1000 par défaut)
user: root user: root
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./media:/media - ./media:/media
- ./certs:/certs - ./certs:/certs
- ./custom-templates:/templates - ./custom-templates:/templates
- ./ssh:/authentik/.ssh - ./ssh:/authentik/.ssh
networks:
- default
- authentik-internal
env_file: env_file:
- .env - .env
depends_on: depends_on:
- postgresql - postgresql
- redis - redis
- docker-socket-proxy
docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
container_name: docker-socket-proxy-authentik
security_opt:
- no-new-privileges:true
networks:
- authentik-internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
- IMAGES=1
- NETWORKS=1
- INFO=1
- POST=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
restart: unless-stopped
read_only: true
tmpfs:
- /run
networks:
authentik-internal:
name: authentik-internal
volumes: volumes:
database: database:
@@ -182,6 +213,10 @@ volumes:
driver: local driver: local
``` ```
::note
Ceci ajoute **Docker Socket Proxy** pour que l'intégration Docker optionnelle n'ait jamais besoin de `/var/run/docker.sock` monté directement dans le worker. Si vous l'activez, définissez l'URL Docker de la connexion dans l'interface d'administration sur `http://docker-socket-proxy:2375` plutôt que le chemin du socket local, comme le recommande [la documentation d'Authentik](https://goauthentik.io/docs/outposts/integrations/docker) pour les configurations avec socket-proxy.
::
### Démarrer la configuration initiale ### Démarrer la configuration initiale
Dans le fichier `.env`, les variables `PG_PASS` et `AUTHENTIK_SECRET_KEY` sont déjà renseignées. Dans le fichier `.env`, les variables `PG_PASS` et `AUTHENTIK_SECRET_KEY` sont déjà renseignées.
@@ -322,7 +357,7 @@ Allez dans _Settings_, cliquez sur la section _MFA_, puis sur _Register_. Choisi
Un code à usage unique vous sera désormais demandé à chaque connexion. Un code à usage unique vous sera désormais demandé à chaque connexion.
## Protéger une app native ## Protéger une app native
Authentik est nativement compatible avec plusieurs applications. Vous trouverez la liste et [le support ici](https://docs.goauthentik.io/integrations/services/). Authentik est nativement compatible avec plusieurs applications. Vous trouverez la liste et [le support ici](https://integrations.goauthentik.io/).
## Protéger une app par reverse proxy ## Protéger une app par reverse proxy
SWAG permet d'insérer la page de connexion d'Authentik entre une requête et l'accès à votre service. Pour cela : SWAG permet d'insérer la page de connexion d'Authentik entre une requête et l'accès à votre service. Pour cela :
@@ -458,7 +493,7 @@ En ligne de commande :
```bash [Terminal] ```bash [Terminal]
sudo nano /srv/docker/authentik-outpost/compose.yaml sudo nano /srv/docker/authentik-outpost/compose.yaml
``` ```
Collez la configuration suivante, en mettant à jour la version dans `{AUTHENTIK_TAG:proxy:2024.2.3}`{lang=properties} pour correspondre à celle de votre serveur Authentik. Collez la configuration suivante, en mettant à jour la version dans `ghcr.io/goauthentik/proxy:2026.2`{lang=properties} pour correspondre à celle de votre serveur Authentik.
```yaml [compose.yaml] ```yaml [compose.yaml]
--- ---
@@ -466,7 +501,7 @@ version: "3.5"
services: services:
authentik_proxy: authentik_proxy:
container_name: authentik-outpost container_name: authentik-outpost
image: ghcr.io/goauthentik/proxy:2024.2.3 image: ghcr.io/goauthentik/proxy:2026.2
# Optionally specify which networks the container should be # Optionally specify which networks the container should be
# might be needed to reach the core authentik server # might be needed to reach the core authentik server
restart: unless-stopped restart: unless-stopped
@@ -585,7 +620,7 @@ Enregistrez avec :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"}, et quittez avec
### Terminé ! ### Terminé !
:: ::
Configurez ensuite les applications à protéger comme vous l'avez fait sur votre serveur principal, qu'elles soient [natives](/serveex/advanced/authentik/#protecting-a-native-app) ou protégées via [reverse proxy](/serveex/advanced/authentik#protecting-an-app-via-reverse-proxy). Configurez ensuite les applications à protéger comme vous l'avez fait sur votre serveur principal, qu'elles soient [natives](/serveex/advanced/authentik/#protecting-a-native-app) ou protégées via [reverse proxy](/serveex/advanced/authentik#protéger-une-app-par-reverse-proxy).
## Migrer une base de données Authentik ## Migrer une base de données Authentik
+3 -3
View File
@@ -72,7 +72,7 @@ services:
docker-socket-proxy: docker-socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest image: lscr.io/linuxserver/socket-proxy:latest
container_name: arcane-docker-proxy container_name: docker-socket-proxy-arcane
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
networks: networks:
@@ -248,7 +248,7 @@ Et voilà ! Arcane est maintenant accessible depuis internet.
## Connecter un hôte distant ## Connecter un hôte distant
Arcane peut gérer plusieurs hôtes Docker depuis une seule instance. Chaque hôte distant fait tourner un conteneur **agent** léger qui se reconnecte à Arcane. Plutôt que d'exposer cette connexion sur internet, nous la ferons passer par le [VPN WireGuard](/serveex/core/wireguard) déjà mis en place plus tôt, ainsi le trafic de l'agent ne quitte jamais votre réseau privé. Arcane peut gérer plusieurs hôtes Docker depuis une seule instance. Chaque hôte distant fait tourner un conteneur **agent** léger qui se reconnecte à Arcane. Plutôt que d'exposer cette connexion sur internet, nous la ferons passer par le [VPN WireGuard](/serveex/core/wireguard) déjà mis en place plus tôt, ainsi le trafic de l'agent ne quitte jamais votre réseau privé.
::note{to="/serveex/core/wireguard#client-server-setup"} ::note{to="/serveex/core/wireguard#sur-le-serveur-client"}
Ceci suppose que l'hôte Arcane et l'hôte distant font déjà tourner leur propre client WireGuard, connectés à votre VPN comme décrit dans **Client Server Setup**. Notez l'adresse VPN que wg-easy a attribuée à l'__hôte Arcane__ (par exemple `10.8.0.3`) ; c'est l'adresse que visera l'agent distant ci-dessous. Ceci suppose que l'hôte Arcane et l'hôte distant font déjà tourner leur propre client WireGuard, connectés à votre VPN comme décrit dans **Client Server Setup**. Notez l'adresse VPN que wg-easy a attribuée à l'__hôte Arcane__ (par exemple `10.8.0.3`) ; c'est l'adresse que visera l'agent distant ci-dessous.
:: ::
@@ -299,7 +299,7 @@ Arcane gère OIDC nativement, vous pouvez donc exiger une connexion Pocket ID av
::steps{level="3"} ::steps{level="3"}
### Enregistrer Arcane comme client OIDC ### Enregistrer Arcane comme client OIDC
[Enregistrez un client OIDC dans Pocket ID](/serveex/security/pocket-id#registering-an-oidc-client) nommé `arcane`, avec cette URL de callback : [Enregistrez un client OIDC dans Pocket ID](/serveex/security/pocket-id#enregistrer-un-client-oidc) nommé `arcane`, avec cette URL de callback :
```text ```text
https://arcane.mondomaine.fr/auth/oidc/callback https://arcane.mondomaine.fr/auth/oidc/callback