How-to: Make Hadoop Accessible via LDAP

Categories: Hadoop How-to Hue Platform Security & Cybersecurity

Integrating Hue with LDAP can help make your secure Hadoop apps as widely consumed as possible.

Hue, the open source Web UI that makes Apache Hadoop easier to use, easily integrates with your corporation’s existing identity management systems and provides authentication mechanisms for SSO providers. So, by changing a few configuration parameters, your employees can start analyzing Big Data in their own browsers under an existing security policy.

In this blog post, you’ll learn details about the various features and capabilities available in Hue for integrating with likely the most popular authentication mechanism, LDAP. (It is also possible to authenticate Hue users via PAM, SPNEGO, OpenID, OAuth, and SAML, but those topics are for another post.)


The typical authentication scheme for Hue takes the following form:

In the above diagram, credentials are validated against the Hue database. Often it’s easier to manage identities from a central location; with the Hue LDAP integration, users can use their LDAP credentials to authenticate and inherit their existing groups transparently. There is no need to save or duplicate any employee password in Hue:

When authenticating via LDAP, Hue validates login credentials against a directory service if configured with this authentication backend:


The LDAP authentication backend will automatically create users that don’t exist in Hue by default. Hue needs to import users in order to properly perform the authentication. (The password is never imported when importing users.) However, you may want to disable automatic import at times to allow logins only by a predefined list of manually imported users. For those cases, you can use the following configuration to disable automatic import:


The case sensitivity of the authentication process is defined in the “Case Sensitivity” section below.

There are two different ways to authenticate with a directory service through Hue:

Search Bind

The search-bind mechanism for authenticating will perform an ldapsearch against the directory service and bind using the found distinguished name (DN) and password provided. This is, by default, used when authenticating with LDAP. The configurations that affect this mechanism are outlined in the “LDAP Search” section below.

Direct Bind

The direct-bind mechanism for authenticating will bind to the LDAP server using the username and password provided at login. You can choose between two options for how Hue binds:

  • nt_domain – Domain component for User Principal Names (UPN) in active directory. This Active Directory-specific idiom allows Hue to authenticate with Active Directory without having to follow LDAP references to other partitions. This typically maps to the email address of the user or the user’s ID in conjunction with the domain.
  • ldap_username_pattern – Provides a template for the DN that will ultimately be sent to the directory service when authenticating.

If nt_domain is provided, Hue will use a UPN to bind to the LDAP service:


Otherwise, the ldap_username_pattern configuration is used. (The parameter will be replaced with the username provided at login):


Typical attributes to search for include:

  • uid
  • sAMAccountName


To enable direct bind authentication, the search_bind_authentication configuration must be set to false:


Importing Users

If an LDAP user must belong to a certain group and have a particular set of permissions, you can import this user via the Useradmin interface:

As you can see above, there are two options available when importing:

  • Distinguished name – If this option is checked, the username provided must be a full distinguished name (for example: uid=hue,ou=People,dc=gethue,dc=com). Otherwise, the Username provided should be a fragment of a Relative Distinguished Name (rDN). (For example, the username “hue” maps to the rDN “uid=hue”.) Hue will perform an LDAP search using the same methods and configurations as defined in the “LDAP Search” section; essentially, Hue will take the provided username and create a search filter using the user_filter and user_name_attr configurations.
  • Create home directory – If this option is checked, when the user is imported and their home directory in HDFS will automatically be created, if it doesn’t already exist.

The case sensitivity of the search and import processes are defined in the “Case Sensitivity” section.

Importing Groups

Groups are importable via the Useradmin interface. Then, you can add users to this group, which would provide a set of permissions (such as accessing the Impala application). This function works similarly to user importing, but has a couple of extra features.

As the above image portrays, not only can groups be discovered via DN and rDN search, but users that are members of the group and members of the group’s subordinate groups can be imported as well. Posix groups and members are automatically imported if the group found has the object class posixGroup.

Synchronizing Users and Groups

Users and groups can be synchronized with the directory service via the Useradmin interface or via a command-line utility. The images from the previous sections use the words “Sync” to indicate that when a name of a user or group that exists in Hue is added, it will actually be synchronized instead. In the case of importing users for a particular group, new users will be imported and existing users will be synchronized. (Note: Users who have been deleted from the directory service will not be deleted from Hue. You can manually deactivate those users from Hue via the Useradmin interface.)

Attributes synchronized

Currently, only the first name, last name, and email address are synchronized. Hue looks for the LDAP attributes givenName, sn, and mail when synchronizing.  Also, the user_name_attr config is used to appropriately choose the username in Hue. For example, if user_name_attr is set to “uid”, then the uid returned by the directory service will be used as the username of the user in Hue.

Useradmin interface

The “Sync LDAP users/groups” button in the Useradmin interface will automatically synchronize all users and groups.

Command-line interface

Here’s a quick example of how to use the command line interface to synchronize users and groups:


LDAP Search

There are two configurations for restricting the search process:

  • user_filter – General LDAP filter to restrict the search
  • user_name_attr – The attribute that will be considered the username against which to search

Here is an example configuration:


With the above configuration, the LDAP search filter will take the form:


Case Sensitivity

You can configure Hue to ignore the case of usernames as well as force usernames to lower case via the ignore_username_case and force_username_lowercase configurations. These two configurations should be used in conjunction with each other. This is useful when integrating with a directory service containing usernames in capital letters and UNIX usernames in lowercase letters (which is a Hadoop requirement). Here is an example of configuring them:


LDAPS/StartTLS support

Secure communication with LDAP is provided via the SSL/TLS and StartTLS protocols. It allows Hue to validate the directory service to which it’s going to converse. Practically speaking, if a Certificate Authority Certificate file is provided, Hue will communicate via LDAPS:


The StartTLS protocol can be used as well (step up to SSL/TLS):



The Hue team is working hard to improve security. Upcoming LDAP features include: Import nested LDAP groups and multi-domain support for Active Directory. We hope this brief overview of LDAP in Hue will help you make your system more secure, more compliant with current security standards, and open up big data analysis to many more users!

As always, feel free to contact us at hue-user@ or @gethue!

Abe Elmahrek is a Software Engineer at Cloudera.


3 responses on “How-to: Make Hadoop Accessible via LDAP

  1. TomZ

    Thank you for the detailed HUE/LDAP article. Not sure if this is the proper form to post questions (if so, I can provide more details, configs, logs, etc.). However, I am currently having trouble with using LDAP to integrate with Active Directory on two levels:

    1. How to ensure an account gets created in HUE, notably superuser, once you switch to backend=LDAP.

    2. The following in error.log when I try logging into HUE with my AD credentials:

    Traceback (most recent call last):
    File “/usr/lib/hue/build/env/lib/python2.6/site-packages/django_auth_ldap-1.2.0-py2.6.egg/django_auth_ldap/”, line 328, in authenticate
    File “/usr/lib/hue/build/env/lib/python2.6/site-packages/django_auth_ldap-1.2.0-py2.6.egg/django_auth_ldap/”, line 428, in _authenticate_user_dn
    if self.dn is None:
    File “/usr/lib/hue/build/env/lib/python2.6/site-packages/django_auth_ldap-1.2.0-py2.6.egg/django_auth_ldap/”, line 392, in _get_user_dn
    File “/usr/lib/hue/build/env/lib/python2.6/site-packages/django_auth_ldap-1.2.0-py2.6.egg/django_auth_ldap/”, line 455, in _load_user_dn
    File “/usr/lib/hue/build/env/lib/python2.6/site-packages/django_auth_ldap-1.2.0-py2.6.egg/django_auth_ldap/”, line 473, in _search_for_user_dn
    raise ImproperlyConfigured(‘AUTH_LDAP_USER_SEARCH must be an LDAPSearch instance.’)
    ImproperlyConfigured: AUTH_LDAP_USER_SEARCH must be an LDAPSearch instance.

    1. Abraham Elmahrek Post author

      Hey there,

      I’d ask this question under the hue mailing list (hue-user@). It’ll be much easier to iterate there.