This is the documentation for CDH 5.0.x. Documentation for other versions is available at Cloudera Documentation.

Configuring HBase Authorization

After you have configured HBase authentication as described here, you must establish authorization rules for the resources that a client is allowed to access. In this release, HBase only allows you to establish authorization rules on a column or table level. Authorization at the row or cell-level is currently not possible.

Understanding HBase Access Levels

HBase access levels are granted independently of each other and allow for different types of operations at a given scope.
  • Read (R) - can read data at the given scope
  • Write (W) - can write data at the given scope
  • Create (C) - can create tables or drop tables (even those they did not create) at the given scope
  • Admin (A) - can perform cluster operations such as balancing the cluster or assigning regions at the given scope
The possible scopes are:
  • Superuser - superusers can perform any operation available in HBase, to any resource. The user who runs HBase on your cluster is a superuser, as are any principals assigned to the configuration property hbase.superuser in hbase-site.xml on the HMaster.
  • Global - permissions granted at global scope allow the admin to operate on all tables of the cluster.
  • Table - permissions granted at table scope apply to data or metadata within a given table.
  • ColumnFamily - permissions granted at ColumnFamily scope apply to cells within that ColumnFamily.
The combination of access levels and scopes creates a matrix of possible access levels that can be granted to a user. In a production environment, it is useful to think of access levels in terms of what is needed to do a specific job. The following list describes appropriate access levels for some common types of HBase users. It is important not to grant more access than is required for a given user to perform their required tasks.
  • Superusers - In a production system, only the HBase user should have superuser access. In a development environment, an administrator may need superuser access in order to quickly control and manage the cluster. However, this type of administrator should usually be a Global Admin rather than a superuser.
  • Global Admins - A global admin can perform tasks and access every table in HBase. In a typical production environment, an admin should not have Read or Write permissions to data within tables.

    • A global admin with Admin permissions can perform cluster-wide operations on the cluster, such as balancing, assigning or unassigning regions, or calling an explicit major compaction. This is an operations role.

    • A global admin with Create permissions can create or drop any table within HBase. This is more of a DBA-type role.

    In a production environment, it is likely that different users will have only one of Admin and Create permissions.

      Warning:

    In the current implementation, a Global Admin with Admin permission can grant himself Read and Write permissions on a table and gain access to that table's data. For this reason, only grant Global Admin permissions to trusted user who actually need them.

    Also be aware that a Global Admin with Create permission can perform a Put operation on the ACL table, simulating a grant or revoke and circumventing the authorization check for Global Admin permissions. This issue (but not the first one) is fixed in CDH 5.3 and newer, as well as CDH 5.2.1. It is not fixed in CDH 4.x or CDH 5.1.x.

    Due to these issues, be cautious with granting Global Admin privileges.

  • Table Admins - A table admin can perform administrative operations only on that table. A table admin with Create permissions can create snapshots from that table or restore that table from a snapshot. A table admin with Admin permissions can perform operations such as splits or major compactions on that table.
  • Users - Users can read or write data, or both.
Table 1. Real-World Example of Access Levels.

This table shows some typical job descriptions at a hypothetical company and the permissions they might require in order to get their jobs done using HBase.

Job Title Scope Permissions Description
Senior Administrator Global Access, Create Manages the cluster and gives access to Junior Administrators.
Junior Administrator Global Create Creates tables and gives access to Table Administrators.
Table Administrator Table Access Maintains a table from an operations point of view.
Data Analyst Table Read Creates reports from HBase data.
Web Application Table Read, Write Puts data into HBase and uses HBase data to perform operations.

Enable HBase Authorization

HBase Authorization is built on top of the Coprocessors framework, specifically AccessContoller Coprocessor.

To enable HBase authorization, add the following properties to the hbase-site.xml file on every HBase server host (Master or Region Server):

<property>
     <name>hbase.security.authorization</name>
     <value>true</value>
</property>
<property>
     <name>hbase.coprocessor.master.classes</name>
     <value>org.apache.hadoop.hbase.security.access.AccessController</value>
</property>
<property>
     <name>hbase.coprocessor.region.classes</name>
     <value>org.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.AccessController</value>
</property>
  Note:

Once the Access Controller coprocessor is enabled, any user who uses the HBase shell will be subject to access control. Access control will also be in effect for native (Java API) client access to HBase.

Configure Access Control Lists for Authorization

Now that HBase has the security coprocessor enabled, you can set ACLs via the HBase shell. Start the HBase shell as usual.

  Important:

The host running the shell must be configured with a keytab file as described here.

The commands that control ACLs are of the form of:

grant <user> <permissions>[ <table>[ <column family>[ <column qualifier> ] ] ]    #grants permissions
revoke <user> <permissions> [ <table> [ <column family> [ <column qualifier> ] ] ]   # revokes permissions
user_permission <table>  # displays existing permissions

In the above commands, fields encased in <> are variables, and fields in [] are optional. The permissions variable must consist of zero or more character from the set "RWCA".

  • R denotes read permissions, which is required to perform Get, Scan, or Exists calls in a given scope.
  • W denotes write permissions, which is required to perform Put, Delete, LockRow, UnlockRow, IncrementColumnValue, CheckAndDelete, CheckAndPut, Flush, or Compact in a given scope.
  • C denotes create permissions, which is required to perform Create, Alter, or Drop in a given scope.
  • A denotes admin permissions, which is required to perform Enable, Disable, Snapshot, Restore, Clone, Split, MajorCompact, Grant, Revoke, and Shutdown in a given scope.

For example:

grant 'user1', 'RWC'
grant 'user2', 'RW', 'tableA'

Be sure to review the information in Understanding HBase Access Levels to understand the implications of the different access levels.

Page generated September 3, 2015.