Skip to content

Configure LDAP / Active Directory

Licence

LDAP is an Enterprise feature (ldap in the licence). Without it, LDAP login is refused as if LDAP were disabled and Tester la connexion answers 403.

Repod supports authenticating users against an LDAP directory or Microsoft Active Directory. Once configured, users can log in with their existing corporate credentials. Repod uses the ldap3 Python library for all LDAP communication.


1. Prerequisites

Before you open the Repod settings screen, gather the following information from your directory administrator:

Information needed Example
LDAP server hostname or IP ldap.example.com
Port 389 (LDAP), 636 (LDAPS), 3268 (AD Global Catalog)
Transport security Plain, STARTTLS, or SSL/TLS
Bind DN cn=repod-svc,ou=service-accounts,dc=example,dc=com
Bind password The password for the bind account
Base DN ou=users,dc=example,dc=com
User search filter (&(objectClass=person)(uid={username})) (OpenLDAP) or (&(objectClass=user)(sAMAccountName={username})) (AD)
Username attribute uid (OpenLDAP) or sAMAccountName (AD)
Email attribute mail
Group DNs (if using role mapping) cn=repod-admins,ou=groups,dc=example,dc=com
A memberOf attribute on user entries (if using role mapping) Native in Active Directory; OpenLDAP needs the memberof overlay (see step 3)

Tip

Use a dedicated read-only service account as the bind DN. This account only needs read permission on the user and group subtrees. Never use a domain administrator account as the bind account.


2. Step 1 — Open LDAP settings

  1. Log in to the Repod web interface at http://repod.example.com:3003 as an administrator.
  2. Navigate to Administration → Paramètres, section LDAP / Active Directory.
  3. The LDAP configuration panel appears. LDAP is disabled by default until you save a valid configuration and turn on Activer l'authentification LDAP.

3. Step 2 — Configure the connection

Fill in the connection fields using the information you gathered in the prerequisites section.

Field Description
Hôte Hostname or IP address of your LDAP server. Do not include a scheme (ldap://) — that is controlled by the SSL/STARTTLS toggles below.
Port TCP port. Defaults to 389 for unencrypted/STARTTLS and 636 for LDAPS.
SSL/LDAPS (port 636) Enable to wrap the entire connection in TLS (connect on port 636). Mutually exclusive with STARTTLS.
STARTTLS Enable to upgrade a plain connection to TLS after the initial handshake (port 389). Preferred over unencrypted when LDAPS is not available.
Accepter les certificats auto-signés Off by default: Repod validates the server certificate against the system CA bundle. Turn it on only in test environments — never in production.
Chemin bundle CA Optional, shown while self-signed certificates are not accepted. Path to a custom CA certificate file (PEM format) inside the backend container, for internal CAs not in the system bundle.
Bind DN The full distinguished name of the service account used to search the directory.
Mot de passe Password for the bind account. Stored encrypted at rest.
Base DN de recherche The root of the directory subtree to search for users.
Filtre utilisateur The complete LDAP search filter. It must contain {username}, which Repod replaces with what the person types at login. Example: (&(objectClass=inetOrgPerson)(uid={username})). The interface refuses to save a filter without it, and a saved one without it denies every login (see the warning below)
Attribut login The LDAP attribute that holds the login name. uid for OpenLDAP, sAMAccountName for Active Directory.
Attribut email The LDAP attribute that holds the user's email address. Usually mail.
Attribut nom complet The LDAP attribute that holds the user's full name. Usually displayName.
Attribut groupes The attribute of the user entry that lists the groups the user belongs to. Default memberOf. Role mapping (next step) reads this attribute and nothing else.

The filter must contain {username}

Without {username}, the search returns the same entry (the first one in the directory) whatever name is typed, and the password is then checked against that account. Anyone who knows that account's password could log in under its identity with any user name. Repod now refuses to save such a filter and denies the login if one is already stored.

Never disable certificate verification in production

Turning on Accepter les certificats auto-signés disables all certificate validation. A man-in-the-middle attacker on your network could intercept credentials. This setting exists only for isolated test environments with self-signed certificates. In production, leave it off and set Chemin bundle CA to your internal CA certificate instead.


4. Step 3 — Map groups to roles

Repod can assign roles to users automatically based on their LDAP group membership. Configure the mapping in Administration → Paramètres, section LDAP / Active Directory in the Mapping groupes → rôles block, one field per role.

Field Key in the settings Repod role granted
Administrateur group_admin admin
Mainteneur group_maintainer maintainer
Packager / CI-CD group_uploader uploader
Auditeur group_auditor auditor
Lecteur group_reader reader

Example mapping:

LDAP group (full DN) Repod role
cn=repod-admins,ou=groups,dc=example,dc=com admin
cn=repod-maintainers,ou=groups,dc=example,dc=com maintainer
cn=repod-publishers,ou=groups,dc=example,dc=com uploader
cn=repod-auditors,ou=groups,dc=example,dc=com auditor
cn=repod-readers,ou=groups,dc=example,dc=com reader

Available Repod roles:

Role Permissions
admin Full access: user management, settings, GPG, CVE decisions.
maintainer Package lifecycle: upload, delete, quarantine, CVE decisions, audit logs.
uploader Upload and import packages. Cannot delete, manage users, or access audit logs.
auditor Read-only: audit logs, CVE review queue, all packages. Cannot upload or write anything.
reader Read-only access to package listings and dashboard.

How the groups are read. Repod reads the memberOf attribute of the user entry (the field Attribut groupes changes the attribute name), never the member list of the group. Each value is compared to your mapping exactly, ignoring case and spaces around commas. Three forms are accepted:

You write in the mapping Matches the group
cn=repod-admins,ou=groups,dc=example,dc=com (full DN) that group only
cn=repod-admins (first part of the DN) any group with that name, wherever it sits
repod-admins (the CN value) the same

A part of a name never matches: admins does not match cn=sysadmins,.... Use the full DN when two groups can share a name.

OpenLDAP does not provide memberOf by default

Active Directory maintains memberOf on every user. A standard OpenLDAP does not: groups list their members, and the users carry nothing. Without the memberof overlay, every user gets the default role, even a member of the mapped administrator group (tested on OpenLDAP 2.4 with groupOfNames). Enable the overlay on the server, or leave the mapping empty and assign roles in Repod.

Repod evaluates the mapped roles in priority order (admin > maintainer > uploader > auditor > reader) and assigns the highest matching role. If a user belongs to no mapped group, the Rôle par défaut is applied (reader unless you changed it).

Note

Group membership is evaluated at login time. If you add a user to a group in LDAP, they receive the corresponding Repod role on their next login — no manual role assignment is needed (with auto-provisioning on, see step 4).


5. Step 4 — Enable auto-provisioning

When Auto-provisionnement is turned on, Repod creates a local user record the first time a person successfully authenticates via LDAP. The local record stores:

  • Username (from the username attribute)
  • Email (from the email attribute)
  • Role (from group mapping, or the default role if no mapping matches)
  • A flag marking the account as LDAP-managed

LDAP-managed accounts cannot have their password changed in Repod — authentication always defers to the LDAP directory. On each login Repod also refreshes the role from the groups.

If auto-provisioning is off, Repod creates nothing: a person with no LDAP-managed account yet is refused (403, Aucun compte Repod pour cet utilisateur), even with a correct directory password, and an existing account keeps its role (it is no longer refreshed from the groups). An administrator cannot create an LDAP account by hand (the user form only offers local and SSO accounts), so leave auto-provisioning on unless every person who needs access has already logged in once.

Two rules apply whatever this setting is:

  • A local account with the same user name wins. Repod checks local accounts first and never asks the directory for them. To move a local account to LDAP, delete it and let the person log in again.
  • A deactivated account is refused (403, Compte désactivé) even when the directory accepts the password. Deactivating the account in Repod is the way to cut one person off without touching the directory.

6. Step 5 — Test the connection

Before saving and enabling LDAP, use the Tester la connexion button at the bottom of the LDAP card.

What the test does:

  1. Opens a TCP connection to the LDAP server on the configured host and port.
  2. Negotiates TLS if SSL or STARTTLS is enabled.
  3. Binds as the service account using the bind DN and password.
  4. Checks that the Base DN exists and that the service account can read it.
  5. Checks that the user filter contains {username}.

What it does not do: it does not search for a user, does not test any person's password and does not test the group mapping. Do those with the first login (next step).

Interpreting the result:

Message Meaning
Connexion établie sur … The connection, the service account and the Base DN are correct. Click Sauvegarder (bar at the bottom of the page) and turn LDAP on.
Compte de service refusé : bind DN ou mot de passe incorrect. The bind DN or the bind password is wrong.
Base DN introuvable The Base DN does not exist, or the service account is not allowed to read it.
Certificat TLS du serveur non approuvé The server certificate is not trusted. See troubleshooting below.
Serveur injoignable : vérifiez l'hôte, le port et le pare-feu. Wrong host or port, or a firewall blocks the connection.
Adresse du serveur invalide ou introuvable The host name does not resolve.
Le filtre utilisateur doit contenir {username} Fix the filter, see the warning above.

The technical detail from the LDAP library follows the message, between parentheses.

Tip

If the test fails with a network error, verify connectivity from inside the backend container: docker compose exec backend python3 -c "import socket; socket.create_connection(('ldap.example.com', 389), 5); print('ok')" (the image has neither nc nor ldapsearch)


7. Step 6 — First LDAP login

Once LDAP is enabled and the configuration is saved:

  1. Open the Repod login page.
  2. Enter your LDAP username (the value of sAMAccountName or uid, not the full DN).
  3. Enter your LDAP password.
  4. Click Se connecter.

Repod binds to the directory as the service account, searches for the user, verifies the credentials, evaluates group membership, and creates or updates the local user record.

A wrong password answers Identifiants incorrects (401) and counts as a failed login. Serveur LDAP indisponible (503) means something else: the directory cannot be reached, or the service account is refused. Check the test of the previous step.

The JWT issued after a successful LDAP login is identical to one issued after a local login — all API calls use the same Authorization: Bearer <token> header regardless of authentication method.


8. OpenLDAP example configuration

A typical OpenLDAP deployment using uid as the username attribute:

Field Value
Hôte openldap.example.com
Port 636
SSL/LDAPS (port 636) On
STARTTLS Off
Accepter les certificats auto-signés Off
Bind DN cn=repod-svc,ou=service-accounts,dc=example,dc=com
Mot de passe s3cr3tpassword
Base DN de recherche ou=users,dc=example,dc=com
Filtre utilisateur (&(objectClass=inetOrgPerson)(uid={username}))
Attribut login uid
Attribut email mail

Group mapping (this works only if the memberof overlay is enabled on the server, see the warning in step 3):

LDAP group DN Repod role
cn=repod-admins,ou=groups,dc=example,dc=com admin
cn=repod-maintainers,ou=groups,dc=example,dc=com maintainer
cn=developers,ou=groups,dc=example,dc=com uploader

9. Active Directory example configuration

Active Directory uses sAMAccountName for short-form usernames or userPrincipalName for UPN-style (user@domain) logins.

Field Value
Hôte dc01.corp.example.com
Port 636
SSL/LDAPS (port 636) On
STARTTLS Off
Accepter les certificats auto-signés Off
Bind DN CN=repod-svc,OU=Service Accounts,DC=corp,DC=example,DC=com
Mot de passe s3cr3tpassword
Base DN de recherche OU=Employees,DC=corp,DC=example,DC=com
Filtre utilisateur (&(objectClass=user)(sAMAccountName={username}))
Attribut login sAMAccountName
Attribut email mail

sAMAccountName vs userPrincipalName

Use sAMAccountName if your users log in with their short username (jsmith). Use userPrincipalName if they log in with their UPN ([email protected]). The attribute name must match exactly what your users type into the Repod login field — there is no automatic normalisation.

Group mapping for AD security groups:

LDAP group DN Repod role
CN=Repod-Admins,OU=Groups,DC=corp,DC=example,DC=com admin
CN=Repod-Publishers,OU=Groups,DC=corp,DC=example,DC=com uploader
CN=All-Staff,OU=Groups,DC=corp,DC=example,DC=com reader

For Active Directory Global Catalog queries (searching across multiple domains), use port 3268 (plain) or 3269 (SSL) instead of the standard LDAP ports.


10. Troubleshooting

CERTIFICATE_VERIFY_FAILED

The LDAP server's TLS certificate is not signed by a CA in the backend container's system bundle.

Options: 1. Recommended: Mount your internal CA certificate into the backend container and set the Chemin bundle CA field to its location.

# In docker-compose.yaml, under the backend service:
volumes:
  - /etc/ssl/certs/internal-ca.pem:/etc/ssl/certs/internal-ca.pem:ro
Then set Chemin bundle CA to /etc/ssl/certs/internal-ca.pem.

  1. Test environments only: turn on Accepter les certificats auto-signés in the LDAP settings. Never do this in production.

Compte de service refusé : bind DN ou mot de passe incorrect

The bind DN or bind password is incorrect.

  • Double-check the bind DN format. Active Directory requires the full CN=...,DC=... form, not just the username.
  • Verify the service account password has not expired. AD service accounts should have password expiry disabled.
  • Confirm the service account has not been locked out due to failed login attempts from a previous misconfigured connection test.

Base DN introuvable

The base DN does not exist in the directory, or the service account is not allowed to read it. An LDAP server answers the same way in both cases.

  • Check the exact spelling of the Base DN, then check the service account's read permission on that subtree.
  • Verify it from any machine that has the OpenLDAP client tools (the Repod backend image does not include ldapsearch):
    ldapsearch -H ldaps://ldap.example.com \
      -D "cn=repod-svc,ou=service-accounts,dc=example,dc=com" \
      -w "s3cr3tpassword" \
      -b "ou=users,dc=example,dc=com" \
      "(uid=testuser)"
    
  • If the command returns the user, the Base DN is correct and the issue is elsewhere. If it returns No such object, the Base DN is wrong or unreadable.

Everyone gets the default role (group mapping not applied)

Users log in successfully but receive the wrong role, usually reader.

  1. Check that the user entry has a memberOf attribute. This is the only thing Repod reads:
    ldapsearch -H ldaps://ldap.example.com \
      -D "cn=repod-svc,ou=service-accounts,dc=example,dc=com" -w "s3cr3tpassword" \
      -b "ou=users,dc=example,dc=com" "(uid=testuser)" memberOf
    
    No memberOf line means the directory does not provide it. On OpenLDAP, enable the memberof overlay, then re-create the groups (existing members are not back-filled); or change Attribut groupes if your directory uses another attribute.
  2. Compare the value with your mapping. The comparison is exact (case and spaces around commas are ignored). A mapping that is only a part of the name (admins) does not match cn=sysadmins,....
  3. In Active Directory, only direct membership shows in memberOf: a user in a group nested inside the mapped group does not match.

Serveur LDAP indisponible on every login (503)

Repod could not talk to the directory, or the service account is refused. Run Tester la connexion: it tells which. A wrong user password never gives this message (it gives Identifiants incorrects, 401).


Every login is refused, with no error in the interface

Look at the backend log for user_filter ne contient pas {username}: the stored filter is missing the placeholder. Fix it in Filtre utilisateur and save.