Create an LDAP provider
Creating an authentik LDAP provider requires the following steps:
- Create an LDAP authentication flow (optional)
- Create an LDAP application and provider
- Create a service account and assign the LDAP search permission
- Create an LDAP Outpost
Create an LDAP authentication flow (optional)
The default-authentication-flow validates MFA by default. Duo, TOTP, and static authenticators are supported by the LDAP provider. WebAuthn and SMS are not supported.
If you plan to use only dedicated service accounts to bind to LDAP, or only use LDAP supported MFA authenticators, then you can use the default authentication flow and skip this section and continue with the Create an LDAP application and provider section.
Refer to Code-Based MFA support for more information on LDAP and MFA.
Create custom stages
You'll need to create the stages that make up the flow.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Flows and Stages > Stages, and click Create.
Password Stage
First, you'll need to create a Password Stage.
- Select Password Stage as the stage type, click Next, and set the following required configurations:
- Provide a Name for the stage (e.g.
ldap-authentication-password-stage). - For Backends, leave the default settings.
- Provide a Name for the stage (e.g.
- Click Finish
Identification Stage
Next, you'll need to create an Identification Stage.
- On the Stages page, click Create.
- Select Identification Stage as the stage type, click Next, and set the following required configurations:
- Provide a Name for the stage (e.g.
ldap-identification-stage). - For User fields, select
UsernameandEmail(and UPN if it is relevant to your setup). - Set Password stage to the Password Stage created in the previous section (e.g.
ldap-authentication-password-stage)
- Provide a Name for the stage (e.g.
- Click Finish
User Login Stage
Finally, you'll need to create a User Login Stage.
- On the Stages page, click Create.
- Select User Login Stage as the stage type, click Next, and set the following required configurations:
- Provide a Name for the stage (e.g.
ldap-authentication-login-stage).
- Provide a Name for the stage (e.g.
- Click Finish
Create an LDAP authentication flow
Now you'll need to create the LDAP authentication flow and bind the previously created stages.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Flows and Stages > Flows, click Create, and set the following required configurations:
- Provide a Name, Title and Slug for the flow (e.g.
ldap-authentication-flow). - Set Designation to
Authentication.
- Provide a Name, Title and Slug for the flow (e.g.
- Click Create.
- Click the name of the newly created flow, open the Stage Bindings tab, and click Bind existing stage.
- Select the previously created LDAP Identification Stage (e.g.
ldap-identification-stage), set the order to10, and click Create. - Click Bind existing stage.
- Select the previously created LDAP User Login Stage (e.g.
ldap-authentication-login-stage), set the order to30, and click Create.
Create an LDAP application and provider
The LDAP application and provider can now be created.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Applications > Applications, click Create with Provider to create an application and provider pair.
- On the New application page, define the application details, and then click Next.
- Select LDAP Provider as the Provider Type, and then click Next.
- On the Configure LDAP Provider page, provide the configuration settings and then click Submit to create both the application and the provider.
If you followed the optional Create an LDAP authentication flow section, ensure that you set Bind flow to newly created authentication flow (e.g. ldap-authentication-flow).
Create a service account
Create a service account to bind to LDAP with.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Directory > Users and click New User.
- Provide a name for the service account (e.g.
ldapservice) and click Create. - Click the name of the newly created service account.
- Under Recovery, click Set password, provide a secure password for the account, and click Update password.
The default DN of this user will be cn=ldapservice,ou=users,dc=ldap,dc=goauthentik,dc=io
Assign the LDAP search permission to the service account
The service account needs permissions to search the LDAP directory.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Applications > Providers
- Click on the name of the newly created LDAP provider, then open the Permissions tab.
- Click Assign to new user
- For User, select a user to assign the full directory search permission to (e.g.
ldapservice). - Enable the Search full LDAP directory permission and click Assign
Create an LDAP Outpost
The LDAP provider requires the deployment of an LDAP Outpost.
-
Log in to authentik as an administrator and open the authentik Admin interface.
-
Navigate to Applications > Outposts, click Create and set the following required configurations:
- Provide a Name for the outpost (e.g. `LDAP Outpost').
- Set the Type as
LDAP. - Set Integration to match your deployment method or manually deploy an outpost via Docker-Compose or Kubernetes. For more information, refer to the Outpost documentation.
- Under Applications, select the LDAP application created in the previous section.
- Under Advanced settings, set the required outpost configurations. For more information, refer to Outpost Configuration
-
Click Create.
The LDAP Outpost selects different providers based on their Base DN. Adding multiple providers with the same Base DN will result in inconsistent access.
Configuration verification
You can test the LDAP provider by using the ldapsearch tool on Linux and macOS, or the dsquery tool on Windows.
- ldapsearch
- dsquery
To install the ldapsearch tool, use one of the following commands:
sudo apt-get install ldap-utils -y # Debian-based systems
sudo yum install openldap-clients -y # CentOS-based systems
brew install openldap #macOS based systems (requires Homebrew to be installed)
To search the LDAP directory using the previously created ldapservice service account, use the following command:
ldapsearch \
-x \
-H ldap://<LDAP outpost IP address>:389 \
-D 'cn=ldapservice,ou=users,DC=ldap,DC=goauthentik,DC=io' \
-w '<ldapuserpassword>' \
-b 'DC=ldap,DC=goauthentik,DC=io' \
'(objectClass=user)'
This example query will return all users and log the first successful attempt in an event in Events > Logs. Subsequent successful logins from the same user are not logged by default, as they are cached in the outpost. For more details see Bind modes.
In production it is recommended to use LDAPS, which requires ldaps:// as the protocol, and port number 636 rather than 389. See LDAPS for more information.
To search the LDAP directory using the previously created ldapservice service account, use the following command:
dsquery * -s <LDAP outpost IP address> -u "cn=ldapservice,ou=users,DC=ldap,DC=goauthentik,DC=io" -p <ldapuserpassword> -b "DC=ldap,DC=goauthentik,DC=io" -filter "(objectClass=user)"
This example query will return all users and log the first successful attempt in an event in Events > Logs. Subsequent successful logins from the same user are not logged by default, as they are cached in the outpost. For more details see Bind modes.
In production it is recommended to use LDAPS, which requires ldaps:// as the protocol, and port number 636 rather than 389. See LDAPS for more information.