mirror of
https://github.com/ImranR98/selfhostingfromscratch.git
synced 2026-04-23 22:38:01 -04:00
Use Authelia for app authentication
This commit is contained in:
45
authelia_config/configuration.yml
Normal file
45
authelia_config/configuration.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
jwt_secret: o1F3utPMgWDabE2QiJCfpmWGLpct+82L1FDAl5EbLKg=
|
||||
|
||||
log:
|
||||
level: debug
|
||||
|
||||
totp:
|
||||
issuer: imranr.cloud
|
||||
|
||||
authentication_backend:
|
||||
file:
|
||||
path: /config/users_database.yml
|
||||
|
||||
access_control:
|
||||
rules:
|
||||
- domain: files.imranr.cloud
|
||||
resources:
|
||||
- '^/share([/?].*)?$'
|
||||
- '^/static([/?].*)?$'
|
||||
- '^/api/public([/?].*)?$'
|
||||
policy: bypass
|
||||
- domain: '*.imranr.cloud'
|
||||
policy: two_factor
|
||||
|
||||
session:
|
||||
secret: NKKxihcGtg7+L4KBOgZ5EkQ+lTbSanRD2h7fyG1kwmU=
|
||||
cookies:
|
||||
- domain: imranr.cloud
|
||||
authelia_url: https://auth.imranr.cloud
|
||||
redis:
|
||||
host: authelia-db
|
||||
port: 6379
|
||||
|
||||
regulation:
|
||||
max_retries: 3
|
||||
find_time: 120
|
||||
ban_time: 300
|
||||
|
||||
storage:
|
||||
encryption_key: 'W51AIX8vy6HngZeH96ZtN05dBrLrF7sLLJxgQWEbnsQ='
|
||||
local:
|
||||
path: /config/db.sqlite3
|
||||
|
||||
notifier:
|
||||
filesystem:
|
||||
filename: /config/notification.txt
|
||||
8
authelia_config/users_database.yml
Normal file
8
authelia_config/users_database.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
users:
|
||||
admin:
|
||||
disabled: false
|
||||
displayname: "Admin"
|
||||
password: "$argon2id$v=19$m=65536,t=3,p=4$JhBeqYrylaX/0+y3F4j1Ow$E48HpwTxF1qdUeRufRp5wCR1Hg/nh1mYohm0pSr4lBo" # docker run -it authelia/authelia:latest authelia crypto hash generate argon2
|
||||
email: contact@imranr.dev
|
||||
groups:
|
||||
- admins
|
||||
@@ -23,9 +23,48 @@ services:
|
||||
- "com.centurylinklabs.watchtower.enable=false"
|
||||
command: "-c /frpc.toml"
|
||||
|
||||
authelia: # https://github.com/authelia/authelia
|
||||
image: authelia/authelia
|
||||
container_name: authelia
|
||||
user: "1000:1000"
|
||||
depends_on:
|
||||
- authelia-db
|
||||
volumes:
|
||||
- ./authelia_config:/config
|
||||
networks:
|
||||
- traefik
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.authelia.rule=Host(`auth.imranr.cloud`)"
|
||||
- "traefik.http.routers.authelia.entryPoints=websecure"
|
||||
- "traefik.http.routers.authelia.tls.certresolver=le"
|
||||
- "traefik.http.routers.authelia.tls=true"
|
||||
- "traefik.http.middlewares.authelia.forwardAuth.address=http://authelia:9091/api/verify?rd=https%3A%2F%2Fauth.imranr.cloud%2F"
|
||||
- "traefik.http.middlewares.authelia.forwardAuth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.authelia.forwardAuth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email"
|
||||
- "traefik.http.middlewares.authelia-basic.forwardAuth.address=http://authelia:9091/api/verify?auth=basic"
|
||||
- "traefik.http.middlewares.authelia-basic.forwardAuth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.authelia-basic.forwardAuth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email"
|
||||
expose:
|
||||
- 9091
|
||||
restart: unless-stopped
|
||||
authelia-db:
|
||||
image: redis:alpine
|
||||
container_name: authelia-db
|
||||
user: "1000:1000"
|
||||
volumes:
|
||||
- authelia_db:/data
|
||||
networks:
|
||||
- traefik
|
||||
expose:
|
||||
- 6379
|
||||
restart: unless-stopped
|
||||
|
||||
traefik: # https://github.com/traefik/traefik
|
||||
image: traefik:latest
|
||||
container_name: traefik
|
||||
depends_on:
|
||||
- authelia
|
||||
command:
|
||||
- "--api=true"
|
||||
- "--api.dashboard=true"
|
||||
@@ -59,6 +98,7 @@ services:
|
||||
- "traefik.http.routers.api.service=api@internal"
|
||||
- "traefik.http.routers.api.tls=true"
|
||||
- "traefik.http.routers.api.tls.certresolver=le"
|
||||
- "traefik.http.routers.api.middlewares=authelia@docker"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- traefik
|
||||
@@ -82,10 +122,12 @@ services:
|
||||
- "traefik.http.routers.filebrowser.tls=true"
|
||||
- "traefik.http.services.filebrowser.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.filebrowser.tls.certresolver=le"
|
||||
- "traefik.http.routers.filebrowser.middlewares=authelia@docker"
|
||||
|
||||
volumes:
|
||||
filebrowser_db:
|
||||
traefik_acme:
|
||||
authelia_db:
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
|
||||
Reference in New Issue
Block a user