Skip to content

Commit 9cdedad

Browse files
authored
Simplify auth configs and include updates for Authelia 4.38
1 parent 2f740e6 commit 9cdedad

5 files changed

Lines changed: 29 additions & 45 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
336336

337337
## Versions
338338

339+
* **13.04.23:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-location.conf, authelia-server.conf, authentik-server.conf - Simplify auth configs and include updates for Authelia 4.38.
339340
* **13.04.23:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, authelia-location.conf, authentik-location.conf, and site-confs/default.conf - Move ssl.conf include to default.conf. Remove Authorization headers in authelia. Sort proxy_set_header in authelia and authentik.
340341
* **25.03.23:** - Fix renewal post hook.
341342
* **10.03.23:** - Cleanup unused csr and keys folders. See [certbot 2.3.0 release notes](https://github.com/certbot/certbot/releases/tag/v2.3.0).

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ app_setup_block: |
154154
155155
# changelog
156156
changelogs:
157+
- { date: "13.04.23:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-location.conf, authelia-server.conf, authentik-server.conf - Simplify auth configs and include updates for Authelia 4.38." }
157158
- { date: "13.04.23:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, authelia-location.conf, authentik-location.conf, and site-confs/default.conf - Move ssl.conf include to default.conf. Remove Authorization headers in authelia. Sort proxy_set_header in authelia and authentik." }
158159
- { date: "25.03.23:", desc: "Fix renewal post hook." }
159160
- { date: "10.03.23:", desc: "Cleanup unused csr and keys folders. See [certbot 2.3.0 release notes](https://github.com/certbot/certbot/releases/tag/v2.3.0)." }

root/defaults/nginx/authelia-location.conf.sample

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## Version 2023/04/13 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-location.conf.sample
1+
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-location.conf.sample
22
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
33
# Rename /config/nginx/proxy-confs/authelia.subdomain.conf.sample to /config/nginx/proxy-confs/authelia.subdomain.conf
44
# Make sure that the authelia configuration.yml has 'path: "authelia"' defined
55

66
## Send a subrequest to Authelia to verify if the user is authenticated and has permission to access the resource.
7-
auth_request /authelia/api/verify;
7+
auth_request /authelia/api/authz/auth-request;
88
## If the subreqest returns 200 pass to the backend, if the subrequest returns 401 redirect to the portal.
99
error_page 401 = @authelia_proxy_signin;
1010

@@ -23,3 +23,6 @@ proxy_set_header Remote-User $user;
2323
## Include the Set-Cookie header if present.
2424
auth_request_set $set_cookie $upstream_http_set_cookie;
2525
add_header Set-Cookie $set_cookie;
26+
27+
## Set $redirection_url to the location header of the response from the auth request
28+
auth_request_set $redirection_url $upstream_http_location;
Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2023/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-server.conf.sample
1+
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-server.conf.sample
22
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
33
# Rename /config/nginx/proxy-confs/authelia.subdomain.conf.sample to /config/nginx/proxy-confs/authelia.subdomain.conf
44
# Make sure that the authelia configuration.yml has 'path: "authelia"' defined
@@ -10,16 +10,6 @@ location ^~ /authelia {
1010
include /config/nginx/resolver.conf;
1111
set $upstream_authelia authelia;
1212
proxy_pass http://$upstream_authelia:9091;
13-
}
14-
15-
# location for authelia auth requests
16-
location = /authelia/api/verify {
17-
internal;
18-
19-
include /config/nginx/proxy.conf;
20-
include /config/nginx/resolver.conf;
21-
set $upstream_authelia authelia;
22-
proxy_pass http://$upstream_authelia:9091/authelia/api/verify;
2313

2414
## Include the Set-Cookie header if present.
2515
auth_request_set $set_cookie $upstream_http_set_cookie;
@@ -33,23 +23,18 @@ location = /authelia/api/verify {
3323
location @authelia_proxy_signin {
3424
internal;
3525

36-
## Set the $target_url variable based on the original request.
37-
set_escape_uri $target_url $scheme://$http_host$request_uri;
38-
3926
## Include the Set-Cookie header if present.
4027
auth_request_set $set_cookie $upstream_http_set_cookie;
4128
add_header Set-Cookie $set_cookie;
4229

43-
## Set $authelia_backend to route requests to the current domain by default
44-
set $authelia_backend $http_host;
45-
## In order for Webauthn to work with multiple domains authelia must operate on a separate subdomain
46-
## To use authelia on a separate subdomain:
47-
## * comment the $authelia_backend line above
48-
## * rename /config/nginx/proxy-confs/authelia.conf.sample to /config/nginx/proxy-confs/authelia.conf
49-
## * make sure that your dns has a cname set for authelia
50-
## * uncomment the $authelia_backend line below and change example.com to your domain
51-
## * restart the swag container
52-
#set $authelia_backend authelia.example.com;
53-
54-
return 302 https://$authelia_backend/authelia/?rd=$target_url;
30+
## Set the $target_url variable based on the original request.
31+
set_escape_uri $target_url $scheme://$http_host$request_uri;
32+
33+
## Set $redirection_url if it is empty
34+
if ($redirection_url = false) {
35+
set $redirection_url https://$http_host/authelia/?rd=$target_url;
36+
}
37+
38+
## Redirect to login
39+
return 302 $redirection_url;
5540
}
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2023/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-server.conf.sample
1+
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-server.conf.sample
22
# Make sure that your authentik container is in the same user defined bridge network and is named authentik-server
33
# Rename /config/nginx/proxy-confs/authentik.subdomain.conf.sample to /config/nginx/proxy-confs/authentik.subdomain.conf
44

@@ -9,16 +9,6 @@ location ^~ /outpost.goauthentik.io {
99
include /config/nginx/resolver.conf;
1010
set $upstream_authentik authentik-server;
1111
proxy_pass http://$upstream_authentik:9000;
12-
}
13-
14-
# location for authentik auth requests
15-
location = /outpost.goauthentik.io/auth/nginx {
16-
internal;
17-
18-
include /config/nginx/proxy.conf;
19-
include /config/nginx/resolver.conf;
20-
set $upstream_authentik authentik-server;
21-
proxy_pass http://$upstream_authentik:9000/outpost.goauthentik.io/auth/nginx;
2212

2313
## Include the Set-Cookie header if present.
2414
auth_request_set $set_cookie $upstream_http_set_cookie;
@@ -32,14 +22,18 @@ location = /outpost.goauthentik.io/auth/nginx {
3222
location @goauthentik_proxy_signin {
3323
internal;
3424

35-
## Set the $target_url variable based on the original request.
36-
set_escape_uri $target_url $scheme://$http_host$request_uri;
37-
3825
## Include the Set-Cookie header if present.
3926
auth_request_set $set_cookie $upstream_http_set_cookie;
4027
add_header Set-Cookie $set_cookie;
4128

42-
## Set $authentik_backend to route requests to the current domain by default
43-
set $authentik_backend $http_host;
44-
return 302 https://$authentik_backend/outpost.goauthentik.io/start?rd=$target_url;
29+
## Set the $target_url variable based on the original request.
30+
set_escape_uri $target_url $scheme://$http_host$request_uri;
31+
32+
## Set $redirection_url if it is empty
33+
if ($redirection_url = false) {
34+
set $redirection_url https://$http_host/outpost.goauthentik.io/start?rd=$target_url;
35+
}
36+
37+
## Redirect to login
38+
return 302 $redirection_url;
4539
}

0 commit comments

Comments
 (0)