From 4e8a68c33097b0c9e1b228a207a3273c5603282e Mon Sep 17 00:00:00 2001 From: Djeex Date: Mon, 30 Nov 2026 13:59:20 +0000 Subject: [PATCH] Use SWAG tinyauth include files in the TinyAuth setups --- content/en/3.serveex/3.security/3.tinyauth.md | 60 +++++++------------ .../3.serveex/4.monitoring/1.uptime-kuma.md | 25 +++----- content/en/3.serveex/4.monitoring/2.dozzle.md | 23 ++----- .../4.monitoring/3.speedtest-tracker.md | 23 ++----- content/en/3.serveex/4.monitoring/4.beszel.md | 23 ++----- content/en/3.serveex/4.monitoring/5.upsnap.md | 23 ++----- content/en/3.serveex/5.media/2.qbittorrent.md | 23 ++----- content/en/3.serveex/5.media/3.servarr.md | 23 ++----- .../7.files/1.file-browser-quantum.md | 23 ++----- .../3.serveex/8.development/1.code-server.md | 23 ++----- .../en/3.serveex/8.development/3.it-tools.md | 23 ++----- content/en/3.serveex/9.apps/1.adguard.md | 29 +++------ .../6.recycled/2.deprecated/2.file-browser.md | 23 ++----- content/fr/3.serveex/3.security/3.tinyauth.md | 60 +++++++------------ .../3.serveex/4.monitoring/1.uptime-kuma.md | 25 +++----- content/fr/3.serveex/4.monitoring/2.dozzle.md | 23 ++----- .../4.monitoring/3.speedtest-tracker.md | 23 ++----- content/fr/3.serveex/4.monitoring/4.beszel.md | 23 ++----- content/fr/3.serveex/4.monitoring/5.upsnap.md | 23 ++----- content/fr/3.serveex/5.media/2.qbittorrent.md | 23 ++----- content/fr/3.serveex/5.media/3.servarr.md | 23 ++----- .../7.files/1.file-browser-quantum.md | 23 ++----- .../3.serveex/8.development/1.code-server.md | 23 ++----- .../fr/3.serveex/8.development/3.it-tools.md | 23 ++----- content/fr/3.serveex/9.apps/1.adguard.md | 29 +++------ .../6.recycled/2.deprecated/2.file-browser.md | 23 ++----- 26 files changed, 192 insertions(+), 496 deletions(-) diff --git a/content/en/3.serveex/3.security/3.tinyauth.md b/content/en/3.serveex/3.security/3.tinyauth.md index 9f66d5e..faf0886 100644 --- a/content/en/3.serveex/3.security/3.tinyauth.md +++ b/content/en/3.serveex/3.security/3.tinyauth.md @@ -189,11 +189,15 @@ sudo nano /srv/docker/swag/config/nginx/proxy-confs/tinyauth.subdomain.conf Paste the following configuration: ```nginx [tinyauth.subdomain.conf] -## Version 2023/12/19 +## Version 2025/07/18 +# make sure that your tinyauth container is named tinyauth +# make sure that your dns has a cname set for tinyauth server { listen 443 ssl; +# listen 443 quic; listen [::]:443 ssl; +# listen [::]:443 quic; server_name tinyauth.*; @@ -202,12 +206,14 @@ server { client_max_body_size 0; location / { + include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app tinyauth; set $upstream_port 3000; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; + } } ``` @@ -227,7 +233,7 @@ __If it fails:__ check your firewall rules. :: ## Protecting an app via reverse proxy -SWAG doesn't ship a ready-made include file for TinyAuth, so we'll add the forward-auth check directly to the app's own `*.subdomain.conf`. We'll use Dockge as an example. +SWAG ships ready-made include files for TinyAuth: `tinyauth-server.conf` (the internal `/tinyauth` check, to include in the `server` block) and `tinyauth-location.conf` (the `auth_request` itself, to include in the `location` block). All that's left is to uncomment two lines in the app's own `*.subdomain.conf`. We'll use Dockge as an example. ::steps{level="3"} ### Open the app's subdomain.conf file @@ -236,11 +242,11 @@ SWAG doesn't ship a ready-made include file for TinyAuth, so we'll add the forwa sudo nano /srv/docker/swag/config/nginx/proxy-confs/dockge.subdomain.conf ``` -### Add the forward-auth check +### Enable the TinyAuth includes -Add an internal `/tinyauth` location, and reference it from the app's `location /` block with `auth_request`: +Uncomment the `tinyauth-server.conf` include in the `server` block, and the `tinyauth-location.conf` include in the `location /` block: -```nginx [dockge.subdomain.conf]{9-11,25} +```nginx [dockge.subdomain.conf]{11,14} server { listen 443 ssl; listen [::]:443 ssl; @@ -251,23 +257,10 @@ server { client_max_body_size 0; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -281,7 +274,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. Also make sure the container is named `tinyauth`, since the include files rely on that name. :: Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit. @@ -289,7 +282,7 @@ Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ct ### Done! :: -That's it! Visiting `https://dockge.mydomain.com` now redirects to TinyAuth first. Repeat this `location /tinyauth` / `auth_request` pattern in any other app's `*.subdomain.conf` to protect it the same way. +That's it! Visiting `https://dockge.mydomain.com` now redirects to TinyAuth first, which sends you back once you're logged in. The include also forwards the authenticated user to the app in the `Remote-User`, `Remote-Email`, `Remote-Name` and `Remote-Groups` headers, for apps that can use them. Uncomment the same two lines in any other app's `*.subdomain.conf` to protect it the same way. ::note @@ -299,11 +292,11 @@ Repeat this process for each app you want to protect (unless it has native OIDC ## Leaving specific paths public Sometimes you want most of an app locked behind TinyAuth, but a handful of paths left open, for example a public status page, or the API endpoints a mobile app relies on. Unlike Authentik, TinyAuth has no built-in "authenticated paths" setting for this: it's a plain nginx problem, and it's solved with nginx's own location matching. -A regex `location` block always takes priority over the plain `location /` block, no matter which one appears first in the file. So any path matched by a regex location you define runs its own `proxy_pass`, without ever reaching the `auth_request /tinyauth;` line in `location /`. +A regex `location` block always takes priority over the plain `location /` block, no matter which one appears first in the file. So any path matched by a regex location you define runs its own `proxy_pass`, without ever reaching the `include /config/nginx/tinyauth-location.conf;` line in `location /`. For example, here's how to leave Uptime-Kuma's public status page and its assets open while protecting everything else. Only `api/status-page` is left public, not all of `/api`, since the rest of Uptime-Kuma's API is meant to stay behind authentication; `/metrics` (Uptime-Kuma's Prometheus endpoint) is left out of the regex entirely for the same reason: -```nginx [uptime-kuma.subdomain.conf]{9-16} +```nginx [uptime-kuma.subdomain.conf]{11-18} server { listen 443 ssl; listen [::]:443 ssl; @@ -312,6 +305,8 @@ server { include /config/nginx/ssl.conf; + include /config/nginx/tinyauth-server.conf; + location ~ ^/(status|assets|icon\.svg|api/status-page|upload) { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -321,23 +316,8 @@ server { proxy_pass $upstream_proto://$upstream_app:$upstream_port; } - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } - location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; diff --git a/content/en/3.serveex/4.monitoring/1.uptime-kuma.md b/content/en/3.serveex/4.monitoring/1.uptime-kuma.md index 34ba014..3dad5ac 100644 --- a/content/en/3.serveex/4.monitoring/1.uptime-kuma.md +++ b/content/en/3.serveex/4.monitoring/1.uptime-kuma.md @@ -192,9 +192,9 @@ sudo nano /srv/docker/swag/config/nginx/proxy-confs/stats.subdomain.conf ### Add the forward-auth check and public paths -Replace the file's content with the following. The `location ~ ^/(...)` block matches Uptime-Kuma's public status page and its assets, and is served directly, without ever reaching the `auth_request` check in `location /`. Only `api/status-page` is left public, not all of `/api`, since the rest of Uptime-Kuma's API is meant to stay behind authentication; `/metrics` (Uptime-Kuma's Prometheus endpoint) is left out of the regex entirely for the same reason: +Replace the file's content with the following. The `location ~ ^/(...)` block matches Uptime-Kuma's public status page and its assets, and is served directly, without ever reaching the TinyAuth check in `location /`. Only `api/status-page` is left public, not all of `/api`, since the rest of Uptime-Kuma's API is meant to stay behind authentication; `/metrics` (Uptime-Kuma's Prometheus endpoint) is left out of the regex entirely for the same reason: -```nginx [stats.subdomain.conf]{9-16,32-33} +```nginx [stats.subdomain.conf]{9-16,18-19,22-23} server { listen 443 ssl; listen [::]:443 ssl; @@ -212,23 +212,12 @@ server { proxy_pass $upstream_proto://$upstream_app:$upstream_port; } - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -242,7 +231,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit. diff --git a/content/en/3.serveex/4.monitoring/2.dozzle.md b/content/en/3.serveex/4.monitoring/2.dozzle.md index 377ac2a..d665862 100644 --- a/content/en/3.serveex/4.monitoring/2.dozzle.md +++ b/content/en/3.serveex/4.monitoring/2.dozzle.md @@ -224,7 +224,7 @@ And there you go, Dozzle is now exposed! ## Protecting Dozzle with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `dozzle.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [dozzle.subdomain.conf]{26-38,41-42} +```nginx [dozzle.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -250,23 +250,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -294,7 +283,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/4.monitoring/3.speedtest-tracker.md b/content/en/3.serveex/4.monitoring/3.speedtest-tracker.md index a5ad5e9..52a324b 100644 --- a/content/en/3.serveex/4.monitoring/3.speedtest-tracker.md +++ b/content/en/3.serveex/4.monitoring/3.speedtest-tracker.md @@ -202,7 +202,7 @@ Wait a moment, then visit `https://speedtest.yourdomain.com` in your browser. Yo ## Protecting Speedtest Tracker with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `speedtest.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [speedtest.subdomain.conf]{22-34,37-38} +```nginx [speedtest.subdomain.conf]{22-23,26-27} ## Version 2023/12/19 server { @@ -224,23 +224,12 @@ server { #include /config/nginx/authelia-server.conf; #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # Basic auth #auth_basic "Restricted"; @@ -264,7 +253,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/4.monitoring/4.beszel.md b/content/en/3.serveex/4.monitoring/4.beszel.md index 3b5dc47..b71109e 100644 --- a/content/en/3.serveex/4.monitoring/4.beszel.md +++ b/content/en/3.serveex/4.monitoring/4.beszel.md @@ -294,7 +294,7 @@ That’s it! Beszel is now exposed! ## Protecting Beszel with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `beszel.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [beszel.subdomain.conf]{26-38,41-42} +```nginx [beszel.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -320,23 +320,12 @@ server { # enable for Authentik #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; #auth_basic "Restricted"; #auth_basic_user_file /config/nginx/.htpasswd; @@ -357,7 +346,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/4.monitoring/5.upsnap.md b/content/en/3.serveex/4.monitoring/5.upsnap.md index c52feb6..b0d0359 100644 --- a/content/en/3.serveex/4.monitoring/5.upsnap.md +++ b/content/en/3.serveex/4.monitoring/5.upsnap.md @@ -196,7 +196,7 @@ And that’s it! You’ve exposed UpSnap! ## Protecting UpSnap with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `upsnap.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [upsnap.subdomain.conf]{26-38,41-42} +```nginx [upsnap.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -222,23 +222,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -266,7 +255,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/5.media/2.qbittorrent.md b/content/en/3.serveex/5.media/2.qbittorrent.md index 9610d74..f663902 100644 --- a/content/en/3.serveex/5.media/2.qbittorrent.md +++ b/content/en/3.serveex/5.media/2.qbittorrent.md @@ -339,7 +339,7 @@ Wait a few minutes, then go to `https://seedbox.mydomain.com`. You should land o ## Protecting qBittorrent with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `seedbox.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [seedbox.subdomain.conf]{26-38,41-42} +```nginx [seedbox.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -365,23 +365,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -409,7 +398,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/5.media/3.servarr.md b/content/en/3.serveex/5.media/3.servarr.md index b0bc226..2e0c326 100644 --- a/content/en/3.serveex/5.media/3.servarr.md +++ b/content/en/3.serveex/5.media/3.servarr.md @@ -516,7 +516,7 @@ And there you go, Seerr is now publicly accessible! ## Protecting Seerr with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `films.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy). The web UI (`/`) gets the check; `/api` is left out, since Seerr's own API calls (and anything integrating with it) can't do an interactive browser login: -```nginx [films.subdomain.conf]{24-36,39-40} +```nginx [films.subdomain.conf]{24-25,28-29} ## Version 2024/07/16 # make sure that your seerr container is named seerr # make sure that your dns has a cname set for seerr @@ -540,23 +540,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -594,7 +583,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/7.files/1.file-browser-quantum.md b/content/en/3.serveex/7.files/1.file-browser-quantum.md index 41d869c..b660f66 100644 --- a/content/en/3.serveex/7.files/1.file-browser-quantum.md +++ b/content/en/3.serveex/7.files/1.file-browser-quantum.md @@ -212,7 +212,7 @@ That's it! File Browser Quantum is now exposed. ## Protecting File Browser Quantum with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `fbq.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [fbq.subdomain.conf]{22-34,37-38} +```nginx [fbq.subdomain.conf]{22-23,26-27} ## Version 2023/12/19 server { @@ -234,23 +234,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -277,7 +266,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/8.development/1.code-server.md b/content/en/3.serveex/8.development/1.code-server.md index 01e0214..aa4a28a 100644 --- a/content/en/3.serveex/8.development/1.code-server.md +++ b/content/en/3.serveex/8.development/1.code-server.md @@ -228,7 +228,7 @@ That’s it! code-server is now exposed! ## Protecting code-server with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `code.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [code.subdomain.conf]{26-38,41-42} +```nginx [code.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -254,23 +254,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -297,7 +286,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/8.development/3.it-tools.md b/content/en/3.serveex/8.development/3.it-tools.md index 9841d0d..e474f26 100644 --- a/content/en/3.serveex/8.development/3.it-tools.md +++ b/content/en/3.serveex/8.development/3.it-tools.md @@ -167,7 +167,7 @@ And that’s it! IT Tools is now exposed! ## Protecting IT Tools with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `tools.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [tools.subdomain.conf]{26-38,41-42} +```nginx [tools.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -193,23 +193,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -237,7 +226,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/3.serveex/9.apps/1.adguard.md b/content/en/3.serveex/9.apps/1.adguard.md index 4ed3c4f..79d6ea1 100644 --- a/content/en/3.serveex/9.apps/1.adguard.md +++ b/content/en/3.serveex/9.apps/1.adguard.md @@ -240,9 +240,9 @@ server { :: ## Protecting AdGuard with TinyAuth -Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `adguard.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy). The `/dns-query` location is left out of the `auth_request` check, since DNS-over-HTTPS clients can't do an interactive login: +Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `adguard.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy). The `/dns-query` location is left out of the TinyAuth check, since DNS-over-HTTPS clients can't do an interactive login: -```nginx [adguard.subdomain.conf]{28-40,43-44,69-70} +```nginx [adguard.subdomain.conf]{28-29,32-33,58-59} ## Version 2023/05/31 # make sure that your adguard container is named adguard # make sure that your dns has a cname set for adguard @@ -270,23 +270,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -311,8 +300,8 @@ server { } location /control { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -339,7 +328,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/en/6.recycled/2.deprecated/2.file-browser.md b/content/en/6.recycled/2.deprecated/2.file-browser.md index 2d20c34..a0d513d 100644 --- a/content/en/6.recycled/2.deprecated/2.file-browser.md +++ b/content/en/6.recycled/2.deprecated/2.file-browser.md @@ -171,7 +171,7 @@ That’s it! File Browser is now exposed! ## Protecting File Browser with TinyAuth Add [TinyAuth](/serveex/security/tinyauth)'s forward-auth check directly to `files.subdomain.conf`, the same way as [the TinyAuth guide](/serveex/security/tinyauth#protecting-an-app-via-reverse-proxy): -```nginx [files.subdomain.conf]{26-38,41-42} +```nginx [files.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -197,23 +197,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mydomain.com/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -240,7 +229,7 @@ server { ::note{to="/serveex/security/tinyauth#exposing-tinyauth-with-swag"} -The `location /tinyauth` block runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. +The `/tinyauth` check runs inside SWAG's own container, so SWAG needs to be on TinyAuth's Docker network to reach it by name (`tinyauth` here). This should already be set up from **exposing TinyAuth itself**. If you run into an error, double-check SWAG's compose file still has that network attached. :: ::tip{icon=""} diff --git a/content/fr/3.serveex/3.security/3.tinyauth.md b/content/fr/3.serveex/3.security/3.tinyauth.md index f49354c..8c37e77 100644 --- a/content/fr/3.serveex/3.security/3.tinyauth.md +++ b/content/fr/3.serveex/3.security/3.tinyauth.md @@ -189,11 +189,15 @@ sudo nano /srv/docker/swag/config/nginx/proxy-confs/tinyauth.subdomain.conf Collez la configuration suivante : ```nginx [tinyauth.subdomain.conf] -## Version 2023/12/19 +## Version 2025/07/18 +# make sure that your tinyauth container is named tinyauth +# make sure that your dns has a cname set for tinyauth server { listen 443 ssl; +# listen 443 quic; listen [::]:443 ssl; +# listen [::]:443 quic; server_name tinyauth.*; @@ -202,12 +206,14 @@ server { client_max_body_size 0; location / { + include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; set $upstream_app tinyauth; set $upstream_port 3000; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; + } } ``` @@ -227,7 +233,7 @@ __Si ça ne marche pas :__ vérifiez les règles de votre pare-feu. :: ## Protéger une application via le reverse proxy -SWAG ne fournit pas de fichier d'inclusion tout prêt pour TinyAuth, nous ajouterons donc la vérification forward-auth directement dans le `*.subdomain.conf` de l'application. Nous prendrons Dockge en exemple. +SWAG fournit des fichiers d'inclusion tout prêts pour TinyAuth : `tinyauth-server.conf` (la vérification interne `/tinyauth`, à inclure dans le bloc `server`) et `tinyauth-location.conf` (l'`auth_request` elle-même, à inclure dans le bloc `location`). Il suffit de décommenter deux lignes dans le `*.subdomain.conf` de l'application. Nous prendrons Dockge en exemple. ::steps{level="3"} ### Ouvrir le fichier subdomain.conf de l'application @@ -236,11 +242,11 @@ SWAG ne fournit pas de fichier d'inclusion tout prêt pour TinyAuth, nous ajoute sudo nano /srv/docker/swag/config/nginx/proxy-confs/dockge.subdomain.conf ``` -### Ajouter la vérification forward-auth +### Activer les inclusions TinyAuth -Ajoutez un bloc `location /tinyauth` interne, et référencez-le depuis le bloc `location /` de l'application avec `auth_request` : +Décommentez l'inclusion `tinyauth-server.conf` dans le bloc `server`, et l'inclusion `tinyauth-location.conf` dans le bloc `location /` : -```nginx [dockge.subdomain.conf]{9-11,25} +```nginx [dockge.subdomain.conf]{11,14} server { listen 443 ssl; listen [::]:443 ssl; @@ -251,23 +257,10 @@ server { client_max_body_size 0; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -281,7 +274,7 @@ server { ::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é. +La vérification `/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é. Assurez-vous aussi que le conteneur s'appelle bien `tinyauth`, car les fichiers d'inclusion reposent sur ce nom. :: Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et :kbd{value="Ctrl+X"} pour quitter. @@ -289,7 +282,7 @@ Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et ### Terminé ! :: -Et voilà ! Visiter `https://dockge.mondomaine.fr` redirige désormais d'abord vers TinyAuth. Répétez ce motif `location /tinyauth` / `auth_request` dans le `*.subdomain.conf` de n'importe quelle autre application pour la protéger de la même façon. +Et voilà ! Visiter `https://dockge.mondomaine.fr` redirige désormais d'abord vers TinyAuth, qui vous renvoie vers l'application une fois connecté. L'inclusion transmet aussi l'utilisateur authentifié à l'application dans les en-têtes `Remote-User`, `Remote-Email`, `Remote-Name` et `Remote-Groups`, pour les applications qui savent les exploiter. Décommentez les mêmes deux lignes dans le `*.subdomain.conf` de n'importe quelle autre application pour la protéger de la même façon. ::note @@ -299,11 +292,11 @@ Répétez cette procédure pour chaque application que vous voulez protéger (sa ## Laisser certains chemins publics Il arrive qu'on veuille verrouiller l'essentiel d'une application derrière TinyAuth, mais laisser une poignée de chemins ouverts, par exemple une page de statut publique, ou les endpoints d'API sur lesquels une application mobile s'appuie. Contrairement à Authentik, TinyAuth n'a pas de réglage intégré de « chemins authentifiés » pour ça : c'est un simple problème nginx, et il se résout avec le système de correspondance de `location` de nginx. -Un bloc `location` en expression régulière est toujours prioritaire sur le bloc `location /` simple, quel que soit celui qui apparaît en premier dans le fichier. Tout chemin correspondant à une location en regex que vous définissez exécute donc son propre `proxy_pass`, sans jamais atteindre la ligne `auth_request /tinyauth;` du `location /`. +Un bloc `location` en expression régulière est toujours prioritaire sur le bloc `location /` simple, quel que soit celui qui apparaît en premier dans le fichier. Tout chemin correspondant à une location en regex que vous définissez exécute donc son propre `proxy_pass`, sans jamais atteindre la ligne `include /config/nginx/tinyauth-location.conf;` du `location /`. Par exemple, voici comment laisser ouverte la page de statut publique d'Uptime-Kuma et ses ressources tout en protégeant le reste. Seul `api/status-page` est laissé public, pas tout `/api`, car le reste de l'API d'Uptime-Kuma doit rester derrière l'authentification ; `/metrics` (l'endpoint Prometheus d'Uptime-Kuma) est volontairement absent de la regex pour la même raison : -```nginx [uptime-kuma.subdomain.conf]{9-16} +```nginx [uptime-kuma.subdomain.conf]{11-18} server { listen 443 ssl; listen [::]:443 ssl; @@ -312,6 +305,8 @@ server { include /config/nginx/ssl.conf; + include /config/nginx/tinyauth-server.conf; + location ~ ^/(status|assets|icon\.svg|api/status-page|upload) { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -321,23 +316,8 @@ server { proxy_pass $upstream_proto://$upstream_app:$upstream_port; } - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } - location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; diff --git a/content/fr/3.serveex/4.monitoring/1.uptime-kuma.md b/content/fr/3.serveex/4.monitoring/1.uptime-kuma.md index d946a84..0ec9bb7 100644 --- a/content/fr/3.serveex/4.monitoring/1.uptime-kuma.md +++ b/content/fr/3.serveex/4.monitoring/1.uptime-kuma.md @@ -192,9 +192,9 @@ sudo nano /srv/docker/swag/config/nginx/proxy-confs/stats.subdomain.conf ### Ajouter la vérification forward-auth et les chemins publics -Remplacez le contenu du fichier par ce qui suit. Le bloc `location ~ ^/(...)` correspond à la page de statut publique d'Uptime-Kuma et à ses ressources, et est servi directement, sans jamais atteindre la vérification `auth_request` du `location /`. Seul `api/status-page` est laissé public, pas tout `/api`, car le reste de l'API d'Uptime-Kuma doit rester derrière l'authentification ; `/metrics` (l'endpoint Prometheus d'Uptime-Kuma) est volontairement absent de la regex pour la même raison : +Remplacez le contenu du fichier par ce qui suit. Le bloc `location ~ ^/(...)` correspond à la page de statut publique d'Uptime-Kuma et à ses ressources, et est servi directement, sans jamais atteindre la vérification TinyAuth du `location /`. Seul `api/status-page` est laissé public, pas tout `/api`, car le reste de l'API d'Uptime-Kuma doit rester derrière l'authentification ; `/metrics` (l'endpoint Prometheus d'Uptime-Kuma) est volontairement absent de la regex pour la même raison : -```nginx [stats.subdomain.conf]{9-16,32-33} +```nginx [stats.subdomain.conf]{9-16,18-19,22-23} server { listen 443 ssl; listen [::]:443 ssl; @@ -212,23 +212,12 @@ server { proxy_pass $upstream_proto://$upstream_app:$upstream_port; } - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -242,7 +231,7 @@ server { ::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é. +La vérification `/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é. :: Appuyez sur :kbd{value="Ctrl+O"}, puis :kbd{value="Enter"} pour enregistrer, et :kbd{value="Ctrl+X"} pour quitter. diff --git a/content/fr/3.serveex/4.monitoring/2.dozzle.md b/content/fr/3.serveex/4.monitoring/2.dozzle.md index 67b00e0..2d1c9e5 100644 --- a/content/fr/3.serveex/4.monitoring/2.dozzle.md +++ b/content/fr/3.serveex/4.monitoring/2.dozzle.md @@ -224,7 +224,7 @@ Et voilà, Dozzle est maintenant exposé ! ## 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#protéger-une-application-via-le-reverse-proxy) : -```nginx [dozzle.subdomain.conf]{26-38,41-42} +```nginx [dozzle.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -250,23 +250,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -294,7 +283,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/4.monitoring/3.speedtest-tracker.md b/content/fr/3.serveex/4.monitoring/3.speedtest-tracker.md index 41da074..3f0c7ad 100644 --- a/content/fr/3.serveex/4.monitoring/3.speedtest-tracker.md +++ b/content/fr/3.serveex/4.monitoring/3.speedtest-tracker.md @@ -202,7 +202,7 @@ Patientez un instant, puis visitez `https://speedtest.mondomaine.fr` dans votre ## Protéger Speedtest Tracker avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `speedtest.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 [speedtest.subdomain.conf]{22-34,37-38} +```nginx [speedtest.subdomain.conf]{22-23,26-27} ## Version 2023/12/19 server { @@ -224,23 +224,12 @@ server { #include /config/nginx/authelia-server.conf; #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # Basic auth #auth_basic "Restricted"; @@ -264,7 +253,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/4.monitoring/4.beszel.md b/content/fr/3.serveex/4.monitoring/4.beszel.md index 8be690b..bcd7a3f 100644 --- a/content/fr/3.serveex/4.monitoring/4.beszel.md +++ b/content/fr/3.serveex/4.monitoring/4.beszel.md @@ -294,7 +294,7 @@ Et voilà ! Beszel est maintenant exposé ! ## 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#protéger-une-application-via-le-reverse-proxy) : -```nginx [beszel.subdomain.conf]{26-38,41-42} +```nginx [beszel.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -320,23 +320,12 @@ server { # enable for Authentik #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; #auth_basic "Restricted"; #auth_basic_user_file /config/nginx/.htpasswd; @@ -357,7 +346,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/4.monitoring/5.upsnap.md b/content/fr/3.serveex/4.monitoring/5.upsnap.md index 0c5cc36..24d3cce 100644 --- a/content/fr/3.serveex/4.monitoring/5.upsnap.md +++ b/content/fr/3.serveex/4.monitoring/5.upsnap.md @@ -196,7 +196,7 @@ Et voilà ! Vous avez exposé UpSnap ! ## Protéger UpSnap avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `upsnap.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 [upsnap.subdomain.conf]{26-38,41-42} +```nginx [upsnap.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -222,23 +222,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -266,7 +255,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/5.media/2.qbittorrent.md b/content/fr/3.serveex/5.media/2.qbittorrent.md index 80437c8..ae6c0c4 100644 --- a/content/fr/3.serveex/5.media/2.qbittorrent.md +++ b/content/fr/3.serveex/5.media/2.qbittorrent.md @@ -339,7 +339,7 @@ Attendez quelques minutes, puis allez sur `https://seedbox.mondomaine.fr`. Vous ## Protéger qBittorrent avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `seedbox.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 [seedbox.subdomain.conf]{26-38,41-42} +```nginx [seedbox.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -365,23 +365,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -409,7 +398,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/5.media/3.servarr.md b/content/fr/3.serveex/5.media/3.servarr.md index 60471a0..d831fc3 100644 --- a/content/fr/3.serveex/5.media/3.servarr.md +++ b/content/fr/3.serveex/5.media/3.servarr.md @@ -516,7 +516,7 @@ Et voilà, Seerr est maintenant accessible publiquement ! ## Protéger Seerr avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `films.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protéger-une-application-via-le-reverse-proxy). L'interface web (`/`) reçoit la vérification, `/api` en est exclu, puisque les appels d'API de Seerr (et tout ce qui s'y intègre) ne peuvent pas faire de connexion interactive dans un navigateur : -```nginx [films.subdomain.conf]{24-36,39-40} +```nginx [films.subdomain.conf]{24-25,28-29} ## Version 2024/07/16 # make sure that your seerr container is named seerr # make sure that your dns has a cname set for seerr @@ -540,23 +540,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -594,7 +583,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/7.files/1.file-browser-quantum.md b/content/fr/3.serveex/7.files/1.file-browser-quantum.md index 9613a92..61473f9 100644 --- a/content/fr/3.serveex/7.files/1.file-browser-quantum.md +++ b/content/fr/3.serveex/7.files/1.file-browser-quantum.md @@ -212,7 +212,7 @@ Et voilà ! File Browser Quantum est maintenant exposé. ## Protéger File Browser Quantum avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `fbq.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 [fbq.subdomain.conf]{22-34,37-38} +```nginx [fbq.subdomain.conf]{22-23,26-27} ## Version 2023/12/19 server { @@ -234,23 +234,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -277,7 +266,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/8.development/1.code-server.md b/content/fr/3.serveex/8.development/1.code-server.md index 3661ba5..a3dcb21 100644 --- a/content/fr/3.serveex/8.development/1.code-server.md +++ b/content/fr/3.serveex/8.development/1.code-server.md @@ -228,7 +228,7 @@ Et voilà ! code-server est maintenant exposé ! ## Protéger code-server avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `code.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 [code.subdomain.conf]{26-38,41-42} +```nginx [code.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -254,23 +254,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -297,7 +286,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/8.development/3.it-tools.md b/content/fr/3.serveex/8.development/3.it-tools.md index c52b7d2..ae74645 100644 --- a/content/fr/3.serveex/8.development/3.it-tools.md +++ b/content/fr/3.serveex/8.development/3.it-tools.md @@ -167,7 +167,7 @@ Et voilà ! IT Tools est maintenant exposé ! ## Protéger IT Tools avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `tools.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 [tools.subdomain.conf]{26-38,41-42} +```nginx [tools.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -193,23 +193,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -237,7 +226,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/3.serveex/9.apps/1.adguard.md b/content/fr/3.serveex/9.apps/1.adguard.md index 4e8427d..49b0dcf 100644 --- a/content/fr/3.serveex/9.apps/1.adguard.md +++ b/content/fr/3.serveex/9.apps/1.adguard.md @@ -240,9 +240,9 @@ server { :: ## Protéger AdGuard avec TinyAuth -Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `adguard.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protéger-une-application-via-le-reverse-proxy). Le `location /dns-query` est laissé en dehors de la vérification `auth_request`, puisque les clients DNS-over-HTTPS ne peuvent pas faire de connexion interactive : +Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `adguard.subdomain.conf`, de la même façon que dans [le tutoriel TinyAuth](/serveex/security/tinyauth#protéger-une-application-via-le-reverse-proxy). Le `location /dns-query` est laissé en dehors de la vérification TinyAuth, puisque les clients DNS-over-HTTPS ne peuvent pas faire de connexion interactive : -```nginx [adguard.subdomain.conf]{28-40,43-44,69-70} +```nginx [adguard.subdomain.conf]{28-29,32-33,58-59} ## Version 2023/05/31 # make sure that your adguard container is named adguard # make sure that your dns has a cname set for adguard @@ -270,23 +270,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -311,8 +300,8 @@ server { } location /control { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; @@ -339,7 +328,7 @@ server { ::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é. +La vérification `/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=""} diff --git a/content/fr/6.recycled/2.deprecated/2.file-browser.md b/content/fr/6.recycled/2.deprecated/2.file-browser.md index ff13ea5..7e60a73 100644 --- a/content/fr/6.recycled/2.deprecated/2.file-browser.md +++ b/content/fr/6.recycled/2.deprecated/2.file-browser.md @@ -171,7 +171,7 @@ Et voilà ! File Browser est maintenant exposé ! ## Protéger File Browser avec TinyAuth Ajoutez la vérification forward-auth de [TinyAuth](/serveex/security/tinyauth) directement dans `files.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 [files.subdomain.conf]{26-38,41-42} +```nginx [files.subdomain.conf]{26-27,30-31} ## Version 2023/12/19 server { @@ -197,23 +197,12 @@ server { # enable for Authentik (requires authentik-location.conf in the location block) #include /config/nginx/authentik-server.conf; - location /tinyauth { - internal; - proxy_pass http://tinyauth:3000/api/auth/nginx; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header X-Forwarded-Uri $request_uri; - } - - location @tinyauth_login { - return 302 https://tinyauth.mondomaine.fr/login?redirect_uri=$scheme://$http_host$request_uri; - } + # enable for Tinyauth (requires tinyauth-location.conf in the location block) + include /config/nginx/tinyauth-server.conf; location / { - auth_request /tinyauth; - error_page 401 = @tinyauth_login; + # enable for Tinyauth (requires tinyauth-server.conf in the server block) + include /config/nginx/tinyauth-location.conf; # enable the next two lines for http auth #auth_basic "Restricted"; @@ -240,7 +229,7 @@ server { ::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é. +La vérification `/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=""}