website/docs/users-sources/sources/protocols/kerberos/index.md
This source allows users to enroll themselves with an existing Kerberos identity.
The following placeholders are used in this guide:
REALM.COMPANY is the Kerberos realm.authentik.company is the FQDN of the authentik install.Examples are shown for an MIT Krb5 KDC system; you might need to adapt them for you Kerberos installation.
There are three ways to use the Kerberos source:
You can choose to use one or several of those methods.
In the authentik Admin interface, under Directory > Federation and Social login, create a new source of type Kerberos with these settings:
kerberosREALM.COMPANYNo extra configuration is required. Simply select the Kerberos backend in the password stage of your flow.
Note that this only works on users that have been linked to this source, i.e. they must have been created via sync or via SPNEGO.
The sync process uses the Kerberos V5 administration system to list users. Your KDC must support it to sync users with this source.
You need to create both a principal (a unique identity that represents a user or service in a Kerberos network) for authentik and a keytab file:
$ kadmin
> add_principal authentik/[email protected]
> ktadd -k /tmp/authentik.keytab authentik/[email protected]
> exit
$ cat /tmp/authentik.keytab | base64
$ rm /tmp/authentik.keytab
In authentik, configure these extra options:
authentik/[email protected]If you do not wish to use a keytab, you can also configure authentik to authenticate using a password, or an existing credentials cache.
You need to create both a principal (a unique identity that represents a user or service in a Kerberos network) for authentik and a keytab file:
$ kadmin
> add_principal HTTP/[email protected]
> ktadd -k /tmp/authentik.keytab HTTP/[email protected]
> exit
$ cat /tmp/authentik.keytab | base64
$ rm /tmp/authentik.keytab
In authentik, configure these extra options:
If you do not wish to use a keytab, you can also configure authentik to use an existing credentials cache.
You can also override the SPNEGO server name if needed.
You might need to configure your web browser to allow SPNEGO. Check out our documentation on how to do so. You can now login to authentik using SPNEGO.
If your authentik instance is accessed from multiple domains, you might want to force the use of a specific server name. You can do so with the Custom server name option. The value must be in the form of [email protected].
If not specified, the server name defaults to trying out all entries in the keytab/credentials cache until a valid server name is found.
There are some extra settings you can configure:
See the overview for information on how property mappings work with external sources.
By default, authentik ships with pre-configured mappings for the most common Kerberos setups. These mappings can be found on the Kerberos Source Configuration page in the Admin interface.
Kerberos property mappings are used when you define a Kerberos source. These mappings define which Kerberos property maps to which authentik property. By default, the following mappings are created:
K/M or kadmin/admin are ignored.HTTP/authentik.company) have their user type set to service account.These property mappings are configured with the most common Kerberos setups.
The following variable is available to Kerberos source property mappings:
principal: a Python string containing the Kerberos principal. For example [email protected] or HTTP/[email protected].When the property mapping is invoked from a SPNEGO context, the following variable is also available:
spnego_info: a Python dictionary with the following keys:
initiator_name: the name of the initiator of the GSSAPI security contexttarget_name: the name of the target of the GSSAPI security contextmech: the GSSAPI mechanism used. Should always be Kerberosactual_flags: the flags set on the GSSAPI security contextWhen the property mapping is invoked from a synchronization context, the following variable is also available:
principal_obj: a Principal object retrieved from the KAdmin APIIf you need to skip synchronization for a specific object, you can raise the SkipObject exception. To do so, create or modify a Kerberos property mapping to use an expression to define the object to skip.
Example:
localpart, realm = principal.rsplit("@", 1)
if localpart == "username":
raise SkipObject
You can start authentik with the KRB5_TRACE=/dev/stderr environment variable for Kerberos to print errors in the logs.
Reverse proxy caching can break the Kerberos authentication flow because, during negotiation, the server sends a second 401 Unauthorized response containing the WWW-Authenticate header that the client needs to continue the handshake; if the reverse proxy caches that 401 instead of forwarding it to authentik, the authentication process fails, so response caching should be disabled on any reverse proxy routes involved in Kerberos authentication.