After LDAP authentication is enabled for a service, you must provide your LDAP username and password when you access the service. This improves the security of the service. You can enable LDAP authentication for a service in the EMR console by performing simple operations. This frees you from the complex configuration of LDAP authentication.
Prerequisites
You have created a DataLake cluster or a custom cluster with the Hive and OpenLDAP components selected. For more information, see Create a cluster.
Enable LDAP authentication with one click
Add an EMR user. For more information, see Add a user.
Go to the Services tab.
Log on to the EMR console.
In the left-side navigation pane, click EMR on ECS.
In the top navigation bar, select the region in which your cluster resides and select a resource group based on your business requirements.
On the EMR on ECS page, find the desired cluster and click Services in the Actions column.
-
Enable LDAP authentication.
-
On the Services page, click Status in the Hive service section.
-
Turn on the enableLDAP switch.
-
For EMR 5.11.1 or later and EMR 3.45.1 or later
-
In the Service Overview section, turn on the enableLDAP switch.
-
In the dialog box that appears, click OK.
-
-
For EMR 5.11.0 or earlier and EMR 3.45.0 or earlier
-
In the Components section, find HiveServer and choose in the Actions column.
-
In the dialog box that appears, enter an Execution Reason and click OK.
-
In the Confirm dialog box, click OK.
-
-
-
Restart HiveServer.
-
In the Components section, find HiveServer and click Restart in the Actions column.
-
In the dialog box that appears, enter an Execution Reason and click OK.
-
In the Confirm dialog box, click OK.
-
-
-
Connect to HiveServer.
After enabling LDAP authentication, you must use LDAP credentials to connect to HiveServer2.
-
Log on to the cluster over SSH. For more information, see Log on to a cluster.
-
Run the following command to connect to HiveServer2.
-
Beeline client:
beeline -u jdbc:hive2://master-1-1:10000 -n <user> -p <password> -
JDBC:
jdbc:hive2://master-1-1:10000/default;user=<user>;password=<password>
Note<user> and <password> are the username and password for the user that you added in Step 1.
-
-
Manually configure LDAP authentication
The EMR console provides an enableLDAP button that allows you to enable LDAP authentication with one click. If you use an earlier version of EMR or want to connect to a self-managed LDAP service, you must manually configure LDAP authentication for HiveServer2.
On the Configure page of the Hive service in the EMR console, go to the hiveserver2-site.xml tab and add the following configuration items. For more information about how to add a configuration item, see Manage configuration items.
|
Parameter |
Value |
Description |
|
hive.server2.authentication |
LDAP |
Specifies the authentication method for HiveServer2. |
|
hive.server2.authentication.ldap.url |
ldap://{ldap_hostname}:{port} Example: ldap://master-1-1:10389 |
The connection URL for the LDAP service. This value depends on your environment.
|
|
hive.server2.authentication.ldap.baseDN |
ou=people,o=emr |
The base distinguished name (DN) for users. For the EMR LDAP service, the value is |
Restrict access to specific users or groups
After enabling LDAP authentication for the Hive service, you can add or modify the following configurations to restrict access to specific users.
Configuration
-
On the Configure page of the Hive service in the EMR console, go to the hiveserver2-site.xml tab, and add or modify the following configuration items.
Parameter
Example value
Actions
Description
hive.server2.authentication.ldap.userDNPatternuid=%s,ou=people,o=emrAdd
The user DN pattern that defines the search path for users in LDAP. %s is replaced with the actual username.
hive.server2.authentication.ldap.groupFilterusernameAdd
A comma-separated list of groups. Only users who belong to these groups can access HiveServer2.
hive.server2.authentication.ldap.groupClassKeyposixGroupAdd
The value of the objectClass attribute that indicates a group object in LDAP.
hive.server2.authentication.ldap.groupMembershipKeymemberUidAdd
The attribute name that is used to store member information in an LDAP group object.
hive.server2.authentication.ldap.baseDNo=emrModify
The base DN for LDAP searches. Modify the existing value to a base path that works for group filtering.
-
Save the new and modified configurations.
-
Restart the HiveServer2 service to apply the new configuration.
Verify the connection
After enabling LDAP authentication and configuring users, you must provide the credentials of a user to connect to HiveServer2.
-
Log on to the cluster over SSH. For more information, see Log on to a cluster.
-
Run the following command to connect to HiveServer2.
-
Beeline client:
beeline -u jdbc:hive2://master-1-1:10000 -n <user> -p <password> -
JDBC:
jdbc:hive2://master-1-1:10000/default;user=<user>;password=<password>
Note<user> is the user that is configured in the
hive.server2.authentication.ldap.groupFilterconfiguration item, and <password> is the password for that user. These are the username and password that you added in Step 1. -
> enableLDAP