HAProxy ALOHA Documentation 15.5

LDAP Authentication

System administrators can authenticate to HAProxy ALOHA with a user account defined in an external LDAP server, such as Active Directory Domain Services. You can give each user either administrative access (read/write access) or monitoring access (read-only).


Set up the DNS

HAProxy ALOHA must be able to query the Active Directory DNS server.

  1. In the Services tab, click system setup.

  2. Enter the name of your AD Domain, and the IP address of the corresponding DNS server.




    Name of your AD Domain


    IP address of the AD DNS

    service system
        hostname ALOHA1
        rtc utc
        dns_domain mydomain.com
  3. Reload the system service.

  4. Launch a terminal from the web UI's Tools tab or SSH to your HAProxy ALOHA appliance.

  5. Check that HAProxy ALOHA can communicate with the DNS server by querying for a DNS hostname within your domain.

    $ nslookup dc1.mydomain.com

Enable the LDAP authentication module

  1. In the Services tab, click pam setup setup_icon.

  2. Add LDAP support to the PAM service.

    service pam
      ldap_auth 1
  3. Apply your changes to the PAM configuration.

  4. Restart the PAM service.


Configure the local LDAP name service daemon

The HAProxy ALOHA nslcd daemon queries LDAP based on the nslcd.conf configuration file.

  1. Create a user account in Active Directory that HAProxy ALOHA will use to connect to the credentials store. This user should have a password that never expires. For example, you could create a user with the account name alohalogin.

  2. On the HAProxy ALOHA, from the Services tab, click nslcd setup setup_icon.

  3. Allow the nslcd daemon to start automatically.

    service nslcd
  4. In the Services tab, click the [advanced mode] link, then edit the nslcd service.


    The content of the /etc/nslcd.conf NTP configuration file displays.

  5. Adapt the nslcd configuration to your LDAP context.

    Example of an Active Directory with a schema level from 2008 to 2016.

    uid nobody
    gid nobody
    log syslog
    nss_initgroups_ignoreusers ALLLOCAL
    uri ldap://dc1.mydomain.com/
    base dc=mydomain,dc=com
    filter passwd (objectClass=posixAccount)
    filter group (objectClass=posixGroup)
    binddn cn=alohalogin,cn=Users,dc=mydomain,dc=com
    bindpw mypassword
    # To use LDAP over SSL (first, you have to import your CA file through the Web UI)
    # tls_cacertfile /etc/ssl/frontends/AD2008/crt.pem
    pagesize 1000
    referrals off
    idle_timelimit 800
    filter passwd (&(objectClass=user)(objectClass=person)(!(objectClass=computer)))
    map passwd uid sAMAccountName
    map passwd uidNumber objectSid:S-1-5-21-1608350394-2850411632-306912843
    map passwd gidNumber objectSid:S-1-5-21-1608350394-2850411632-306912843
    map passwd homeDirectory "/home/$sAMAccountName"
    map passwd gecos displayName
    map passwd loginShell "/bin/bash"
    filter group (|(objectClass=group)(objectClass=person))
    map group gidNumber objectSid:S-1-5-21-1608350394-2850411632-306912843

    Each LDAP context is specific. You can apply the following template for a standard LDAP deployment.




    URI referring to the LDAP server. Use the ldaps prefix for LDAP over SSL.


    AD search base


    Distinguished Name used to bind to the LDAP directory. You do not need to escape the space character.

    On Windows Server, you can use the dquery command to get the value:

    PS C:\Users\admin> dsquery user -samid 'alohalogin'

    You can also get this value by displaying the Distinguished Name of the account: turn on Advanced Features in the AD Users and Computers View menu, and display its attributes in the Attribute Editor tab.



    The AD user account password used to bind to the LDAP directory.


    AD domain's Domain SID.

    You can display this value by running the following command in a PowerShell terminal on your Domain Controler:

    PS C:\Users\admin> Get-ADDomain | findstr DomainSID
    DomainSID                          : S-1-5-21-1608350394-2850411632-306912843
  6. Restart the nslcd service.

  7. Verify that HAProxy ALOHA can connect to the LDAP server by testing the connection with the ldapsearch command. This command will prompt you to enter the user's password.

    $ ldapsearch -x -H dc1.mydomain.com -D alohalogin@mydomain.com -W -b 'CN=Users,DC=mydomain,DC=com'
    # extended LDIF
    # LDAPv3
    # base <dc=mydomain,dc=com> with scope subtree
    # filter: (objectclass=*)
    # requesting: ALL
    # mydomain.com
    dn: DC=mydomain,DC=com
    objectClass: top
    objectClass: domain
    objectClass: domainDNS
    distinguishedName: DC=mydomain,DC=com
    instanceType: 5
    whenCreated: 20211202085814.0Z




    Use simple authentication.


    URI referring to the LDAP server.


    Distinguished Name used to bind to the LDAP directory.


    Prompt for password.


    AD search base

    If the ldapsearch command fails, check your network configuration.

See also

nslcd - local LDAP name service daemon

Enable login for LDAP users

We assume that the four users in the table above have an account created on the AD domain.

You can, for example, implement the following list of access rights:





Web interface








Serial port


Administration Administration | Monitoring monitor

  1. Launch a terminal from the web UI's Tools tab or SSH to your HAProxy ALOHA appliance.

  2. Edit the file /etc/security/users.conf through the File Manager.

    Add users that have an account on the LDAP server, specifying the following for each:




    The Active Directory user account name.




    wui, sshd, or login. This restricts how a user can log in.

    allow or deny

    Enable or disable user's login.


    • admin for read/write access, or

    • monitor for read-only access.

    These directives implement the example access rights listed at the top of this page.

    user=alice  auth_type=ldap                  : allow map_to_user admin
    user=bob    auth_type=ldap service=wui,sshd : allow map_to_user admin
    user=carol  auth_type=ldap service=wui      : allow map_to_user admin
    user=dave   auth_type=ldap service=wui      : allow map_to_user monitor

    You can also allow access to all users in an AD group:

    group=aloha-admins   auth_type=ldap : allow map_to_user admin
    group=aloha-monitor  auth_type=ldap  : allow map_to_user monitor

Save your configuration

Select the Setup tab and click Save to save your configuration.

The Configuration was successfully saved message displays.


Test your configuration

Before you allow your LDAP users to log in, you should test a PAM configuration before you apply it.

  1. Check that your configuration is parsed correctly:

    $ sudo test_pam_user_map check_config -f /etc/security/users.conf
    Checking config file /etc/security/users.conf
    Config file /etc/security/users.conf parsed successfully
  2. Simulate a local user logging in through ssh:

    $ sudo test_pam_user_map check_pam_auth \
       -f /etc/security/users.conf check_config -u alice -s sshd -t ldap
    Checking PAM access for user alice
    Result: auth_type=ldap allow=1 matched=1 map_to_user=admin
    PAM: access granted
  3. Test your LDAP configuration with a real user and a real password:

    $ sudo test_pam_user_map check_login_pass -f /etc/security/users.conf \
       -u alice -p Hello123Hello123 -s sshd -t ldap
    Validating user=alice password=*** service=sshd
    PAM user has been set to admin
    user/password validated successfully


  • When using SCP, user remapping does not work.

  • When using SSH keys, user remapping does not work (but key-based authentication does).

  • You cannot change the password of an LDAP user using HAProxy ALOHA. If you need to do so, use the tools provided with your LDAP server.


If the message # access denied using ssh, allowed when using login, displays, check the following:

  • The AllowGroups directive is commented out in /etc/ssh/sshd_config.

    $ sudo grep -i AllowGroups /etc/ssh/sshd_config
    # AllowGroups adm users

    If this directive is not commented out, check that your users' groups are allowed:

    $ sudo getent group
  • Check that UsePAM is set to yes in /etc/ssh/sshd_config/.

    $ sudo grep UsePAM /etc/ssh/sshd_config
    UsePAM yes

Next up

RADIUS Authentication