Skip to main content

LDAP / AD authentication

Medulla can use an LDAP directory or Microsoft Active Directory to authenticate users.

Users log in with their usual username and password. Medulla verifies their identity against the directory, then manages their profiles, entities, and access permissions locally.

Important:
The LDAP or Active Directory directory verifies the user’s identity. Access permissions for Medulla are still managed within Medulla.


How it works

When a user logs in for the first time:

  1. The user enters their username and password
  2. Medulla queries the LDAP directory or Active Directory
  3. The directory verifies the credentials
  4. If authentication is successful, Medulla automatically creates the user
  5. An administrator then assigns the user a profile and an entity

Note:
Upon first login, the user may be authenticated successfully without immediately having the necessary permissions to access Medulla.


Prerequisites

Before you begin, obtain the following information from the directory administrator:

  • the LDAP or Active Directory server address;
  • the Base DN;
  • the account used to query the directory, known as the Bind DN;
  • the password for the Bind account;
  • the attribute used as the login identifier.

For Active Directory, the attribute used is generally:

sAMAccountName

For a standard LDAP directory, it may be:

uid

Download the configuration script

Download the following script to the Medulla server:

https://dl.medulla-tech.io/ma/change_ldap_parameters.py

Then make the script executable:

chmod +x change_ldap_parameters.py

To view help:

./change_ldap_parameters.py --help

Note:
All parameters in the script are required.


Configure LDAP authentication

Run the script, replacing the example values with those from your directory.

./change_ldap_parameters.py \
    --base-dn "DC=domain,DC=local" \
    --fqdn-ldap "ldaps://ad-server.domain.local" \
    --dn-bind "CN=medulla.bind,OU=Infra,DC=domain,DC=local" \
    --pass-bind "MyPassword" \
    --attr "sAMAccountName"

Parameter descriptions

Parameter Description
--base-dn Location in the directory where Medulla searches for users
--fqdn-ldap Full address of the LDAP or LDAPS server
--dn-bind Account used by Medulla to query the directory
--pass-bind Bind account password
--attr Attribute used as the login identifier

Caution:
The Bind account password appears in the command. Do not copy this command into any documentation, support ticket, or unsecured message.


LDAP or LDAPS

Two modes are primarily used:

Mode Port Description
LDAP 389 Unencrypted connection, unless StartTLS is configured
LDAPS 636 Encrypted connection using a TLS certificate

Recommendation:
Use LDAPS in production to encrypt traffic between Medulla and the directory.

When using LDAPS

Verify that:

  • the LDAP server certificate is valid;
  • the Medulla server recognizes the certificate authority;
  • the DNS name used matches the name in the certificate;
  • port 636 is accessible.

A user's first login

After configuration, ask the user to log in to Medulla for the first time using their LDAP or Active Directory account.

This first login allows Medulla to automatically create the user’s account.

It is normal for the following message to appear:

You do not have required rights

Note:
This message means that authentication was successful, but no profile or entity has yet been assigned to the user.


Assign permissions to the user

Step 1 – Log in as an administrator

Log in with an account authorized to manage users and entities.

For the initial setup, it is recommended to use the root account.

Step 2 – Open user management

Go to the menu:

Administration
    └── Entities Management

Select the relevant entity, then click:

Manage Users

Accessing user management in Medulla

Step 3 – Edit the user

Search for the user created during their first login, then click:

Edit

Editing a user in Medulla

Step 4 – Set permissions

Assign:

  • a profile;
  • an entity;
  • recursive mode if the profile should apply to subentities.

Available profiles include:

  • Super-Admin;
  • Admin;
  • Technician.

Then save the changes.

Principle of least privilege:
Grant only the necessary permissions. The Super-Admin profile should be reserved for platform administrators.


Validate access

After assigning permissions:

  1. Ask the user to log out
  2. Ask them to log back in with their LDAP or Active Directory account
  3. Verify that they can access the intended entities and features

Troubleshooting

The user receives the message “You do not have required rights”

Authentication is working, but no permissions have been assigned yet.

Assign a profile and an entity, then ask the user to log in again.

The user does not appear in Medulla

Verify that:

  • the user has logged in for the first time;
  • their account is active in the directory;
  • they are located within the scope defined by the Base DN;
  • the Bind account can read their information;
  • the identification attribute is correct;
  • the Medulla server can connect to the directory.

The LDAP connection fails

Check:

  • the LDAP server address;
  • the Base DN;
  • the Bind DN;
  • the Bind account password;
  • that port 389 or 636 is open;
  • the certificate if LDAPS is used.

The user account is rejected

Verify that the account:

  • is not locked;
  • is not disabled;
  • does not have an expired password;
  • uses the correct username format.

Best practices

  • Use LDAPS in production
  • Use a Bind account dedicated to Medulla
  • Grant only read permissions to the Bind account
  • Regularly renew the Bind account’s password
  • Limit the Base DN to the necessary scope
  • Maintain a native Medulla administrator account
  • Regularly check the assigned profiles and entities

Summary

Element Description
Authentication LDAP or Active Directory
Automatic account creation Yes, upon first login
Automatic assignment of permissions No
Common Active Directory attribute sAMAccountName
LDAP port 389
LDAPS port 636
Recommended mode LDAPS
Action after first login Assign a profile and an entity
New login required Yes

Best practice:
Always ask new users to log in for the first time before assigning them their permissions. This allows Medulla to automatically create their account and then apply their profile and entity the next time they log in.