mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
idp(#62): add unfinished docker-compose attempts
This commit is contained in:
parent
1b52ef1f8a
commit
bec3fee9ee
37
docs/examples/docker/idp-authelia-traefik/README.md
Normal file
37
docs/examples/docker/idp-authelia-traefik/README.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
> [!WARNING]
|
||||||
|
> I am unable to guarantee the quality, safety, and security of anything in this folder; it is a combination of examples I found online. Please submit corrections or improvements 🙏
|
||||||
|
|
||||||
|
to try this out with minimal adjustments:
|
||||||
|
* specify what filesystem-path to share with copyparty, replacing the default/example value `/srv/pub` in `docker-compose.yml`
|
||||||
|
* add `127.0.0.1 fs.example.com traefik.example.com authelia.example.com` to your `/etc/hosts`
|
||||||
|
* `sudo docker-compose up`
|
||||||
|
* login to https://fs.example.com/ with username `authelia` password `authelia`
|
||||||
|
|
||||||
|
to use this in a safe and secure manner:
|
||||||
|
* follow a guide on setting up authelia properly (TODO:link) and use the copyparty-specific parts of this folder as inspiration for your own config; namely the `cpp` subfolder and the `copyparty` service in `docker-compose.yml`
|
||||||
|
|
||||||
|
this folder is based on:
|
||||||
|
* https://github.com/authelia/authelia/tree/39763aaed24c4abdecd884b47357a052b235942d/examples/compose/lite
|
||||||
|
|
||||||
|
incomplete list of modifications made:
|
||||||
|
* support for running with podman as root on fedora (`:z` volumes, `label:disable`)
|
||||||
|
* explicitly using authelia `v4.38.0-beta3` because config syntax changed since last stable release
|
||||||
|
* disabled automatic letsencrypt certificate signing
|
||||||
|
* reduced logging from debug to info
|
||||||
|
* added a warning that traefik is given access to the docker socket (as recommended by traefik docs) which means traefik is able to break out of the container and has full root access on the host machine
|
||||||
|
|
||||||
|
|
||||||
|
# performance
|
||||||
|
|
||||||
|
currently **not optimal,** at least when compared to running the python sfx outside of docker... some numbers from my laptop (ryzen4500u/fedora39):
|
||||||
|
|
||||||
|
| req/s | https D/L | http D/L | approach |
|
||||||
|
| -----:| ----------:|:--------:| -------- |
|
||||||
|
| 5200 | 1294 MiB/s | 5+ GiB/s | [copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py) running on host |
|
||||||
|
| 4370 | 725 MiB/s | 4+ GiB/s | `docker run copyparty/ac` |
|
||||||
|
| 2420 | 694 MiB/s | n/a | `copyparty/ac` behind traefik |
|
||||||
|
| 75 | 694 MiB/s | n/a | traefik and authelia **(you are here)** |
|
||||||
|
|
||||||
|
authelia is behaving strangely, handling 340 requests per second for a while, but then it suddenly drops to 75 and stays there...
|
||||||
|
|
||||||
|
I'm assuming all of the performance issues is due to a misconfiguration of authelia/traefik/docker on my end, but I don't relly know where to start
|
|
@ -0,0 +1,66 @@
|
||||||
|
# based on https://github.com/authelia/authelia/blob/39763aaed24c4abdecd884b47357a052b235942d/examples/compose/lite/authelia/configuration.yml
|
||||||
|
|
||||||
|
# Authelia configuration
|
||||||
|
|
||||||
|
# This secret can also be set using the env variables AUTHELIA_JWT_SECRET_FILE
|
||||||
|
jwt_secret: a_very_important_secret
|
||||||
|
|
||||||
|
server:
|
||||||
|
address: 'tcp://:9091'
|
||||||
|
|
||||||
|
log:
|
||||||
|
level: info # debug
|
||||||
|
|
||||||
|
totp:
|
||||||
|
issuer: authelia.com
|
||||||
|
|
||||||
|
authentication_backend:
|
||||||
|
file:
|
||||||
|
path: /config/users_database.yml
|
||||||
|
|
||||||
|
access_control:
|
||||||
|
default_policy: deny
|
||||||
|
rules:
|
||||||
|
# Rules applied to everyone
|
||||||
|
- domain: traefik.example.com
|
||||||
|
policy: one_factor
|
||||||
|
- domain: fs.example.com
|
||||||
|
policy: one_factor
|
||||||
|
|
||||||
|
session:
|
||||||
|
# This secret can also be set using the env variables AUTHELIA_SESSION_SECRET_FILE
|
||||||
|
secret: unsecure_session_secret
|
||||||
|
|
||||||
|
cookies:
|
||||||
|
- name: authelia_session
|
||||||
|
domain: example.com # Should match whatever your root protected domain is
|
||||||
|
default_redirection_url: https://fs.example.com
|
||||||
|
authelia_url: https://authelia.example.com/
|
||||||
|
expiration: 3600 # 1 hour
|
||||||
|
inactivity: 300 # 5 minutes
|
||||||
|
|
||||||
|
redis:
|
||||||
|
host: redis
|
||||||
|
port: 6379
|
||||||
|
# This secret can also be set using the env variables AUTHELIA_SESSION_REDIS_PASSWORD_FILE
|
||||||
|
# password: authelia
|
||||||
|
|
||||||
|
regulation:
|
||||||
|
max_retries: 3
|
||||||
|
find_time: 120
|
||||||
|
ban_time: 300
|
||||||
|
|
||||||
|
storage:
|
||||||
|
encryption_key: you_must_generate_a_random_string_of_more_than_twenty_chars_and_configure_this
|
||||||
|
local:
|
||||||
|
path: /config/db.sqlite3
|
||||||
|
|
||||||
|
notifier:
|
||||||
|
disable_startup_check: true
|
||||||
|
smtp:
|
||||||
|
username: test
|
||||||
|
# This secret can also be set using the env variables AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE
|
||||||
|
password: password
|
||||||
|
host: mail.example.com
|
||||||
|
port: 25
|
||||||
|
sender: admin@example.com
|
|
@ -0,0 +1,18 @@
|
||||||
|
# based on https://github.com/authelia/authelia/blob/39763aaed24c4abdecd884b47357a052b235942d/examples/compose/lite/authelia/users_database.yml
|
||||||
|
|
||||||
|
# Users Database
|
||||||
|
|
||||||
|
# This file can be used if you do not have an LDAP set up.
|
||||||
|
|
||||||
|
# List of users
|
||||||
|
users:
|
||||||
|
authelia:
|
||||||
|
disabled: false
|
||||||
|
displayname: "Authelia User"
|
||||||
|
# Password is authelia
|
||||||
|
password: "$6$rounds=50000$BpLnfgDsc2WD8F2q$Zis.ixdg9s/UOJYrs56b5QEZFiZECu0qZVNsIYxBaNJ7ucIL.nlxVCT5tqh8KHG8X4tlwCFm5r6NTOZZ5qRFN/"
|
||||||
|
email: authelia@authelia.com
|
||||||
|
groups:
|
||||||
|
- admins
|
||||||
|
- dev
|
||||||
|
- su
|
79
docs/examples/docker/idp-authelia-traefik/cpp/copyparty.conf
Normal file
79
docs/examples/docker/idp-authelia-traefik/cpp/copyparty.conf
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
# not actually YAML but lets pretend:
|
||||||
|
# -*- mode: yaml -*-
|
||||||
|
# vim: ft=yaml:
|
||||||
|
|
||||||
|
|
||||||
|
# example config for how authelia can be used to replace
|
||||||
|
# copyparty's built-in authentication/authorization mechanism,
|
||||||
|
# providing copyparty with HTTP headers through traefik to
|
||||||
|
# signify who the user is, and what groups they belong to
|
||||||
|
#
|
||||||
|
# the filesystem-path that will be shared with copyparty is
|
||||||
|
# specified in the docker-compose in the parent folder, where
|
||||||
|
# a real filesystem-path is mapped onto this container's path `/w`,
|
||||||
|
# meaning `/w` in this config-file is actually `/srv/pub` in the
|
||||||
|
# outside world (assuming you didn't modify that value)
|
||||||
|
|
||||||
|
|
||||||
|
[global]
|
||||||
|
e2dsa # enable file indexing and filesystem scanning
|
||||||
|
e2ts # enable multimedia indexing
|
||||||
|
ansi # enable colors in log messages
|
||||||
|
#q # disable logging for more performance
|
||||||
|
|
||||||
|
# since copyparty is only accessible through traefik, disable safetycheck on x-forwarded-for
|
||||||
|
xff-src: any
|
||||||
|
|
||||||
|
# enable IdP support by expecting username/groupname in
|
||||||
|
# http-headers provided by the reverse-proxy; header "X-IdP-User"
|
||||||
|
# will contain the username, "X-IdP-Group" the groupname
|
||||||
|
idp-h-usr: remote-user
|
||||||
|
idp-h-grp: remote-groups
|
||||||
|
|
||||||
|
# DEBUG: show all incoming request headers from traefik/authelia
|
||||||
|
#ihead: *
|
||||||
|
|
||||||
|
|
||||||
|
[/] # create a volume at "/" (the webroot), which will
|
||||||
|
/w # share /w (the docker data volume, which is mapped to /srv/pub on the host in docker-compose.yml)
|
||||||
|
accs:
|
||||||
|
rw: * # everyone gets read-access, but
|
||||||
|
rwmda: @su # the group "su" gets read-write-move-delete-admin
|
||||||
|
|
||||||
|
|
||||||
|
[/u/${u}] # each user gets their own home-folder at /u/username
|
||||||
|
/w/u/${u} # which will be "u/username" in the docker data volume
|
||||||
|
accs:
|
||||||
|
r: * # read-access for anyone, and
|
||||||
|
rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/u/${u}/priv] # each user also gets a private area at /u/username/priv
|
||||||
|
/w/u/${u}/priv # stored at DATAVOLUME/u/username/priv
|
||||||
|
accs:
|
||||||
|
rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/lounge/${g}] # each group gets their own shared volume
|
||||||
|
/w/lounge/${g} # stored at DATAVOLUME/lounge/groupname
|
||||||
|
accs:
|
||||||
|
r: * # read-access for anyone, and
|
||||||
|
rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/lounge/${g}/priv] # and a private area for each group too
|
||||||
|
/w/lounge/${g}/priv # stored at DATAVOLUME/lounge/groupname/priv
|
||||||
|
accs:
|
||||||
|
rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
# and create some strategic volumes to prevent anyone from gaining
|
||||||
|
# unintended access to priv folders if the users/groups db is lost
|
||||||
|
[/u]
|
||||||
|
/w/u
|
||||||
|
accs:
|
||||||
|
rwmda: @su
|
||||||
|
[/lounge]
|
||||||
|
/w/lounge
|
||||||
|
accs:
|
||||||
|
rwmda: @su
|
99
docs/examples/docker/idp-authelia-traefik/docker-compose.yml
Normal file
99
docs/examples/docker/idp-authelia-traefik/docker-compose.yml
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
version: '3.3'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
net:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
services:
|
||||||
|
copyparty:
|
||||||
|
image: copyparty/ac:idp
|
||||||
|
container_name: idp_copyparty
|
||||||
|
user: "1000:1000" # should match the user/group of your fileshare volumes
|
||||||
|
volumes:
|
||||||
|
- ./cpp/:/cfg:z # the copyparty config folder
|
||||||
|
- /srv/pub:/w:z # this is where we declare that "/srv/pub" is the filesystem-path on the server that shall be shared online
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
expose:
|
||||||
|
- 3923
|
||||||
|
labels:
|
||||||
|
- 'traefik.enable=true'
|
||||||
|
- 'traefik.http.routers.copyparty.rule=Host(`fs.example.com`)'
|
||||||
|
- 'traefik.http.routers.copyparty.entrypoints=https'
|
||||||
|
- 'traefik.http.routers.copyparty.tls=true'
|
||||||
|
- 'traefik.http.routers.copyparty.middlewares=authelia@docker'
|
||||||
|
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
||||||
|
|
||||||
|
authelia:
|
||||||
|
image: authelia/authelia:v4.38.0-beta3 # the config files in the authelia folder use the new syntax
|
||||||
|
container_name: idp_authelia
|
||||||
|
volumes:
|
||||||
|
- ./authelia:/config:z
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
labels:
|
||||||
|
- 'traefik.enable=true'
|
||||||
|
- 'traefik.http.routers.authelia.rule=Host(`authelia.example.com`)'
|
||||||
|
- 'traefik.http.routers.authelia.entrypoints=https'
|
||||||
|
- 'traefik.http.routers.authelia.tls=true'
|
||||||
|
#- 'traefik.http.routers.authelia.tls.certresolver=letsencrypt' # uncomment this to enable automatic certificate signing (1/2)
|
||||||
|
- 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/authz/forward-auth?authelia_url=https://authelia.example.com'
|
||||||
|
- 'traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true'
|
||||||
|
- 'traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email'
|
||||||
|
expose:
|
||||||
|
- 9091
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
disable: true
|
||||||
|
environment:
|
||||||
|
- TZ=Etc/UTC
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7.2.4-alpine3.19
|
||||||
|
container_name: idp_redis
|
||||||
|
volumes:
|
||||||
|
- ./redis:/data:z
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
expose:
|
||||||
|
- 6379
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- TZ=Etc/UTC
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: traefik:2.11.0
|
||||||
|
container_name: idp_traefik
|
||||||
|
volumes:
|
||||||
|
- ./traefik:/etc/traefik:z
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock # WARNING: this gives traefik full root-access to the host OS, but is recommended/required(?) by traefik
|
||||||
|
security_opt:
|
||||||
|
- label:disable # disable selinux because it (rightly) blocks access to docker.sock
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
labels:
|
||||||
|
- 'traefik.enable=true'
|
||||||
|
- 'traefik.http.routers.api.rule=Host(`traefik.example.com`)'
|
||||||
|
- 'traefik.http.routers.api.entrypoints=https'
|
||||||
|
- 'traefik.http.routers.api.service=api@internal'
|
||||||
|
- 'traefik.http.routers.api.tls=true'
|
||||||
|
#- 'traefik.http.routers.api.tls.certresolver=letsencrypt' # uncomment this to enable automatic certificate signing (2/2)
|
||||||
|
- 'traefik.http.routers.api.middlewares=authelia@docker'
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
|
command:
|
||||||
|
- '--api'
|
||||||
|
- '--providers.docker=true'
|
||||||
|
- '--providers.docker.exposedByDefault=false'
|
||||||
|
- '--entrypoints.http=true'
|
||||||
|
- '--entrypoints.http.address=:80'
|
||||||
|
- '--entrypoints.http.http.redirections.entrypoint.to=https'
|
||||||
|
- '--entrypoints.http.http.redirections.entrypoint.scheme=https'
|
||||||
|
- '--entrypoints.https=true'
|
||||||
|
- '--entrypoints.https.address=:443'
|
||||||
|
- '--certificatesResolvers.letsencrypt.acme.email=your-email@your-domain.com'
|
||||||
|
- '--certificatesResolvers.letsencrypt.acme.storage=/etc/traefik/acme.json'
|
||||||
|
- '--certificatesResolvers.letsencrypt.acme.httpChallenge.entryPoint=http'
|
||||||
|
- '--log=true'
|
||||||
|
- '--log.level=WARNING' # DEBUG
|
12
docs/examples/docker/idp-authentik-traefik/README.md
Normal file
12
docs/examples/docker/idp-authentik-traefik/README.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
> [!WARNING]
|
||||||
|
> I am unable to guarantee the quality, safety, and security of anything in this folder; it is a combination of examples I found online. Please submit corrections or improvements 🙏
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> does not work
|
||||||
|
|
||||||
|
this is based on:
|
||||||
|
* https://goauthentik.io/docker-compose.yml
|
||||||
|
* https://goauthentik.io/docs/providers/proxy/server_traefik
|
||||||
|
|
||||||
|
incomplete list of modifications made:
|
||||||
|
* support for running with podman as root on fedora (`:z` volumes, `label:disable`)
|
|
@ -0,0 +1,88 @@
|
||||||
|
# https://goauthentik.io/docker-compose.yml
|
||||||
|
---
|
||||||
|
version: "3.4"
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgresql:
|
||||||
|
image: docker.io/library/postgres:12-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||||
|
start_period: 20s
|
||||||
|
interval: 30s
|
||||||
|
retries: 5
|
||||||
|
timeout: 5s
|
||||||
|
volumes:
|
||||||
|
- database:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: ${PG_PASS:?database password required}
|
||||||
|
POSTGRES_USER: ${PG_USER:-authentik}
|
||||||
|
POSTGRES_DB: ${PG_DB:-authentik}
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
redis:
|
||||||
|
image: docker.io/library/redis:alpine
|
||||||
|
command: --save 60 1 --loglevel warning
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
|
||||||
|
start_period: 20s
|
||||||
|
interval: 30s
|
||||||
|
retries: 5
|
||||||
|
timeout: 3s
|
||||||
|
volumes:
|
||||||
|
- redis:/data
|
||||||
|
server:
|
||||||
|
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2024.2.1}
|
||||||
|
restart: unless-stopped
|
||||||
|
command: server
|
||||||
|
environment:
|
||||||
|
AUTHENTIK_REDIS__HOST: redis
|
||||||
|
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||||
|
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
|
||||||
|
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
|
||||||
|
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
|
||||||
|
volumes:
|
||||||
|
- ./media:/media
|
||||||
|
- ./custom-templates:/templates
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- "${COMPOSE_PORT_HTTP:-9000}:9000"
|
||||||
|
- "${COMPOSE_PORT_HTTPS:-9443}:9443"
|
||||||
|
depends_on:
|
||||||
|
- postgresql
|
||||||
|
- redis
|
||||||
|
worker:
|
||||||
|
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2024.2.1}
|
||||||
|
restart: unless-stopped
|
||||||
|
command: worker
|
||||||
|
environment:
|
||||||
|
AUTHENTIK_REDIS__HOST: redis
|
||||||
|
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||||
|
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
|
||||||
|
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
|
||||||
|
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
|
||||||
|
# `user: root` and the docker socket volume are optional.
|
||||||
|
# See more for the docker socket integration here:
|
||||||
|
# https://goauthentik.io/docs/outposts/integrations/docker
|
||||||
|
# Removing `user: root` also prevents the worker from fixing the permissions
|
||||||
|
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID
|
||||||
|
# (1000:1000 by default)
|
||||||
|
user: root
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./media:/media
|
||||||
|
- ./certs:/certs
|
||||||
|
- ./custom-templates:/templates
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
depends_on:
|
||||||
|
- postgresql
|
||||||
|
- redis
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
database:
|
||||||
|
driver: local
|
||||||
|
redis:
|
||||||
|
driver: local
|
|
@ -0,0 +1,46 @@
|
||||||
|
# https://goauthentik.io/docs/providers/proxy/server_traefik
|
||||||
|
---
|
||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
traefik:
|
||||||
|
image: traefik:v2.2
|
||||||
|
container_name: traefik
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
command:
|
||||||
|
- "--api"
|
||||||
|
- "--providers.docker=true"
|
||||||
|
- "--providers.docker.exposedByDefault=false"
|
||||||
|
- "--entrypoints.web.address=:80"
|
||||||
|
|
||||||
|
authentik-proxy:
|
||||||
|
image: ghcr.io/goauthentik/proxy
|
||||||
|
ports:
|
||||||
|
- 9000:9000
|
||||||
|
- 9443:9443
|
||||||
|
environment:
|
||||||
|
AUTHENTIK_HOST: https://your-authentik.tld
|
||||||
|
AUTHENTIK_INSECURE: "false"
|
||||||
|
AUTHENTIK_TOKEN: token-generated-by-authentik
|
||||||
|
# Starting with 2021.9, you can optionally set this too
|
||||||
|
# when authentik_host for internal communication doesn't match the public URL
|
||||||
|
# AUTHENTIK_HOST_BROWSER: https://external-domain.tld
|
||||||
|
labels:
|
||||||
|
traefik.enable: true
|
||||||
|
traefik.port: 9000
|
||||||
|
traefik.http.routers.authentik.rule: Host(`app.company`) && PathPrefix(`/outpost.goauthentik.io/`)
|
||||||
|
# `authentik-proxy` refers to the service name in the compose file.
|
||||||
|
traefik.http.middlewares.authentik.forwardauth.address: http://authentik-proxy:9000/outpost.goauthentik.io/auth/traefik
|
||||||
|
traefik.http.middlewares.authentik.forwardauth.trustForwardHeader: true
|
||||||
|
traefik.http.middlewares.authentik.forwardauth.authResponseHeaders: X-authentik-username,X-authentik-groups,X-authentik-email,X-authentik-name,X-authentik-uid,X-authentik-jwt,X-authentik-meta-jwks,X-authentik-meta-outpost,X-authentik-meta-provider,X-authentik-meta-app,X-authentik-meta-version
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
whoami:
|
||||||
|
image: containous/whoami
|
||||||
|
labels:
|
||||||
|
traefik.enable: true
|
||||||
|
traefik.http.routers.whoami.rule: Host(`app.company`)
|
||||||
|
traefik.http.routers.whoami.middlewares: authentik@docker
|
||||||
|
restart: unless-stopped
|
|
@ -0,0 +1,72 @@
|
||||||
|
# not actually YAML but lets pretend:
|
||||||
|
# -*- mode: yaml -*-
|
||||||
|
# vim: ft=yaml:
|
||||||
|
|
||||||
|
|
||||||
|
# example config for how copyparty can be used with an identity
|
||||||
|
# provider, replacing the built-in authentication/authorization
|
||||||
|
# mechanism, and instead expecting the reverse-proxy to provide
|
||||||
|
# the requester's username (and possibly a group-name, for
|
||||||
|
# optional group-based access control)
|
||||||
|
#
|
||||||
|
# the filesystem-path `/w` is used as the storage location
|
||||||
|
# because that is the data-volume in the docker containers,
|
||||||
|
# because a deployment like this (with an IdP) is more commonly
|
||||||
|
# seen in containerized environments -- but this is not required
|
||||||
|
|
||||||
|
|
||||||
|
[global]
|
||||||
|
e2dsa # enable file indexing and filesystem scanning
|
||||||
|
e2ts # enable multimedia indexing
|
||||||
|
ansi # enable colors in log messages
|
||||||
|
|
||||||
|
# enable IdP support by expecting username/groupname in
|
||||||
|
# http-headers provided by the reverse-proxy; header "X-IdP-User"
|
||||||
|
# will contain the username, "X-IdP-Group" the groupname
|
||||||
|
idp-h-usr: x-idp-user
|
||||||
|
idp-h-grp: x-idp-group
|
||||||
|
|
||||||
|
|
||||||
|
[/] # create a volume at "/" (the webroot), which will
|
||||||
|
/w # share /w (the docker data volume, which is mapped to /srv/pub on the host in docker-compose.yml)
|
||||||
|
accs:
|
||||||
|
rw: * # everyone gets read-access, but
|
||||||
|
rwmda: @su # the group "su" gets read-write-move-delete-admin
|
||||||
|
|
||||||
|
|
||||||
|
[/u/${u}] # each user gets their own home-folder at /u/username
|
||||||
|
/w/u/${u} # which will be "u/username" in the docker data volume
|
||||||
|
accs:
|
||||||
|
r: * # read-access for anyone, and
|
||||||
|
rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/u/${u}/priv] # each user also gets a private area at /u/username/priv
|
||||||
|
/w/u/${u}/priv # stored at DATAVOLUME/u/username/priv
|
||||||
|
accs:
|
||||||
|
rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/lounge/${g}] # each group gets their own shared volume
|
||||||
|
/w/lounge/${g} # stored at DATAVOLUME/lounge/groupname
|
||||||
|
accs:
|
||||||
|
r: * # read-access for anyone, and
|
||||||
|
rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
[/lounge/${g}/priv] # and a private area for each group too
|
||||||
|
/w/lounge/${g}/priv # stored at DATAVOLUME/lounge/groupname/priv
|
||||||
|
accs:
|
||||||
|
rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
|
||||||
|
|
||||||
|
|
||||||
|
# and create some strategic volumes to prevent anyone from gaining
|
||||||
|
# unintended access to priv folders if the users/groups db is lost
|
||||||
|
[/u]
|
||||||
|
/w/u
|
||||||
|
accs:
|
||||||
|
rwmda: @su
|
||||||
|
[/lounge]
|
||||||
|
/w/lounge
|
||||||
|
accs:
|
||||||
|
rwmda: @su
|
131
docs/examples/docker/idp-authentik-traefik/docker-compose.yml
Normal file
131
docs/examples/docker/idp-authentik-traefik/docker-compose.yml
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
version: "3.4"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
database:
|
||||||
|
driver: local
|
||||||
|
redis:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
services:
|
||||||
|
copyparty:
|
||||||
|
image: copyparty/ac:idp
|
||||||
|
container_name: idp_copyparty
|
||||||
|
restart: unless-stopped
|
||||||
|
user: "1000:1000" # should match the user/group of your fileshare volumes
|
||||||
|
volumes:
|
||||||
|
- ./cpp/:/cfg:z # the copyparty config folder
|
||||||
|
- /srv/pub:/w:z # this is where we declare that "/srv/pub" is the filesystem-path on the server that shall be shared online
|
||||||
|
ports:
|
||||||
|
- 3923
|
||||||
|
labels:
|
||||||
|
- 'traefik.enable=true'
|
||||||
|
- 'traefik.http.routers.fs.rule=Host(`fs.example.com`)'
|
||||||
|
- 'traefik.http.routers.fs.entrypoints=http'
|
||||||
|
#- 'traefik.http.routers.fs.middlewares=authelia@docker' # TODO: ???
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "wget --spider -q 127.0.0.1:3923/?reset"]
|
||||||
|
interval: 1m
|
||||||
|
timeout: 2s
|
||||||
|
retries: 5
|
||||||
|
start_period: 15s
|
||||||
|
stop_grace_period: 15s # thumbnailer is allowed to continue finishing up for 10s after the shutdown signal
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: traefik:v2.11
|
||||||
|
container_name: traefik
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock # WARNING: this gives traefik full root-access to the host OS, but is recommended/required(?) by traefik
|
||||||
|
security_opt:
|
||||||
|
- label:disable # disable selinux because it (rightly) blocks access to docker.sock
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
command:
|
||||||
|
- '--api'
|
||||||
|
- '--providers.docker=true'
|
||||||
|
- '--providers.docker.exposedByDefault=false'
|
||||||
|
- '--entrypoints.web.address=:80'
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
image: docker.io/library/postgres:12-alpine
|
||||||
|
container_name: idp_postgresql
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||||
|
start_period: 20s
|
||||||
|
interval: 30s
|
||||||
|
retries: 5
|
||||||
|
timeout: 5s
|
||||||
|
volumes:
|
||||||
|
- database:/var/lib/postgresql/data:z
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: postgrass
|
||||||
|
POSTGRES_USER: authentik
|
||||||
|
POSTGRES_DB: authentik
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: docker.io/library/redis:alpine
|
||||||
|
command: --save 60 1 --loglevel warning
|
||||||
|
container_name: idp_redis
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
|
||||||
|
start_period: 20s
|
||||||
|
interval: 30s
|
||||||
|
retries: 5
|
||||||
|
timeout: 3s
|
||||||
|
volumes:
|
||||||
|
- redis:/data:z
|
||||||
|
|
||||||
|
authentik_server:
|
||||||
|
image: ghcr.io/goauthentik/server:2024.2.1
|
||||||
|
container_name: idp_authentik_server
|
||||||
|
restart: unless-stopped
|
||||||
|
command: server
|
||||||
|
environment:
|
||||||
|
AUTHENTIK_REDIS__HOST: redis
|
||||||
|
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||||
|
AUTHENTIK_POSTGRESQL__USER: authentik
|
||||||
|
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||||
|
AUTHENTIK_POSTGRESQL__PASSWORD: postgrass
|
||||||
|
volumes:
|
||||||
|
- ./media:/media:z
|
||||||
|
- ./custom-templates:/templates:z
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- 9000
|
||||||
|
- 9443
|
||||||
|
depends_on:
|
||||||
|
- postgresql
|
||||||
|
- redis
|
||||||
|
|
||||||
|
authentik_worker:
|
||||||
|
image: ghcr.io/goauthentik/server:2024.2.1
|
||||||
|
container_name: idp_authentik_worker
|
||||||
|
restart: unless-stopped
|
||||||
|
command: worker
|
||||||
|
environment:
|
||||||
|
AUTHENTIK_REDIS__HOST: redis
|
||||||
|
AUTHENTIK_POSTGRESQL__HOST: postgresql
|
||||||
|
AUTHENTIK_POSTGRESQL__USER: authentik
|
||||||
|
AUTHENTIK_POSTGRESQL__NAME: authentik
|
||||||
|
AUTHENTIK_POSTGRESQL__PASSWORD: postgrass
|
||||||
|
# `user: root` and the docker socket volume are optional.
|
||||||
|
# See more for the docker socket integration here:
|
||||||
|
# https://goauthentik.io/docs/outposts/integrations/docker
|
||||||
|
# Removing `user: root` also prevents the worker from fixing the permissions
|
||||||
|
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID
|
||||||
|
# (1000:1000 by default)
|
||||||
|
user: root
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./media:/media:z
|
||||||
|
- ./certs:/certs:z
|
||||||
|
- ./custom-templates:/templates:z
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
depends_on:
|
||||||
|
- postgresql
|
||||||
|
- redis
|
Loading…
Reference in a new issue