Authentication and LDAP
InfraBuffet supports local accounts and LDAP password authentication. Browser login creates an HTTP-only session cookie; API integrations can use API tokens. Team membership determines ownership and scope access. With LDAP enabled, teams are also created from directory groups when users sign in.
Local accounts and sessions
Create the first administrator with addsuperuser. Superusers can create local users, manage teams and memberships,
and change another user’s credentials or superuser status. Users can update their own email and password.
Local passwords must contain at least eight characters and are stored as bcrypt hashes.
Sessions expire after 30 days with the current fixed lifetime. Logout deletes the current session and clears its cookie; it does not revoke every session or API token owned by the user. Protected requests load the current user, so authorization uses current account and team information rather than a frozen login-time permission set.
How LDAP login works
When LDAP is enabled and a user signs in with a username that has no local account (or whose account came from LDAP), InfraBuffet does the following:
- Connects to the server and binds with the service account (bind DN and password).
- Searches the user base DN with the user filter. The search must match exactly one entry; zero or several matches fail the login.
- Verifies the password by binding as the DN of the entry that was found. InfraBuffet never stores LDAP passwords.
- Searches the group base DN with the team filter to find the user’s groups, keeps those that pass the optional regular expression, and maps each to an InfraBuffet team.
- Creates or updates the local user and teams and replaces the user’s LDAP team memberships with the result.
The user is rejected if the entry lacks the username or email attribute, or if no group is admitted (step 4).
LDAP configuration
Configure LDAP as a superuser in Settings → LDAP. The settings are stored in the database. The form validates DNs, attributes, and filters when you save.
Connection
| Field | Notes |
|---|---|
| Server URL | ldap://host:389 or ldaps://host:636. No credentials, path, query, or fragment. |
| Bind DN, Bind password | A read-only service account. Leave the password blank when editing to keep the current one. |
| CA certificate | Optional PEM bundle for a server with a private CA; requires ldaps://. |
Use ldaps:// in production. ldap:// sends the service and user passwords unencrypted, and InfraBuffet does not
support StartTLS.
User search
| Field | Notes |
|---|---|
| Base DN | Where to look for users, for example ou=people,dc=example,dc=com. All sub-trees are searched. |
| Filter | Must contain {{username}}, which is replaced with the (escaped) name the user typed. |
| Username attribute | Attribute holding the canonical login name, such as uid or sAMAccountName. |
| Email attribute | Attribute holding the email, such as mail. Users without it cannot sign in. |
The canonical username from the directory, not the text typed at login, becomes the InfraBuffet username.
Team search
| Field | Notes |
|---|---|
| Base DN | Where to look for groups, for example ou=groups,dc=example,dc=com. |
| Filter | Selects the groups a user belongs to. Must contain {{member_dn}} (the user’s DN) or {{username}}. |
| Group name attribute | Attribute used as the team name, usually cn. |
| Follow parent groups recursively | Also includes groups that contain the user’s groups (nested groups). |
| Match regular expression | Optional. Only matching groups become teams. Blank admits all groups. |
| Apply regular expression to | Match against the group DN (external ID) or the group name. |
Every group the filter returns is a candidate team. In a large directory, use the regular expression to admit only the
groups meant for InfraBuffet, for example ^cn=infra- applied to the group DN, or ^infra- applied to the name.
When following parent groups, a group that fails the regular expression is still traversed, so a parent group
that does match is found through it.
Filter examples
Filters are LDAP filters in which {{username}} and {{member_dn}} are placeholders. Adapt them to your schema.
| Directory | User filter | Team filter |
|---|---|---|
| OpenLDAP | (&(objectClass=person)(uid={{username}})) | (&(objectClass=groupOfNames)(member={{member_dn}})) |
| AD | (&(objectClass=user)(sAMAccountName={{username}})) | (&(objectClass=group)(member={{member_dn}})) |
For Active Directory, set the username attribute to sAMAccountName, the email attribute to mail, and enable
recursive search if you use nested groups. Recursive search requires {{member_dn}} in the team filter, because the
filter is run again for every group found, with that group’s DN as {{member_dn}}.
Login and synchronization
An existing local account authenticates locally. Existing LDAP accounts authenticate through the configured directory, and an unknown username is looked up there. A user who is rejected for having no admitted group is not created.
LDAP login is the only synchronization: it is not a periodic import of the whole directory. Users and teams appear in InfraBuffet only after someone first signs in, and a user’s memberships are refreshed on each login. Changes made in the directory take effect when the user signs in again; existing sessions are not re-checked against LDAP, so removing someone from a group or disabling them in the directory does not end a session already open (up to 30 days) or revoke their API tokens. Remove the user in InfraBuffet as well when access must stop immediately.
LDAP teams carry their identity source and external ID (the group DN); ownership and permission grants refer to the team’s database ID.
LDAP synchronization does not grant infrastructure creation. Use a local administrator to set allow_create_infra
and other permissions on imported teams.
Diagnose authentication
Wrong credentials and provider failures can both appear as invalid credentials to the caller. Inspect server logs for the provider-side reason. Work through the login steps above:
- Service bind fails: check the URL, bind DN and password, and TLS trust of the CA certificate.
- User not found: check the user base DN and the rendered filter, and that exactly one entry matches. Confirm the entry has the username and email attributes.
- Password rejected: the bind as the user’s DN failed; try the same bind with
ldapwhoamiorldapsearch. - Rejected after the correct password: no group was admitted. Check the team base DN, filter, group name attribute, and regular expression; a readable user entry is not enough.
Keep a local administrator account available for LDAP recovery. Protect the stored bind credentials and database backups. The current cookie lacks the Secure attribute; see deployment for the proxy requirement.