3. Add HBase Repositories

HBase agents integrate with the HBase Master and HBase Region Servers.

[Note]Note

When adding an HBase Repository you must install the Security Agent for HBase on the HBase Master and each of the HBase Region Servers in your cluster and ensure that the configuration settings are the same on each Region Server.

 3.1. Create a HBase Repository

Before installing the agent on the HBase Regional Servers, create an HBase Repository as follows:

  1. Sign in to the HDP Security Administration Web UI.

  2. Click Policy Manager.

    The Manage Repository page displays.

  3. Next to HBase, click the + (plus symbol).

    The Create Repository page displays.

  4. Complete the Repository Details with the following information:

     

    Table 4.7. HBase Repository Details

    LabelValueDescription
    Repository Name $nameSpecify a unique name for the repository, you will need to specify the same repository name in the agent installation properties. For example, clustername_hbase.
    Description$description-of-repoEnter a description up to 150 characters.
    Active StatusEnabled or DisabledEnable or disable policy enforcement for the repository.
    Repository typeHDFS, Hive, or HBaseSelect the type of repository, HBase.
    User name $userSpecify a user name on the remote system with permission to establish the connection, for example hbase.
    Password$passwordSpecify the password of the user account for connection.


  5. Complete the HBase Configuration:

    The settings must match the values specified in the core-site.xml and hbase-site.xml file as follows:

     

    Table 4.8. HBase Configuration

    LabelValueFile
    fs.default.name$hdfs-urlcore-site.xml For example, hdfs://sandbox.hortonworks.com:8020
    hadoop.security.authorizationtruecore-site.xml If this field is false, then change to true in core-site before you continue.
    hadoop.security.authenticationsimple or kerberoscore-site.xml
    hadoop.security.auth_to_local$usermappingcore-site.xmlFor example: RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/ RULE:[2:$1@$0](jhs@.*)s/.*/mapred/ RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/ RULE:[2:$1@$0](hm@.*)s/.*/hbase/ RULE:[2:$1@$0](rs@.*)s/.*/hbase/ DEFAULT
    dfs.datanode.kerberos.principal$dn-principalSpecify the Kerberos DataNode principal name.
    dfs.namenode.kerberos.principal$nn-principalSpecify the Kerberos NameNode principal name.
    dfs.secondary.namenode.kerberos.principal$secondary-nn-principalSpecify the Kerberos Secondary NN principal name.
    hbase.master.kerberos.principal$hbase-principalSpecify the Kerberos principal for the HBase Master.
    hbase.rpc.engineorg.apache.hadoop.hbase.ipc.SecureRpcEnginehbase-site.xml
    hbase.rpc.protectionPRIVACYhbase-site.xml
    hbase.security.authenticationsimplehbase-site.xml
    hbase.zoopkeeper.property.clientPort2181hbase-site.xml
    hbase.zookeeper.quorom hbase-site.xml
    zookeeper.znode.parent/hbasehbase-site.xml
    Common Name For Certificate$cert-nameSpecify the name of the certificate.


    [Note]Note

    The blank fields are optional.

  6. Click Test Connection.

    If the server can connect to HBase, the connection successful message displays.

    HDP Security Administration server connects to HBase and lists the tables. Hortonworks recommends creating the repository and installing the agent after HBase contains data. If HBase connection fails (and tables exist), go to the troubleshooting appendix.

  7. After making a successful connection, click Save.

The repository is created with an open access Policy, that is auditing is enabled and all users are allowed to access the resources. Complete the installation of the agent and do a few simple access test before configuring policies to ensure that the solution is working properly.

 3.2. Installation Set Up

Use same installation properties file to install the Security Agent for HBase. Install the agent on all of the following HBase hosts:

  • HBase Master host

  • All HBase Region Server hosts

  1. Log on to the host as root.

  2. Create a temporary directory, such as /tmp/xasecure:

    mkdir /tmp/xasecure
  3. Move the package into the temporary directory along with the MySQL Connector Jar.

  4. Extract the contents:

    tar xvf $xasecureinstallation.tar
  5. Go to the directory where you extracted the installation files:

    cd /tmp/xasecure/xasecure-$name-$build-version
  6. Open the install.properties file for editing.

  7. Change the following parameters for your environment:

     

    Table 4.9. Hive Agent Install Parameters

    ParameterValueDescription
    POLICY_MGR_URL$urlSpecify the full URL to access the Policy Manager Web UI. For example, http://pm-host:6080.
    MYSQL_CONNECTOR_JAR$path-to-mysql-connectorAbsolute path on the local host to the JDBC driver for mysql including filename.[a] For example, /tmp/xasecure/
    REPOSITORY_NAME$Policy-Manager-Repo-NameName of the HDFS Repository in the Policy Manager that this agent connects to after installation.
    XAAUDIT.DB.HOSTNAME$XAsecure-db-hostSpecify the host name of the MySQL database.
    XAAUDIT.DB.DATABASE_NAME$auditdbSpecify the audit database name that matches the audit_db_name specified during installation.
    XAAUDIT.DB.USER_NAME$auditdbuserSpecify the audit database name that matches the audit_db_user specified during installation.
    XAAUDIT.DB.PASSWORD$auditdbupwSpecify the audit database name that matches the audit_db_password specified during installation.

    [a] Download the JAR from here.


  8. Save the install.properties file.

[Note]Note

If your environment is configured to use SSL, modify the properties following the instructions in Set Up SSL for HBase Security Agents.

The following is an example of the HBase install.properties:

#
# Location of Policy Manager URL  
#
#
# Example:
# POLICY_MGR_URL=http://policymanager.xasecure.net:6080
#

POLICY_MGR_URL=http://policymgr:6080

#
# Location of mysql client library (please check the location of the jar file)
#
MYSQL_CONNECTOR_JAR=/usr/share/java/mysql-connector-java.jar

#
# This is the repository name created within policy manager
#
# Example:
# REPOSITORY_NAME=hbasedev
#

REPOSITORY_NAME=sandbox_2_hbase

#
# AUDIT DB Configuration
# 
#  This information should match with the one you specified during the PolicyManager Installation
# 
# Example:
# XAAUDIT.DB.HOSTNAME=localhost
# XAAUDIT.DB.DATABASE_NAME=xasecure
# XAAUDIT.DB.USER_NAME=xalogger
# XAAUDIT.DB.PASSWORD=
#
#

XAAUDIT.DB.HOSTNAME=xasecure
XAAUDIT.DB.DATABASE_NAME=xasecure
XAAUDIT.DB.USER_NAME=xasecure
XAAUDIT.DB.PASSWORD=hadoop


#
# SSL Client Certificate Information
#
# Example:
# SSL_KEYSTORE_FILE_PATH=/etc/xasecure/conf/xasecure-hadoop-client.jks
# SSL_KEYSTORE_PASSWORD=clientdb01
# SSL_TRUSTSTORE_FILE_PATH=/etc/xasecure/conf/xasecure-truststore.jks
# SSL_TRUSTSTORE_PASSWORD=changeit

#
# IF YOU DO NOT DEFINE SSL parameters, the installation script will automatically generate necessary key(s) and assign appropriate values 
# ONLY If you want to assign manually, please uncomment the following variables and assign appropriate values. 

 3.3. Run the Agent Installation Script

After configuring the install.properties file, install the agent as root:

  1. Log on to the Linux system as root and go to the directory where you extracted the installation files:

    cd /tmp/xasecure/xasecure-$name-$build-version
  2. Run the agent installation script:

    # ./install.sh

 3.4. Restart the HBase Service (Manual HDP Installation)

Changes to the properties require a restart of the HBase services.

To restart HBase:

  1. Execute this command on the HBase Master host machine:

    su -l hbase -c "/usr/lib/hbase/bin/hbase-daemon.sh --config /etc/hbase/conf stop master; sleep 25"
  2. Execute this command on all RegionServers:

    su -l hbase -c "/usr/lib/hbase/bin/hbase-daemon.sh --config /etc/hbase/conf stop regionserver" 
  3. Execute this command on the HBase Master host machine:

    su -l hbase -c "/usr/lib/hbase/bin/hbase-daemon.sh --config /etc/hbase/conf start master; sleep 25"
  4. Execute this command on all RegionServers:

    su -l hbase -c "/usr/lib/hbase/bin/hbase-daemon.sh --config /etc/hbase/conf start regionserver" 

 3.5. Configure HBase Properties (Ambari Deployment)

HDP Security Administration requires that the following properties are set in the hbase-site.xml. Configure these properties and restart Hbase before creating a repository in the Policy Manager.

 

Table 4.10. Custom hbase-site.xml Parameters

KeyValue
hbase.security.authorizationtrue
hbase.coprocessor.master.classescom.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor
hbase.coprocessor.region.classesorg.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint,com.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor
hbase.rpc.engineorg.apache.hadoop.hbase.ipc.SecureRpcEngine
hbase.rpc.protectionPRIVACY


 3.5.1. Update and Add Properties with Ambari

Use these instructions to update the Hbase properties in the Ambari UI.

  1. Log into the Ambari Web UI, and click HBase > Config.

    [Note]Note

    To find a parameter, type the parameter name in the Filter field and press enter; if the parameter exists, it is returned under list. Click the arrow key to expand the lists and see the parameter settings.

  2. Update the following properties from the Ambari Default Value to the HDP Security required values:

     

    Table 4.11. HBase Parameter Values

    HBase PropertyAmbari Default ValueHDP Security Required Value
    hbase.security.authorizationfalsetrue


  3. Expand Custom hbase-site.xml, and add the following properties:

     

    Table 4.12. Custom hbase-site.xml Properties

    KeyValue
    hbase.coprocessor.master.classescom.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor
    hbase.coprocessor.region.classesorg.apache.hadoop.hbase.security.token.TokenProvider,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint,com.xasecure.authorization.hbase.XaSecureAuthorizationCoprocessor
    hbase.rpc.protectionPRIVACY


    [Note]Note

    For each property, click Add Property, enter Key and Value shown in the table above, then click Add.

  4. After all the properties have been updated or added, click Save.

    The Custom hbase-site.xml properties display.

    When properties change, the affected services must be restarted. A Restart option appears.

  5. Click Restart > Restart all.

 3.6. Verify that Agent is Connected

Connected Agents display in the HDP Security Administration Web UI.

[Note]Note

Agents may not appear in the list until after the first event occurs in the repository.

To verify that the agent is connected to the server:

  1. Log in to the interface using the admin account.

  2. Click Audit > Agent.

 3.7. Test HBase Access and Auditing

After the repository is set up and you have verified that the agent is connected to the server, perform a few basic HBase test as outlined below:

  1. Open a browser and go to http://hue-host:8888.

  2. Click on the Hue Shell icon in the navigation pane.

  3. Click HBase Shell.

    The prompt displays.

    hbase(main):001:0>
  4. At the prompt type list.

    hbase(main):001:0> list
    list
    TABLE 
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/usr/lib/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    ambarismoketest 
    test 
    2 row(s) in 4.9490 seconds
    
    => ["ambarismoketest", "test"]

    The XASecure HBase agent reports the activity to the server.

    [Note]Note

    If the HBase command fails with the following Zookeeper error, restart HBase with the root user account from the command line and retest.

    ERROR: Can't get master address from ZooKeeper; znode data == null
  5. Sign in to the Web UI and click Audit.

    The Big Data page displays a list of events for the configured Repositories.

  6. Click Search > Repository Type > HBase.

    The list filters as you make selections.


loading table of contents...