Enabling LDAP Authentication for Impala

Authentication is the process of allowing only specified named users to access the server (in this case, the Impala server). This feature is crucial for any production deployment, to prevent misuse, tampering, or excessive load on the server. Impala uses LDAP for authentication, verifying the credentials of each user who connects through impala-shell, Hue, a Business Intelligence tool, JDBC or ODBC application, etc.

An alternative form of authentication you can use is Kerberos, described in Enabling Kerberos Authentication for Impala.

Requirements for Using Impala with LDAP

Authentication against LDAP servers is available in Impala 1.2.2 and higher. Impala 1.4.0 added the support for secure LDAP authentication through SSL and TLS.

The Impala LDAP support lets you use Impala with systems such as Active Directory that use LDAP behind the scenes.

Consideration for Connections Between Impala Components

Only the connections between clients and Impala can be authenticated by LDAP.

You must use the Kerberos authentication mechanism for connections between internal Impala components, such as between the impalad, statestored, and catalogd daemons. See Enabling Kerberos Authentication for Impala on how to set up Kerberos for Impala.

Enabling LDAP in Command Line Interface

To enable LDAP authentication via a command line interface, start the impalad with the following startup options for:

--enable_ldap_auth

Enables LDAP-based authentication between the client and Impala.

--ldap_uri

Sets the URI of the LDAP server to use. Typically, the URI is prefixed with ldap://. You can specify secure SSL-based LDAP transport by using the prefix ldaps://. The URI can optionally specify the port, for example: ldap://ldap_server.example.com:389 or ldaps://ldap_server.example.com:636. (389 and 636 are the default ports for non-SSL and SSL LDAP connections, respectively.)

Support for Custom Bind Strings

When Impala connects to LDAP it issues a bind call to the LDAP server to authenticate as the connected user. Impala clients, including the Impala shell, provide the short name of the user to Impala. This is necessary so that Impala can use Sentry for role-based access, which uses short names.

However, LDAP servers often require more complex, structured usernames for authentication. Impala supports three ways of transforming the short name (for example, 'henry') to a more complicated string. If necessary, specify one of the following configuration options when starting the impalad daemon.

--ldap_domain

Replaces the username with a string username@ldap_domain.

--ldap_baseDN

Replaces the username with a "distinguished name" (DN) of the form: uid=userid,ldap_baseDN. (This is equivalent to a Hive option).

--ldap_bind_pattern

This is the most general option, and replaces the username with the string ldap_bind_pattern where all instances of the string #UID are replaced with userid. For example, an ldap_bind_pattern of "user=#UID,OU=foo,CN=bar" with a username of henry will construct a bind name of "user=henry,OU=foo,CN=bar".

The above options are mutually exclusive, and Impala does not start if more than one of these options are specified.

Secure LDAP Connections

To avoid sending credentials over the wire in cleartext, you must configure a secure connection between both the client and Impala, and between Impala and the LDAP server. The secure connection could use SSL or TLS.

Secure LDAP connections through SSL:

For SSL-enabled LDAP connections, specify a prefix of ldaps:// instead of ldap://. Also, the default port for SSL-enabled LDAP connections is 636 instead of 389.

Secure LDAP connections through TLS:

TLS, the successor to the SSL protocol, is supported by most modern LDAP servers. Unlike SSL connections, TLS connections can be made on the same server port as non-TLS connections. To secure all connections using TLS, specify the following flags as startup options to the impalad daemon:

--ldap_tls

Tells Impala to start a TLS connection to the LDAP server, and to fail authentication if it cannot be done.

--ldap_ca_certificate="/path/to/certificate/pem"

Specifies the location of the certificate in standard .PEM format. Store this certificate on the local filesystem, in a location that only the impala user and other trusted users can read.

Enabling LDAP in Cloudera Manager

To enable LDAP authentication in Cloudera Manager:

  1. In the Impala service, click the Configuration tab.
  2. In the search box, type ldap.
  3. Specify the values for the option fields. Each field lists the corresponding Impala startup flag. See the sections above for the corresponding flag if you need more information on a particular field.
  4. Click Save Changes.
  5. Restart the Impala service.

LDAP Authentication for impala-shell

To connect to Impala using LDAP authentication, you specify command-line options to the impala-shell command interpreter and enter the password when prompted.

-l

Enables LDAP authentication.

-u

Sets the user. Per Active Directory, the user is the short username, not the full LDAP distinguished name. If your LDAP settings include a search base, use the --ldap_bind_pattern on the impalad daemon to translate the short user name from impala-shell automatically to the fully qualified name.

impala-shell automatically prompts for the password.

See Configuring Impala to Work with JDBC for the format to use with the JDBC connection string for servers using LDAP authentication.

Enabling LDAP for Impala in Hue

  1. Go to the Hue service.
  2. Click the Configuration tab.
  3. Select Scope > Hue Server.
  4. Select Category > Advanced.
  5. Add the following properties to the Hue Server Advanced Configuration Snippet (Safety Valve) for hue_safety_valve_server.ini property.
    [impala]
    auth_username=<LDAP username of Hue user to be authenticated>
    auth_password=<LDAP password of Hue user to be authenticated>
  6. Click Save Changes.

Enabling Impala Delegation for LDAP Users

See Configuring Impala Delegation for Hue and BI Tools for details about the delegation feature that lets certain users submit queries using the credentials of other users.

LDAP Restrictions for Impala

The LDAP support is preliminary. It currently has only been tested against Active Directory.