# https://github.com/brokenscripts/authentik_traefik Setup ----- # It is strongly recommended to follow excellent instructions at https://github.com/brokenscripts/authentik_traefik/blob/traefik3/README.md which include illustrations / screen dumps. # The following is an attempted text representation of the same instructions. # Navigate to Authentik at https://authentik.sthome.org/if/flow/initial-setup/ # At first login, set the email and password for akadmin (default user) # Change akadmin username to preferred username: # Go to Admin Interface -> Directory -> Users -> Edit (pencil icon under Actions in akadmin row) # Change username (and email if needed), then click on Update # # Domain Wide / Catch All (forwardAuth) using the Wizard # ====================================================== # For each app that will use authentik, edit the traefik labels in its compose.yml by adding the following lines: ## attach AUTHENTIK forwardauth middlewares to router; comment out if not using authentik - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=forwardAuth-authentik@file" # NB! The "${APPLICATION_NAME}-secure-rtr" part is the name of the router; modify it if needed # The online instructions use "whoami-individual" service as an example. This service is in the authentik compose.yml file and has this line already present. # # Wizard: create application with provider # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Navigate to Applications -> Applications -> "Create with Wizard" # Wizard Page 1 - "Application Details" # Name: Domain Wide Forward Auth Catch All # Slug: domain-wide-forward-auth-catch-all # Group: # Policy Engine Mode: any # UI Settings: # Launch URL: # Do NOT put anything in the Launch URL, it needs to autodetect since it's the catch all rule # Open in new tab: # Click Next # Wizard Page 2 - "Provider Type" # Click on "Forward Auth (Domain Level)" # Click Next # Wizard Page 3 - "Provider Configuration" # Name: Provider for Domain Wide Forward Auth Catch All # Authentication Flow: # This is user choice; the author recommends getting the basics setup and THEN modifying authentication flow for the catch all # Authorization Flow: default-provider-authorization-explicit-consent (Authorize Application) # Explicit requires user interaction aka clicking a button to continue versus implicit which is just trust # External Host: https://authentik.domain.tld # Cookie Domain: domain.tld # Token Validity: hours=24 # Click Submit # Click Close # # Embedded Outpost (Domain Wide) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Navigate to the Applications -> Outposts # Notice that there are nothing in the Providers column in authentik Embedded Outpost row # Click on Edit (pencil icon under Actions in authentik Embedded Outpost row) # Select "Domain Wide Forward Auth Catch All" in "Available Applications" # Click on ">" in order to have the "Domain Wide Forward Auth Catch All" in Selected Applications # Click Update # Notice the added provider in the Providers column in authentik Embedded Outpost row # # Domain Wide / Catch All Test/Validation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Using browser, go to whoami-catchall.domain.tld; it should redirect you to Authentik to login # Sign in with your username or email address initially created. After inputting username & password, it should show you the "Redirecting" screen prior to actual redirection # # Individual Application (forwardAuth) manual # =========================================== # Provider Creation (Individual Application) - Manual # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # In the Admin Interface, go to: Applications -> Providers -> Create # Select "Proxy Provider" # Click Next # On "new Provider" screen enter: # Name: whoami-individual provider # Authentication Flow: # This is user choice, the author recommends getting the basics setup and THEN modifying authentication flow for the catch all # Authorization Flow: default-provider-authorization-explicit-consent (Authorize Application) # Type: Forward auth (single application) # Single Application is where we change it up! # External Host: https://whoami-individual.domain.tld # Token Validity: hours=24 # Click Finish # After hitting Finish it will warn that it's not bound to an Application # # Application Creation (Individual Application) - Manual # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # In the Admin Interface, go to Applications -> Applications -> Create # On the "Create Application" screen enter: # Name: whoami-individual application # Slug: whoami-individual-application # Group: # Provider: whoami-individual provider # This is where you bind it to the previously created provider! # Backchannel Providers: # Policy Engine Mode: any # UI Settings # Launch URL: https://whoami-individual.domain.tld # Since this is an individual application, specify where it is found at # Click Create # After hitting Create it will show that it is now bound to the previously created provider # # Embedded Outpost (Individual Application) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Navigate to Applications -> Outposts # Click on Edit (pencil icon under Actions in authentik Embedded Outpost row) # Notice that it still has only the Domain Wide Forward Auth Catch All rule in Selected Applications # Select any application you want the outpost to be able to provide for. In this case Select whoami-individual application in "Available Applications" # Click on ">" # Click Update # Now both the domain wide (catch all) and the individual application are bound to this outpost. # # Individual Application Test/Validation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Using browser, go to whoami-individual.domain.tld; it should redirect you to Authentik to login # Sign in with your username or email address initially created. After inputting username & password, it should show you the "Redirecting" screen prior to actual redirection # # New User Creation # ================= # Inside the Admin Interface navigate to Directory -> Users -> Create # On "Create User" screen enter: # Username: admin # Name: Administrator # User type: internal # Email: admin@domain.tld # Is active: # Path: users # Click Create # # Add user to Administrator/Superuser Group # ========================================= # Inside the Admin Interface navigate to Directory -> Groups # Left click/Open authentik Admins # Go to Users tab # Click "Add existing user" # Click + and add user # # Change user password # ==================== # Inside the Admin Interface navigate to Directory -> Users # Left click/Open the specific user # Click "Set password" # # Setting up Gitea to use Authentik # ================================= # Skip the following section if you want to use an existing / default authorization flow # Creating custom Authorization flow for gitea # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Inside the Admin Interface navigate to Flows and Stages -> Flows # Click Create # Name: sthome-application-authorization # Title: Redirecting to %(app)s # Slug: # Designation: Authorization # Authentication: Require authentication # Behavior Settings: # Compatilibity mode: