This section describes how to ensure that the is configured correctly to connect to Hive when Ranger is enabled for Hive. Ranger provides role-based authorization for Hive and other Hadoop components on the Hortonworks platform.
Ranger effectively functions as a whitelist of URI's; by default, access is denied for any object in Hive. When a URI is requested, Ranger checks HDFS for permissions for the authenticated user. If HDFS denies access, then Ranger checks its defined set of URI's for the permission and, if a match is found, grants access for the authenticated user.
Pre-requisites
Secure Impersonation with |
NOTE: Although not required, secure impersonation is highly recommended for connecting the platform with Hive. |
Since secure impersonation for the combination of HiveServer2 and Ranger is not supported by Ranger, you must apply the following additional configuration changes to the to enable secure impersonation in the environment:
hive
to the Unix or LDAP group Set the following parameter:
"hdfs.permissions.userUmask" = 027 |
When the is enabled with secure impersonation and submits requests to Hive, the following steps occur:
The Hive server authorizes access to the underlying table through Ranger as the Hadoop principal user assigned to .
NOTE: This Hadoop principal is the user that should be configured through policies in Ranger to have the appropriate privileges. |
hive
, which should be part of the group
NOTE: Since Ranger assigns access to databases, tables, and columns to Unix users and groups, a common practice is to assign the Hadoop principal users (used by |
NOTE: In UNIX environments, usernames and group names are case-sensitive. Please verify that you are using the case-sensitive names for users and groups in your Hadoop configuration and |
In Ranger, you can configure access through policies. A Ranger policy is a combination of:
NOTE: In general, to manage access through Ranger, permissions to underlying Hadoop components such as HDFS or Hive should be minimized within those components. All permissions in Ranger are additive, which means that you should be careful about overlapping users and groups. |
The following components require these permissions at a minimum to be assigned to the Hadoop principal:
Component | Permissions |
---|---|
HDFS | Read, Write, Execute |
Hive | Select, Update. Create (for Hive publishing) |
NOTE: The following configuration is required for integration of HDP 2.6 or later with Hive publishing when Ranger is enabled. |
Set the following to true
: Enable Ranger for HDFS.
From the left nav bar, navigate to the following: Ranger > Configs > Ranger Plugin tab.
Set the following to true
: Hive Ranger Plugin.
In the policies area, create the following two policies:
trifacta_policies hive_warehouse |
Access
true
For trifacta_policies
, set this value to either of the following values:
/trifacta /trifacta/queryResults |
For hive_warehouse
, set this value to the location of the Hive warehouse. The following is the default value:
/user/hive/warehouse |
Recursive: true
NOTE: Policies must be recursive. |
Audit Logging: yes
Allow conditions:
Select group: Hadoop
, Trifacta
Select user: Trifacta
Permissions: Read
, Write
, Execute
Save the policies.
After you have completed your configuration changes, you should restart the platform. See Start and Stop the Platform.
To verify platform operations, run a simple job. For more information, see Verify Operations.