Use SWAG tinyauth include files in the TinyAuth setups
This commit is contained in:
1 parent
fb3db10639
commit
4e8a68c330
26 files changed
+192
-496
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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=""}
|
||||
|
||||
@@ -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=""}
|
||||
|
||||
@@ -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=""}
|
||||
|
||||
@@ -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=""}
|
||||
|
||||
Reference in new issue
Block a user