Translation #2

This commit is contained in:
2025-07-03 20:22:12 +00:00
parent 675ecaee3a
commit acdebcb682
15 changed files with 874 additions and 1054 deletions

View File

@ -8,39 +8,37 @@ main:
# Authentik
::alert{type="info"}
🎯 __Objectifs :__
- Installer et exposer Authentik
- Paramétrer le Multi-Facteur
- Protéger une app native ou via reverse proxy
🎯 __Objectives:__
- Install and expose Authentik
- Configure Multi-Factor Authentication (MFA)
- Protect a native app or an app behind a reverse proxy
::
[Authentik](https://goauthentik.io) est un outil d'authentification unique permettant de vous logger une seule fois sur les plateformes compatibles OpenID. Il permet également de sécuriser l'accès aux services que vous exposez, en s'injectant via SWAG aux requetes vers vos services.
[Authentik](https://goauthentik.io) is a single sign-on (SSO) tool that allows you to log in once to all platforms compatible with OpenID. It can also secure access to your exposed services by injecting itself via SWAG into requests to those services.
Ainsi, si vous exposez Dockge sur internet via `dockge.mondomaine.fr`, au moment de l'accès à cette page, vous tomberez sur une page de login d'authentik. Si vous avez déjà été identifié sur un autre service sécurisé par authentik auparavant, alors vous serez déjà identifié. cela permet d'avoir à vous identifiez qu'une seule fois par jour sur l'ensemble des services protégés par authentik.
For example, if you're exposing Dockge online at `dockge.mydomain.com`, youll first land on an Authentik login page when accessing it. If you've already authenticated with another Authentik-protected service, you wont need to log in again. This allows you to authenticate only once per day for all protected services.
Authentik permet aussi d'utiliser le multi-facteur, notamment par TOTP (code généré par une application d'authentification de votre choix. Enfin, authentik permet aussi de se connecter directement via un compte Microsoft ou Google, si vous avez configuré une application d'un de ces services.
Authentik also supports multi-factor authentication, including TOTP (a code generated by the authentication app of your choice). Additionally, it allows login through Microsoft or Google accounts, provided you've configured one of those applications.
C'est une bonne manière de se passer de VPN pour exposer vos services, et d'exposer des services qui ne sont pas protégés par du MFA voir pas protégés par des login (comme le dashboard de swag).
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 dipose d'[une doc très fournie](https://docs.goauthentik.io/docs/installation/docker-compose) et des [fabuleux tuto de Cooptonian](https://www.youtube.com/@cooptonian). Ici, nous montrerons juste les bases, avec l'exemple de l'exposition de Dockge.
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.
Deux modes principaux sont à connaitre:
There are two main modes you should know:
- Le premier permet à une application qui dispose nativement d'une intégration avec du SSO compatible OpenID de se connecter directement à Authentik. C'est la solution à privilégier car elle permet de laisser l'application décider de ce qui est public et de ce qui est protégé.
- The first allows apps with native support for OpenID-compatible SSO to connect directly to Authentik. This is the preferred method, as the app itself decides whats public and whats protected.
![Picture](/img/serveex/auth-native.svg)
- Le second permet d'injecter une authentification via authentik grace à SWAG avant d'arriver sur le service désiré.
- The second method injects Authentik authentication through SWAG before reaching the target service.
![Picture](/img/serveex/auth-proxy.svg)
Les deux modes son configurables application par application.
Both modes can be configured on a per-application basis.
## Installation
---
Structure des dossiers :
Folder structure:
```console
root
└── docker
@ -53,28 +51,29 @@ root
└── ssh
```
Créez les dossiers :
Create the folders:
```shell
sudo mkdir -p /docker/authentik/media /docker/authentik/certs /docker/authentik/custom-template /docker/authentik/ssh
```
Positionnez vous dans le dossier `authentik` et générez un mot de passe et une clé secrete que l'on va intégrer dans le .env :
Navigate to the `authentik` folder and generate a password and secret key to include in the `.env` file:
```shell
sudo echo "PG_PASS=$(openssl rand 36 | base64)" >> .env
sudo echo "AUTHENTIK_SECRET_KEY=$(openssl rand 60 | base64)" >> .env
```
::alert{type="info"}
:::list{type="info"}
- Afin de générer la clé, nous avons créé les dossiers en amont du déploiement via Dockge. Dockge vous empechera de créer une stack du meme nom dans ces dossiers s'il n'existe pas de `compose.yml`. Il faut donc créer un `compose.yml` vide afin que ce dernier la reconnaisse comme existante dans les stacks inactives :
- To generate the keys, we created the folders ahead of deployment using Dockge. Dockge will prevent you from creating a stack with the same name in these folders unless a `compose.yml` file exists. So, create an empty `compose.yml` so it appears as an inactive stack:
:::
```shell
sudo vi /docker/authentik/compose.yml
::
Ouvrez dockge, et cherchez "authentik" dans les stack inactives.
Nommez la stack authentik et collez la configuration suivante, en changeant les chiffres de `{AUTHENTIK_TAG:-2024.2.3}`{lang=properties} par [la dernière version de Authentik](https://version-2024-6.goauthentik.io/docs/releases).
Open Dockge and search for "authentik" in the inactive stacks.
Name the stack `authentik` and paste the following configuration, replacing `{AUTHENTIK_TAG:-2024.2.3}`{lang=properties} with [the latest version of Authentik](https://version-2024-6.goauthentik.io/docs/releases).
```yaml
---
@ -180,59 +179,59 @@ volumes:
driver: local
```
Dans le point `.env`, les variables `PG_PASS` et `AUTHENTIK_SECRET_KEY` sont déjà remplies.
Déployez la stack.
In the `.env` file, the `PG_PASS` and `AUTHENTIK_SECRET_KEY` variables are already set.
Deploy the stack.
Vous pouvez alors commencer le set-up d'authentik en tappant `http://ipduserveur:9000/if/flow/initial-setup/`.
You can then begin the initial setup by visiting:
`http://yourserverip:9000/if/flow/initial-setup/`
::alert{type="warning"}
:::list{type="warning"}
- __Attention :__ il est conseillé de créer un nouveau compte admin, et de **désactiver** le compte admin de base `akadmin`.
- __Warning:__ Its recommended to create a new admin account and **disable** the default `akadmin` account.
:::
::
## Exposer authentik
## Exposing Authentik
---
Pour être utilisable hors de chez vous, vous devez exposer authentik.
To use Authentik outside your local network, you must expose it.
::alert{type="info"}
📋 __Au préalable :__ <br/><br/>
Nous partons du principe quer vous avez créé dans votre [zone DNS](/generalites/dns) un sous domaine du type `auth.mondomaine.fr` avec pour CNAME `mondomaine.fr` et, [à moins que vous utilisiez Cloudflare Zero Trust](/serveex/securite/cloudflare), vous avez déjà redirigé le port `443` de votre box vers le `443` de votre serveur dans [les règles NAT](/generalites/nat).
📋 __Prerequisites:__ <br/><br/>
We assume you have already created a subdomain like `auth.mydomain.com` in your [DNS zone](/generalites/dns), with a CNAME pointing to `mydomain.com`. Also, unless you're using [Cloudflare Zero Trust](/serveex/securite/cloudflare), you must have already forwarded port `443` from your router to port `443` of your server in your [NAT rules](/generalites/nat).
::
Ouvrez le fichier `authentik-server.conf`.
Open the `authentik-server.conf` file:
::alert{type="success"}
✨ __Astuce pour les allergiques au terminal :__
vous pouvez utiliser [File Browser](/serveex/files/file-browser) pour naviguer dans vos fichier et éditer vos documents au lieu d'utiliser les commandes du terminal.
✨ __Tip for those who dislike terminals:__
You can use [File Browser](/serveex/files/file-browser) to navigate and edit files instead of using terminal commands.
::
```shell
sudo vi /docker/swag/config/nginx/authentik-server.conf
```
Vérifiez que dans chaque cas les variables ci-dessous sont correctes :
Verify that the following variables are set correctly:
```nginx
set $upstream_authentik authentik-server;
proxy_pass http://$upstream_authentik:9000;
```
Si ce n'est pas le cas, passez en mode modification en tapant `i` et éditez les. Sauvegardez et quittez en tapant sur `Echap` puis `:x`.
If not, press `i` to enter edit mode, make the necessary changes, then save and exit by pressing `Esc` followed by `:x`.
Créez le fichier `auth.subdomain.conf`
Create the `auth.subdomain.conf` file:
```shell
sudo vi /docker/swag/config/nginx/proxy-confs/auth.subdomain.conf
```
Appuyez sur `i` pour rentrer en mode modification puis collez la configuration suivante :
Press `i` to enter edit mode and paste the following configuration:
```nginx
## Version 2023/05/31
# make sure that your authentik container is named authentik-server
# make sure that your dns has a cname set for authentik
# Ensure your authentik container is named authentik-server
# Ensure your DNS has a CNAME for authentik
server {
listen 443 ssl;
@ -245,14 +244,12 @@ server {
client_max_body_size 0;
location / {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app authentik-server;
set $upstream_port 9000;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location ~ (/authentik)?/api {
@ -262,148 +259,145 @@ server {
set $upstream_port 9000;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
```
Sauvegardez et quittez en appuyant sur `Echap` puis en tapant `:x`.
Save and exit by pressing `Esc` then `:x`.
Rendez-vous dans dockge, et éditez le compose de SWAG en ajoutant le réseau d'Authentik :
Go to Dockge, and edit the SWAG compose file to add the Authentik network:
```yaml
services:
swag:
container_name: # ...
# ...
networks: # Relie le conteneur au réseau custom
# ...
networks: # Attach the container to the custom network
# ...
- authentik # Nom du réseau déclaré dans la stack
networks: # Définit le réseau custom
- authentik # Name of the network declared in the stack
networks: # Define the custom network
# ...
authentik: # Nom du réseau déclaré dans la stack
name: authentik_default # Nom véritable du réseau externe
external: true # Précise que c'est un réseau à rechercher en externe
authentik: # Name of the network declared in the stack
name: authentik_default # Actual name of the external network
external: true # Indicates it's an external network
```
Relancez la stack et patientez le temps que SWAG soit complètement opérationnel.
Restart the stack and wait for SWAG to be fully operational.
Et voilà ! Vous pouvez accéder à authentik via `https://auth.mondomaine.fr`
Done! You can now access Authentik via `https://auth.mydomain.com`
## Activer le multifacteur
## Enable Multifactor Authentication
---
Tout l'intérêt de authentik c'est de disposer du multifacteur pour toutes les apps que l'on protègera.
- Rendez vous sur `https://auth.mondomaine.fr`
- Identifiez-vous
- Rendez-vous dans _paramètres_
- Cliquez sur la section _MFA_
- Cliquez sur _s'inscrire_
- Choisissez une méthode comme _TOTP device_ ( dans ce cas vous devrez utilisez une app d'authentification telle que Google Authenticator par exemple)
- Suivez les étapes
The main value of Authentik is using multifactor authentication for all protected apps.
Et voilà, vous serez invité à saisir un code à usage unique à chaque connexion.
- Go to `https://auth.mydomain.com`
- Log in
- Go to _Settings_
- Click the _MFA_ section
- Click _Register_
- Choose a method like _TOTP device_ (you'll need an authenticator app like Google Authenticator)
- Follow the steps
## Protéger une app native
Youll now be prompted to enter a one-time code at every login.
## Protecting a Native App
---
Authentik est compatible nativement avec un certain nombre d'application, vous retrouverez la liste et [le support ici](https://docs.goauthentik.io/integrations/services/)
Authentik is natively compatible with several applications. You can find the list and [support here](https://docs.goauthentik.io/integrations/services/).
## Protéger une app par reverse proxy
## Protecting an App via Reverse Proxy
---
Swag permet d'intercaler la page d'authentik entre la requête et l'accès à votre service. Pour cela il va falloir :
SWAG lets you insert Authentiks login page between a request and access to your service. To do this:
- Configurer le service d'authentification dans authentik.
- Configurer le fichier proxy du domaine pour que swag puisse intercaler la page.
- Configure the authentication provider in Authentik.
- Edit the domain proxy file so SWAG can intercept the request.
Pourquoi le faire alors que Dockge a déjà une page d'authentification ? Tout simplement parce que l'authentification HTTP utilisée par Dockge est faible. Avec Authentik, vous aurez directement une authentification forte par MFA, et vous serez loggé automatiquement à toutes vos apps déjà protégées par authentik. Cela permet de sécuriser l'accès à Dockge et aux autres apps que vous protégerez, sans avoir à passer par un VPN.
Why do this when Dockge already has authentication? Because Dockge uses weak HTTP authentication. With Authentik, you get strong MFA authentication and automatic login to all apps protected by Authentik. This secures access to Dockge and other apps without needing a VPN.
### Configuration de Authentik
### Configuring Authentik
- Rendez vous dans Authentik
- Allez dans le panneau d'administration
- Sélectionnez _application_ puis _créer avec l'assistant_
- Renseignez les champs comme suit :
- Go to Authentik
- Open the admin panel
- Select _Applications_ then _Create with wizard_
- Fill in the fields as shown:
![Picture](/img/serveex/auth1.png)
- Puis à l'étape suivante choisissez "Transférer l'authentification (application unique)" et éditez comme suit (attention aux flow, c'est important) :
- At the next step, choose "Forward authentication (single application)" and configure it as shown (flows are important):
![Picture](/img/serveex/auth2.png)
- Ensuite, allez dans le menu à gauche dans _Avant-poste_ et éditez _authentik Embedded Outpost_
- Next, go to the _Outposts_ menu on the left and edit _authentik Embedded Outpost_:
![Picture](/img/serveex/auth3.png)
- Ajoutez l'application `dockge` en la faisant passer à droite et validez.
- Add the `dockge` application by moving it to the right column and save.
### Configuration de SWAG
### Configuring SWAG
Ensuite rendez-vous dans le fichier `dockge.mondomaine.fr`.
Edit the file `dockge.mydomain.com`:
```shell
sudo vi /docker/swag/config/nginx/proxy-confs/dockge.subdomain.conf
```
Puis entrez en modification en appuyant sur `i` et enlevez les `#` des deux lignes `#include /config/nginx/authentik-server.conf;`{lang=nginx}.
Press `i` to enter edit mode and uncomment the two lines `#include /config/nginx/authentik-server.conf;`
Appuyez sur `Echap` puis tapez `:x` et appuyez sur `Entrée` pour sauvegarder et quitter.
Press `Esc`, type `:x`, and press `Enter` to save and exit.
Et voilà ! En tapant `https://dockge.mondomaine.fr`, vous tomberez à présent sur la mire d'authentification de authentik.
Done! Now when accessing `https://dockge.mydomain.com`, youll be redirected to the Authentik login screen.
::alert{type="success"}
✨ __Astuce :__ dans Dockge, dans les paramètres, vous pouvez désactiver l'authentification de Dockge afin de ne pas avoir à vous identifier deux fois. **Attention**, cela voudra dire que si vous avez exposé un port sur votre réseau local, il n'y aura plus aucune authentification.
✨ __Tip:__ In Dockge's settings, you can disable Dockge's authentication to avoid double login. **Warning**: this means if the port is open on your local network, there will be no authentication at all.
::
::alert{type="info"}
:::list{type="info"}
- Vous pouvez répétez l'opération pour chaque application que vous souhaitez protéger (si elle ne dipose pas d'intégration directe avec Authentik).
- Repeat this process for each app you want to protect (unless it has native integration with Authentik).
:::
::
Voilà votre nouvelle architecture :
Your new architecture looks like this:
![Picture](/img/serveex/authentik.svg)
## Protéger un service sur un serveur distant
## Protecting a Remote Server Service
---
Dans le cas d'une application [native](/serveex/securite/authentik#protéger-une-app-native) (via OAuth 2.0 ou autre), rien ne change.
Dans le cas d'une application non native à protéger derrière un reverse proxy, vous devrez déployer un __avant-poste__. Un avant-poste est un conteneur qui jouera le rôle de proxy local, c'est à dire que c'est vers ce conteneur que les requêtes d'authentification de vos applications seront redirigées. C'est le seul qui est autorisé à dialoguer avec l'API de votre instance authentik.
For a [native application](/serveex/securite/authentik#protéger-une-app-native) (via OAuth 2.0 or other), nothing changes.
For a non-native app behind a reverse proxy, you must deploy an __Outpost__. An Outpost is a container acting as a local proxy — it's the target of your app's auth requests and the only one authorized to communicate with your Authentik API.
::alert{type="info"}
Pré-requis :
- Avoir installé [docker](/serveex/coeur/docker) sur votre machine distante hébergeant le service à protéger.
- Si l'application n'a pas d'intégration native, avoir un reverse proxy compatible. Comme partout ici, nous utiliserons [SWAG](/serveex/coeur/swag).
::
Prerequisites:
- Install [Docker](/serveex/coeur/docker) on the remote server hosting the service.
- If the app has no native integration, use a compatible reverse proxy. We will use [SWAG](/serveex/coeur/swag) here.
::
Ce conteneur redirigera ensuite les requetes vers votre instance [Authentik](/serveex/securite/authentik#authentik) principale, à travers le web (ou votre réseau local). Le serveur executera les controle et renverra la réponse à l'_avant-poste_, qui bloquera ou non la connexion à l'app protégée.
This container will forward requests to your main [Authentik](/serveex/securite/authentik#authentik) instance over the internet (or your local network). The server will perform checks and respond to the Outpost, which will allow or block access accordingly.
![auth-outpost](/img/serveex/auth-outpost.svg)
### Configuration d'Authentik
### Configuring Authentik
Créez vos [fournisseurs et applications](/serveex/securite/authentik#protéger-une-app-native) comme nous l'avons vu plus haut.
Create your [providers and applications](/serveex/securite/authentik#protéger-une-app-native) as shown earlier.
Puis, dans votre panneau admin, allez dans la rubrique _Applications > Avant-postes_, puis créez un nouvel avant-poste.
Then, in the admin panel, go to _Applications > Outposts_, and create a new outpost.
Remplissez comme suit :
Fill in as follows:
| Field | Value |
|----------------|------------------------------------------------------------------------|
| `Name` | Your preferred name |
| `Type` | `Proxy` |
| `Integration` | Leave empty |
| `Applications` | Select the applications you previously created |
| Champs | Valeur |
|----------------|-----------------------------------------------------------------------|
| `Nom` | Le nom que vous souhaitez |
| `Type` | `Proxy` |
| `Intégration` | Laissez vide |
| `Applications` | Sélectionnez le ou les applications que vous avez créées précédemment |
Dans la section `Paramètres avancés`, supprimez l'existant, et complétez comme suit :
In the `Advanced settings` section, clear the existing content and enter:
```yaml
log_level: info
docker_labels: null
authentik_host: https://domaine_de_votre_serveur_authentik/
authentik_host: https://your_authentik_server_domain/
object_naming_template: ak-outpost-%(name)s
authentik_host_insecure: false
container_image:
@ -412,35 +406,36 @@ docker_map_ports: true
docker_labels: null
```
Enrtegistrez et quittez.
Save and exit.
Sur l'écran affichant les avant-postes créés, vous verrez le nouvel avant-poste que vous venez de créer. A la fin de la ligne, cliquez sur _afficher les informations_, et copiez précieusement le jeton d'accès.
On the list of created outposts, locate the new one and click _Show details_ at the end of the line. Carefully copy the access token.
### Configuration de la machine distante
Nous partons du principe que vous avez déjà installé [Docker](/serveex/coeur/docker) et [SWAG](/serveex/coeur/swag) sur cette machine distante.
### Configuring the Remote Machine
Sur votre machine distante, à l'aide de [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), créez une stack `authentik-outpost`.
We assume youve already installed [Docker](/serveex/coeur/docker) and [SWAG](/serveex/coeur/swag) on this remote machine.
Si vous n'avez pas installé [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), créez un dossier `/docker/authentik-outpost`, ou directement en ligne de commande :
On your remote machine, use [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs) to create a stack named `authentik-outpost`.
If you havent installed [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), create a folder `/docker/authentik-outpost`, or directly via command line:
```shell
sudo mkdir -P /docker/authentik-outpost
```
::alert{type="success"}
✨ __Astuce pour les allergiques au terminal :__
vous pouvez utiliser [File Browser](/serveex/files/file-browser) pour naviguer dans vos fichier et éditer vos documents au lieu d'utiliser les commandes du terminal.
✨ __Tip for terminal-averse users:__
You can use [File Browser](/serveex/files/file-browser) to navigate and edit your files instead of using terminal commands.
::
Créez le fichier `compose.yaml` ou copiez la configuration directement dans le champs si vous avez [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs)
Create the `compose.yaml` file or paste the configuration directly into Dockge if installed.
En ligne de commande :
Via command line:
```shell
sudo vi /docker/authentik-outpost/compose.yaml
```
Entrez en mode modification avec `i` et collez la configuration suivante, en changeant les chiffres de `{AUTHENTIK_TAG:proxy:2024.2.3}`{lang=properties} par la meme version que celle de votre serveur Authentik.
Enter edit mode by pressing `i` and paste the following configuration, updating the version in `{AUTHENTIK_TAG:proxy:2024.2.3}`{lang=properties} to match your Authentik server version.
```yaml
version: "3.5"
@ -453,7 +448,6 @@ services:
restart: unless-stopped
env_file:
- .env
# - foo
ports:
- 9000:9000
- 9443:9443
@ -461,13 +455,9 @@ services:
AUTHENTIK_HOST: ${HOST}
AUTHENTIK_INSECURE: "false"
AUTHENTIK_TOKEN: ${TOKEN}
# Starting with 2021.9, you can optionally set this too
# when authentik_host for internal communication doesn't match the public URL
# AUTHENTIK_HOST_BROWSER: https://external-domain.tld
```
Rendez-vous sur la stack de SWAG de la machine distante (ou remplissez directement si vous avez [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs)) et ajoutez le réseau de authentik-outpost dans le fichier de conf sur ce modele (les champs `networks`) :
Go to the SWAG stack on the remote machine (or edit directly using Dockge) and add the authentik-outpost network in the configuration file like this (see `networks` section):
```shell
sudo vi /docker/swag/compose.yaml
@ -478,110 +468,108 @@ services:
swag:
container_name: #...
# ...
networks: # Relie le conteneur au réseau custom
- authentik-outpost # Nom du réseau déclaré dans la stack
networks: # Définit le réseau custom
networks: # Attach the container to the custom network
- authentik-outpost # Network name as declared in the stack
networks: # Define the custom network
#...
authentik-outpost: # Nom du réseau déclaré dans la stack
name: authentik-outpost_default # Nom véritable du réseau externe
external: true # Précise que c'est un réseau à rechercher en externe
authentik-outpost: # Name of the network declared in the stack
name: authentik-outpost_default # Actual name of the external network
external: true # Marks it as an external network
```
Appuyez sur `Echap` puis tapez `:x` et appuyez sur `Entrée` pour sauvegarder et quitter.
Press `Esc`, then type `:x` and press `Enter` to save and exit.
::alert{type="info"}
:::list{type="info"}
- Ici nous partons du principe que le nom du réseau de dockge est `authentik-outpost_default`.
- We assume the Dockge network name is `authentik-outpost_default`.
:::
::
Si vous avez [Dockge](/serveex/coeur/docker/#installer-dockge-pour-g"rer-et-d"ployer-les-conteneurs), relancez SWAG.
If using [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs), restart SWAG.
Sinon, via le terminal :
Otherwise, via terminal:
```shell
cd /docker/swag/
sudo docker compose up -d
```
Creez (ou remplissez directement si vous avez [Dockge](/serveex/coeur/docker/#installer-dockge-pour-gérer-et-déployer-les-conteneurs)) le fichier `.env` dans le dossier de l'avant poste authentik :
Create (or fill using Dockge) the `.env` file in the `authentik-outpost` directory:
En ligne de commande :
Via command line:
```shell
sudo vi /docker/authentik-outpost/.env
```
Entrez en mode modification avec `i` et collez la configuration suivante
Enter edit mode with `i` and paste the following configuration:
```properties
HOST=
TOKEN=
```
Remplissez comme suit
| Variable | Valeur | Exemple |
|-------------------------|---------------------------------------------------------|----------------------------|
| `HOST`{lang=properties} | L'url de votre serveur authentik | `https://auth.domaine.fr` |
| `TOKEN`{lang=properties} | Le token que vous avez précédemment copié précieusement | `Q2pVEqsTNRkJSO9SkJzU3KZ2` |
Fill in the values:
Appuyez sur `Echap` puis tapez `:x` et appuyez sur `Entrée` pour sauvegarder et quitter.
| Variable | Value | Example |
|----------|-------|---------|
| `HOST`{lang=properties} | The URL of your Authentik server | `https://auth.domain.com` |
| `TOKEN`{lang=properties} | The previously copied access token | `Q2pVEqsTNRkJSO9SkJzU3KZ2` |
Si vous avez [Dockge](/serveex/coeur/docker/#installer-dockge-pour-g"rer-et-d"ployer-les-conteneurs), déployez la stack.
Press `Esc`, then type `:x` and press `Enter` to save and exit.
Sinon, via le terminal :
If using Dockge, deploy the stack.
Otherwise, via terminal:
```shell
cd /docker/authentik-outpost/
sudo docker compose up -d
```
Le conteneur est en route, vous pouvez vérifier son état dans votre panneau admin de votre instance Authentik, section _Applications > Avant-postes_.
The container is now running. You can verify its status from your Authentik instance admin panel under _Applications > Outposts_.
Now, lets configure SWAG.
Nous allons a présent configurer SWAG.
Ouvrez le fichier `authentik-server.conf`.
Open the `authentik-server.conf` file:
```shell
sudo vi /docker/swag/config/nginx/authentik-server.conf
```
Dans le fichier, passez en mode modification en tapant `i` et changez `authentik-server` par `authentik-outpost` comme suit :
In the file, press `i` to enter edit mode and change `authentik-server` to `authentik-outpost` as shown:
```nginx
set $upstream_authentik authentik-outpost;
proxy_pass http://$upstream_authentik:9000;
```
Sauvegardez et quittez en tapant sur `Echap` puis `:x` et sur `Ente`.
Save and exit with `Esc`, then `:x` and `Enter`.
Ensuite, configurez les applications à protéger selon si elles sont [natives](/serveex/securite/authentik#protéger-une-app-native) ou par [proxy](/serveex/securite/authentik#protéger-une-app-par-reverse-proxy) comme vous l'avez fait sur votre serveur principal.
Then configure the applications to protect as you did on your main server, whether they are [native](/serveex/securite/authentik#protéger-une-app-native) or protected via [reverse proxy](/serveex/securite/authentik#protéger-une-app-par-reverse-proxy).
## Migrer une base authentik
## Migrating an Authentik Database
---
Sur la machine d'origine, dumper la bdd :
On the source machine, dump the database:
```shell
sudo docker exec authentik-postgres pg_dump -U authentik -F t authentik > /path/to/mydb.tar
```
Puis l'envoyer sur la machine cible. Sur la machine cible, copier le fichier dans le container docker
Then transfer it to the target machine. On the target machine, copy the file into the Docker container:
```shell
cp /path/to/mydb.tar authentik-postgres:/path/to/wherever
```
(Optionnel) Purgez les tables existantes :
(Optional) Purge existing tables:
```shell
sudo docker exec -i authentik-postgres psql -U authentik -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'authentik' AND pid <> pg_backend_pid();" && \
sudo docker exec -i authentik-postgres psql -U authentik -d postgres -c "DROP DATABASE IF EXISTS authentik;" && \
sudo docker exec -i authentik-postgres psql -U authentik -d postgres -c "CREATE DATABASE authentik;" && \
sudo docker exec -i authentik-postgres psql -U authentik -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'authentik' AND pid <> pg_backend_pid();" && sudo docker exec -i authentik-postgres psql -U authentik -d postgres -c "DROP DATABASE IF EXISTS authentik;" && sudo docker exec -i authentik-postgres psql -U authentik -d postgres -c "CREATE DATABASE authentik;"
```
Restaurez la bdd
Restore the database:
```shell
sudo docker exec authentik-postgresql pg_restore -U authentik -d authentik /path/to/wherever/mydb.tar