Advertisement
Guest User

Untitled

a guest
Mar 7th, 2021
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.85 KB | None | 0 0
  1. #Traefik docker-compose
  2. version: '3'
  3.  
  4. services:
  5.         traefik:
  6.                 image: traefik:v2.4.5
  7.                 container_name: traefik
  8.                 restart: unless-stopped
  9.                 security_opt:
  10.                        - no-new-privileges:true
  11.                 networks:
  12.                        - t2_proxy
  13.                 ports:
  14.                        - 80:80
  15.                         - 443:443
  16.                 volumes:
  17.                        - /etc/localtime:/etc/localtime:ro
  18.                         - /var/run/docker.sock:/var/run/docker.sock:ro
  19.                         - ./data/usersfile:/usersfile:ro
  20.                         - ./data/traefik.yml:/traefik.yml:ro
  21.                         - ./data/acme.json:/acme.json
  22.                         - /var/log:/var/log
  23.  
  24.                 labels:
  25.                        - "traefik.enable=true"
  26.                         - "traefik.http.routers.traefik.entrypoints=web"
  27.                         - "traefik.http.routers.traefik.rule=Host(`example.com`)"
  28.                           #- "traefik.http.middlewares.traefik-auth.basicauth.usersfile=usersfile"
  29.                         - "traefik.http.routers.traefik-secure.entrypoints=websecure"
  30.                         - "traefik.http.routers.traefik-secure.rule=Host(`example.com`)"
  31.                           #- "traefik.http.routers.traefik-secure.tls=true" no longer needed, static config
  32.                         - "traefik.http.routers.traefik-secure.tls.certresolver=http"
  33.                         - "traefik.http.routers.traefik-secure.service=api@internal"
  34.                           #Authelia froward auth
  35.                         - "traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://example.com/authelia/"
  36.                         - "traefik.http.middlewares.authelia.forwardauth.trustforwardheader=true"
  37.                         - "traefik.http.middlewares.authelia.forwardauth.authresponseheaders=Remote-User, Remote-Groups"
  38.  
  39.                           #Use authelia to authenticate
  40.                         - "traefik.http.routers.traefik-secure.middlewares=authelia@docker"
  41.                         - "traefik.http.routers.traefik.middlewares=authelia@docker"
  42.  
  43.  
  44.  
  45. networks:
  46.         t2_proxy:
  47.                 external: true
  48.  
  49. #Traefik Config
  50.  
  51. api:
  52.         dashboard: true
  53.  
  54. entryPoints:
  55.         web:
  56.                 address: ":80"
  57.                 http:
  58.                         redirections:
  59.                                 entrypoint:
  60.                                         to: websecure
  61.                                         scheme: https
  62.         websecure:
  63.                 address: ":443"
  64.                 http:
  65.                         tls: {}
  66.  
  67. providers:
  68.         docker:
  69.                 endpoint: "unix:///var/run/docker.sock"
  70.                 exposedByDefault: false
  71.         file:
  72.                 directory: "rules/"
  73.  
  74. certificatesResolvers:
  75.         http:
  76.                 acme:
  77.                         email: example@gmail.com
  78.                         storage: acme.json
  79.                         httpChallenge:
  80.                                 entrypoint: web
  81.  
  82. log:
  83.         filePath: "/var/log/traefik.log"
  84.         level: WARN
  85. accessLog:
  86.         filePath: "var/log/access.log"
  87.         filters:
  88.                 statusCodes:
  89.                        - "400-499"
  90.                 retryAttempts: true
  91.                
  92. #authelia docker-compose
  93.  
  94. version: "2.4"
  95.  
  96. services:
  97.         authelia:
  98.                 image: authelia/authelia:4.21.0
  99.                 container_name: authelia
  100.                 environment:
  101.                        - TZ=America/Chicago
  102.                 volumes:
  103.                        - ./authelia:/config
  104.                         - ./authelia/secrets:/config/secrets:ro
  105.                 restart: unless-stopped
  106.                 networks:
  107.                        - t2_proxy
  108.                 environment:
  109.                        - AUTHELIA_JWT_SECRET_FILE=/config/secrets/jwt
  110.                         - AUTHELIA_SESSION_SECRET_FILE=/config/secrets/session
  111.                         - AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE=/config/secrets/email
  112.                 labels:
  113.                        - "traefik.enable=true"
  114.                         - "traefik.http.routers.authelia-https.rule=Host(`example.com`) && PathPrefix(`/authelia{regex:$$|/.*}`)"
  115.                         - "traefik.http.routers.authelia-https.entrypoints=websecure"
  116.                         - "traefik.http.routers.authelia-https.tls=true"
  117.                         - "traefik.http.routers.authelia-https.service=authelia-svc"
  118.                         - "traefik.http.services.authelia-svc.loadbalancer.server.port=9091"
  119.  
  120. networks:
  121.         t2_proxy:
  122.                 external: true
  123.  
  124. #authelia config
  125. host: 0.0.0.0
  126. port: 9091
  127. log_level: info
  128. #jwt_secret:
  129. default_redirection_url: https://example.com/dashboard/
  130.  
  131. ### TOTP Settings
  132. totp:
  133.         issuer: example.com
  134.         period: 30
  135.         skew: 1
  136.  
  137. authentication_backend:
  138.         disable_reset_password: false
  139.         file:
  140.                 path: /config/users_database.yml
  141.                 password:
  142.                         algorithm: argon2id
  143.                         iterations: 1
  144.                         key_length: 32
  145.                         salt_length: 16
  146.                         memory: 512
  147.                         parallelism: 8
  148.  
  149. access_control:
  150.         default_policy: deny
  151.         rules:
  152.                 - domain:
  153.                        - example.com
  154.                         - "*.example.com"
  155.                   policy: bypass
  156.                   networks:
  157.                          - 192.168.0.0/16
  158.                           - 172.16.0.0/12
  159.                           - 10.0.0.0/8
  160.                 - domain:
  161.                        - example.com
  162.                         - "*.example.com"
  163.                   policy: two_factor
  164. server:
  165.         path: authelia
  166.  
  167. session:
  168.         name: authelia_session
  169.         #  secret:
  170.         expiration: 1h
  171.         inactivity: 5m
  172.         remember_me_duration: 1M
  173.         domain: example.com
  174. regulation:
  175.         max_retries: 3
  176.         find_time: 2m
  177.         ban_time: 5m
  178.  
  179. storage:
  180.         local:
  181.                 path: /config/db.sqlite3
  182. notifier:
  183.         disable_startup_check: false
  184.         smtp:
  185.                 username: example@outlook.com
  186.                 #password:  set in environment
  187.                 host: smtp.office365.com
  188.                 port: 587
  189.                 sender: example@outlook.com
  190.                 #identifier: localhost
  191.                 subject: "[Authelia] {Login Setup}"
  192.                 #startup_check_address: "example@outlook.com"
  193.                 #disable_require_tls: false
  194.                 #disable_html_emails: false
  195.                 #tls:
  196.                 #        skip_verify: false
  197.                 #        minimum_version: TLS1.2
  198.         #filesystem:
  199.         #        filename: /config/notification.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement