website/docs/add-secure-apps/providers/ldap/create-ldap-provider.mdx
import TabItem from "@theme/TabItem"; import Tabs from "@theme/Tabs";
Creating an authentik LDAP provider requires the following steps:
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.
You'll need to create the stages that make up the flow.
First, you'll need to create a Password Stage.
ldap-authentication-password-stage).Next, you'll need to create an Identification Stage.
ldap-identification-stage).Username and Email (and UPN if it is relevant to your setup).ldap-authentication-password-stage)Finally, you'll need to create a User Login Stage.
ldap-authentication-login-stage).Now you'll need to create the LDAP authentication flow and bind the previously created stages.
ldap-authentication-flow).Authentication.ldap-identification-stage), set the order to 10, and click Create.ldap-authentication-login-stage), set the order to 30, and click Create.The LDAP application and provider can now be created.
:::info
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 to bind to LDAP with.
ldapservice) and click Create.:::info Default DN of service account
The default DN of this user will be cn=ldapservice,ou=users,dc=ldap,dc=goauthentik,dc=io
:::
The service account needs permissions to search the LDAP directory. You'll need to create a role with the permission and assign the service account to that role.
LDAP search) and then click Create.LDAP search), enable the Search full LDAP directory permission, and then click Assign.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:
LDAP.Click Create.
:::warning Multiple LDAP providers The LDAP Outpost selects different providers based on their Base DN. Adding multiple providers with the same Base DN will result in inconsistent access. :::
You can test the LDAP provider by using the ldapsearch tool on Linux and macOS, or the dsquery tool on Windows.
<Tabs defaultValue="ldapsearch" values={[ { label: "ldapsearch", value: "ldapsearch" }, { label: "dsquery", value: "dsquery" }, ]}
<TabItem value="ldapsearch">
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.
:::warning LDAPS
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.
:::warning LDAPS
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.
:::