Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Commit 03d22ab

Browse files
authored
Merge pull request #460 from linuxserver/authelia
Initial support for Authelia
2 parents a04148c + f75ca59 commit 03d22ab

File tree

6 files changed

+103
-1
lines changed

6 files changed

+103
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
290290

291291
## Versions
292292

293+
* **23.05.20:** - Add support for Authelia.
293294
* **15.05.20:** - Remove `php7-pecl-imagick` due to upstream issues. Add support for `Geoip2` auto db retrieval.
294295
* **10.05.20:** - Added support for fail2ban deny statements.
295296
* **04.05.20:** - Allow for optionally setting propagation time for dns plugins. Add repo version of `whois` to replace the built-in busybox version. Update `jail.local` to change default fail2ban ban action to more widely supported `iptables-allports`.

readme-vars.yml

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ app_setup_nginx_reverse_proxy_block: ""
126126

127127
# changelog
128128
changelogs:
129+
- { date: "23.05.20:", desc: "Add support for Authelia." }
129130
- { date: "15.05.20:", desc: "Remove `php7-pecl-imagick` due to upstream issues. Add support for `Geoip2` auto db retrieval." }
130131
- { date: "10.05.20:", desc: "Added support for fail2ban deny statements." }
131132
- { date: "04.05.20:", desc: "Allow for optionally setting propagation time for dns plugins. Add repo version of `whois` to replace the built-in busybox version. Update `jail.local` to change default fail2ban ban action to more widely supported `iptables-allports`." }

root/defaults/authelia-location.conf

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Version 2020/05/23 - Changelog: https://github.com/linuxserver/docker-letsencrypt/commits/master/root/defaults/authelia-location.conf
2+
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
3+
# Make sure that the authelia configuration.yml has 'path: "authelia"' defined
4+
5+
auth_request /authelia/api/verify;
6+
auth_request_set $target_url $scheme://$http_host$request_uri;
7+
auth_request_set $user $upstream_http_remote_user;
8+
auth_request_set $groups $upstream_http_remote_groups;
9+
proxy_set_header Remote-User $user;
10+
proxy_set_header Remote-Groups $groups;
11+
#if your authelia is set up with 'path: "authelia"', you don't need to modify anything
12+
error_page 401 =302 https://$http_host/authelia/?rd=$target_url;
13+
#if your authelia is set up without a path, comment the line above, uncomment the line below and adjust as necessary
14+
#error_page 401 =302 https://authelia.YOURDOMAIN.com/?rd=$target_url;

root/defaults/authelia-server.conf

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Version 2020/05/23 - Changelog: https://github.com/linuxserver/docker-letsencrypt/commits/master/root/defaults/authelia-server.conf
2+
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
3+
4+
location /authelia {
5+
include /config/nginx/proxy.conf;
6+
resolver 127.0.0.11 valid=30s;
7+
set $upstream_authelia authelia;
8+
proxy_pass http://$upstream_authelia:9091;
9+
}
10+
11+
location /authelia/api/verify {
12+
internal;
13+
resolver 127.0.0.11 valid=30s;
14+
set $upstream_authelia authelia;
15+
proxy_pass_request_body off;
16+
proxy_pass http://$upstream_authelia:9091;
17+
proxy_set_header Content-Length "";
18+
19+
# Timeout if the real server is dead
20+
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
21+
22+
# [REQUIRED] Needed by Authelia to check authorizations of the resource.
23+
# Provide either X-Original-URL and X-Forwarded-Proto or
24+
# X-Forwarded-Proto, X-Forwarded-Host and X-Forwarded-Uri or both.
25+
# Those headers will be used by Authelia to deduce the target url of the user.
26+
# Basic Proxy Config
27+
client_body_buffer_size 128k;
28+
proxy_set_header Host $host;
29+
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
30+
proxy_set_header X-Real-IP $remote_addr;
31+
proxy_set_header X-Forwarded-For $remote_addr;
32+
proxy_set_header X-Forwarded-Proto $scheme;
33+
proxy_set_header X-Forwarded-Host $http_host;
34+
proxy_set_header X-Forwarded-Uri $request_uri;
35+
proxy_set_header X-Forwarded-Ssl on;
36+
proxy_redirect http:// $scheme://;
37+
proxy_http_version 1.1;
38+
proxy_set_header Connection "";
39+
proxy_cache_bypass $cookie_session;
40+
proxy_no_cache $cookie_session;
41+
proxy_buffers 4 32k;
42+
43+
# Advanced Proxy Config
44+
send_timeout 5m;
45+
proxy_read_timeout 240;
46+
proxy_send_timeout 240;
47+
proxy_connect_timeout 240;
48+
}

root/defaults/default

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2020/03/05 - Changelog: https://github.com/linuxserver/docker-letsencrypt/commits/master/root/defaults/default
1+
## Version 2020/05/23 - Changelog: https://github.com/linuxserver/docker-letsencrypt/commits/master/root/defaults/default
22

33
# redirect all traffic to https
44
server {
@@ -27,6 +27,9 @@ server {
2727
# enable for ldap auth
2828
#include /config/nginx/ldap.conf;
2929

30+
# enable for Authelia
31+
#include /config/nginx/authelia-server.conf;
32+
3033
client_max_body_size 0;
3134

3235
location / {
@@ -107,6 +110,37 @@ server {
107110
# }
108111
#}
109112

113+
# sample reverse proxy config for "heimdall" via subdomain, with Authelia
114+
# Authelia container has to be running in the same user defined bridge network, with container name "authelia", and with 'path: "authelia"' set in its configuration.yml
115+
# notice this is a new server block, you need a new server block for each subdomain
116+
#server {
117+
# listen 443 ssl http2;
118+
# listen [::]:443 ssl http2;
119+
#
120+
# root /config/www;
121+
# index index.html index.htm index.php;
122+
#
123+
# server_name heimdall.*;
124+
#
125+
# include /config/nginx/ssl.conf;
126+
#
127+
# include /config/nginx/authelia-server.conf;
128+
#
129+
# client_max_body_size 0;
130+
#
131+
# location / {
132+
# # the next line will enable Authelia along with the included authelia-server.conf in the server block
133+
# include /config/nginx/authelia-location.conf;
134+
#
135+
# include /config/nginx/proxy.conf;
136+
# resolver 127.0.0.11 valid=30s;
137+
# set $upstream_app heimdall;
138+
# set $upstream_port 443;
139+
# set $upstream_proto https;
140+
# proxy_pass $upstream_proto://$upstream_app:$upstream_port;
141+
# }
142+
#}
143+
110144
# enable subdomain method reverse proxy confs
111145
include /config/nginx/proxy-confs/*.subdomain.conf;
112146
# enable proxy cache for auth

root/etc/cont-init.d/50-config

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ cp /config/fail2ban/jail.local /etc/fail2ban/jail.local
7474
cp /defaults/ssl.conf /config/nginx/ssl.conf
7575
[[ ! -f /config/nginx/ldap.conf ]] && \
7676
cp /defaults/ldap.conf /config/nginx/ldap.conf
77+
[[ ! -f /config/nginx/authelia-server.conf ]] && \
78+
cp /defaults/authelia-server.conf /config/nginx/authelia-server.conf
79+
[[ ! -f /config/nginx/authelia-location.conf ]] && \
80+
cp /defaults/authelia-location.conf /config/nginx/authelia-location.conf
7781

7882
# check to make sure DNSPLUGIN is selected if dns validation is used
7983
[[ "$VALIDATION" = "dns" ]] && [[ ! "$DNSPLUGIN" =~ ^(aliyun|cloudflare|cloudxns|cpanel|digitalocean|dnsimple|dnsmadeeasy|domeneshop|gandi|google|inwx|linode|luadns|nsone|ovh|rfc2136|route53|transip)$ ]] && \

0 commit comments

Comments
 (0)