Security zones can be configured in Ranger 2.1.0 and later. You can allocate resources to different security zones and assign one or more administrators for each security zone. This way, different types of resources can be separately managed. This topic describes how to configure security zones.

Background information

For example, a company has two departments, Department A and Department B. Department A uses the Hive database named a and HDFS path /a. Department B uses the Hive database named b and HDFS path /b. You can allocate Hive database a and HDFS path /a to security zone named a, allocate Hive database b and HDFS path /b to security zone named b, and then assign administrators for the security zones. Then, the administrators can configure permissions on the resources in their own security zones in a centralized manner.

Configurations of security zone a and security zone b:
Zone: a
  service: emr-hive; path=/a/*,
  service: emr-hdfs; database=a
  
Zone: b
  service: emr-hive; path=/b/*,
  service: emr-hdfs; database=b

An administrator can configure permissions on resources in their own security zone. If they configure permissions on resources in other security zones, the configurations do not take effect. When a Ranger plug-in authenticates a user, it first determines the security zone to which the required resource belongs. Then, the Ranger plug-in authenticates the user based on the permissions configured in the security zone. If the required resource does not belong to a security zone, Ranger implements authentication based on the permissions that are not configured in a specific security zone.

Prerequisites

Limits

Security zones can be configured only in EMR V5.X.

Create security zone administrators

In this example, the admin_a and admin_b users are created as security zone administrators.

  1. Access the web user interface (UI) of Ranger. For more information, see Access the web UI of Ranger.
  2. In the top navigation bar, choose Settings > Users/Groups/Roles.
  3. On the Users tab, click Add New User.
    Add User
  4. On the User Detail page, enter user information, set the Select Role parameter to User, and then click Save.
    Important You must set the Select Role parameter to User. If you set this parameter to Admin, the user is created as a super administrator. A super administrator can configure permissions on all resources in all security zones. In this example, an administrator needs to configure permissions only on resources in a specific security zone.

Configure security zones

Perform the following steps to configure Security Zone a and Security Zone b:

  1. Access the web UI of Ranger. For more information, see Access the web UI of Ranger.
  2. In the top navigation bar, click Security Zone.
  3. On the Security Zone page, click the add icon in the Security Zones section.
    Add Zone
  4. On the Create Zone page, configure the parameters that are described in the following table.
    Zone Edit
    ParameterDescriptionExample
    Zone NameThe name of the security zone. a
    Admin UsersThe administrators of the security zone. The administrators are created in the Settings module. When you create administrators, you must set the Select Role parameter to User. For more information, see the Create security zone administrators section of this topic. admin and admin_a
    Auditor UsersThe users who are allowed to view the audit logs of the security zone. admin and admin_a
    Select Resource ServicesThe services that you want to use in the security zone. emr-hive and emr-hdfs
    ResourceThe resources that you want to allocate to the security zone. database=a and path=/a/*
  5. Click Save. Security Zone a is configured.
  6. Repeat Step 3 to Step 5 to configure Security Zone b.

Test security zones

  1. Log on to the web UI of Ranger as the admin_a user. For more information, see Access the web UI of Ranger.
  2. In the upper-right corner, select a in the Security Zone section.
  3. Click emr-hive to view the permissions for the emr-hive service.
    You can view and modify only the permissions that are configured in Security Zone a. To perform a test, you can configure permissions on a resource that belongs to Security Zone b. For example, grant the test user the SELECT permissions on the test table of Hive Database b. Then, use Beeline to perform a test. The test results show that the configuration does not take effect. Hive Database b belongs to Security Zone b. Therefore, when Ranger authenticates the test user, only permissions configured in Security Zone b are verified. As a result, the permissions that you configured on Hive Database b in Security Zone a do not take effect. zone_a
  4. Log on to the web UI of Ranger as the admin_b user. For more information, see Access the Ranger UI.
  5. In the upper-right corner, select b in the Security Zone section.
  6. Click emr-hive to view the permissions for the emr-hive service.
    You can view and modify only the permissions that are configured in Security Zone b. To perform a test, you can configure permissions on a resource that belongs to Security Zone b. For example, grant the test user the SELECT permissions on the test table of Hive Database b. Use Beeline to perform a test. The test results show that the configuration takes effect. zone_b