LDAP and Active Directory

Enterprise edition. Directories are part of the Enterprise edition. The community edition refuses to save an LDAP authority (403), and the Directory choice is dimmed in the console.

A directory authority takes the username and password from the ordinary sign-in form and asks the directory itself. No button appears on the sign-in page: there is nowhere to send the browser.

The order is: the local password first, and if that says no, each enabled directory in turn. Someone whose local and directory passwords happen to match comes in through the directory only once local accounts are disabled.

A directory row can reach a community edition through an imported configuration, or a database first written by an Enterprise edition. The community edition carries no directory driver, so such an authority authenticates nobody - the only trace is a directory unavailable line in the log, and the person sees the ordinary "wrong username or password". If local accounts are disabled as well, the sign-in form is still drawn and nobody can get in at all.

The fields

Open Infra > Authentication, click the + button (New authority) and choose Directory.

A directory authority: Directory type, Server URL, Search base, Service account and its password from the vault, User filter, Follow nested groups and the certificate check

Field What to put in it
Directory type LDAP (OpenLDAP and others) or Active Directory. It picks the defaults below
Server URL the scheme is chosen, not typed: ldaps://dc1.acme.io:636 or ldap://...
Switch to TLS before signing in (StartTLS) ldap:// only: the connection turns to TLS before anything is sent. Off by default
Search base where the search starts, dc=acme,dc=io
Service account the DN that performs the search, never a sign-in: cn=meerkat,ou=services,dc=acme,dc=io. Leave it empty for an anonymous search
Service password its password, or a vault reference
User filter %s is replaced by what the person typed, escaped. Empty uses the default of the directory type
Follow nested groups on by default: a group that contains a group counts
Skip the certificate check (self-signed directory) for a self-signed directory only

What the directory type decides, when you leave the matching field empty:

LDAP (OpenLDAP and others) Active Directory
User filter (&(objectClass=inetOrgPerson)(uid=%s)) (&(objectClass=user)(sAMAccountName=%s))
Username attribute uid sAMAccountName
Name attribute cn displayName
E-mail attribute mail mail
Groups read from a search by member or uniqueMember the memberOf attribute, then a nested-membership search

The attribute names, the group search base, the group filter and the group name attribute have no box in the console: they are set through the admin API (PUT /api/auth-providers/<id>) or a configuration file, in the authority's config. Everything else is on the screen.

Example: Active Directory

A domain acme.io, its domain controller dc1.acme.io, and a service account created for Meerkat in a Services organisational unit:

Field Value
Directory type Active Directory
Server URL ldaps://dc1.acme.io:636
Search base dc=acme,dc=io
Service account cn=meerkat,ou=Services,dc=acme,dc=io
Service password the account's password, moved into the vault
User filter empty: (&(objectClass=user)(sAMAccountName=%s)), so people type their Windows login

The same authority as the admin API returns it, with the attributes that have no box set to their Active Directory values (a secret left empty in a PUT keeps the one stored):

{
  "id": "corp-ad",
  "kind": "ldap",
  "name": "Corporate directory",
  "enabled": true,
  "config": {
    "dialect": "ad",
    "url": "ldaps://dc1.acme.io:636",
    "baseDn": "dc=acme,dc=io",
    "bindDn": "cn=meerkat,ou=Services,dc=acme,dc=io",
    "bindPassword": "$ad-bind-password",
    "usernameAttr": "sAMAccountName",
    "emailAttr": "mail",
    "nameAttr": "displayName",
    "memberOfAttr": "memberOf",
    "groupIdAttr": "cn",
    "groupBaseDn": "ou=Groups,dc=acme,dc=io",
    "nestedGroups": true
  }
}

To let people type alice@acme.io rather than alice, write the user filter (&(objectClass=user)(userPrincipalName=%s)).

Search, then bind

That is the whole sequence, and it matters because the service account never sees anybody's password:

  1. an empty username or an empty password is refused immediately - an empty password is an anonymous bind, and an anonymous bind succeeds;
  2. connect;
  3. bind as the service account, if one is configured;
  4. search the subtree from the search base with the user filter, at most two entries. No entry means "wrong username or password". Two or more entries and the sign-in is refused, naming the ambiguity, rather than picking one;
  5. bind as the person, with the DN just found and the password they typed. That is the only use the password is put to;
  6. bind back as the service account before reading groups;
  7. read the identity: the entry's DN becomes the stable subject, plus username, full name, e-mail and groups.

An address that comes from a directory is treated as verified: a directory is authoritative about its own people. A directory sign-in whose address an existing local account holds may therefore be joined to it, but only once that account has proved it is theirs: see Joining an authority to an existing account.

Group names are the leaf of the DN, not the DN: cn=developer,ou=groups,dc=acme,dc=io is reported as developer. They become memberships and roles through a group rule on a tenant.

TLS

TLS happens when the URL starts with ldaps://, or on ldap:// with StartTLS ticked: the connection turns to TLS before the bind, with the same settings, and a directory that does not offer StartTLS is refused rather than used in clear. An ldap:// address without StartTLS is accepted, and the console says under it that passwords travel in clear. The minimum version is TLS 1.2. There is no client certificate and no custom certificate authority: for a directory with a self-signed certificate, the honest option on the screen is Skip the certificate check.

Test the connection

Click Create first: a new authority is created switched off, and the test runs on a saved one. Then open it again:

The Test section of a directory authority: a login to look up, and the groups seen at sign-in

Check that it works

  1. Turn on the switch on the authority's row.
  2. In a private window, open https://<data-plane>/login. There is no directory button: type a directory user's login and password in the ordinary form.
  3. A first sign-in lands on the waiting page. In the console, the account now appears in Application > Users: place it in a tenant and grant it roles (Tenants, the tenant, Members).

The groups the directory reported show under Seen at sign-in, in the authority's drawer: those are the names a group rule maps to roles.

Two things a directory does that a redirect authority cannot

It re-validates. When someone signs in with a passkey, Meerkat asks the directory whether it still knows that person before letting them through. A clear "no such object" revokes the sign-in; any other error means "could not ask", and nobody is signed out because a server was briefly unreachable. Identity providers reached by redirect have no such question, so they never revoke a passkey sign-in.

It can be the only authority. With local accounts disabled and a directory enabled, the sign-in form is still the way in - it is the directory's form as much as the local one.