Apache Ranger Auditing
Apache Ranger Auditing
Ranger Auditing
Date published: 2020-11-30
Date modified: 2021-08-05
https://docs.cloudera.com/
Legal Notice
© Cloudera Inc. 2022. All rights reserved.
The documentation is and contains Cloudera proprietary information protected by copyright and other intellectual property
rights. No license under copyright or any other intellectual property right is granted herein.
Copyright information for Cloudera software may be found within the documentation accompanying each component in a
particular release.
Cloudera software includes software from various open source or other third party projects, and may be released under the
Apache Software License 2.0 (“ASLv2”), the Affero General Public License version 3 (AGPLv3), or other license terms.
Other software included may be released under the terms of alternative open source licenses. Please review the license and
notice files accompanying the software for additional licensing information.
Please visit the Cloudera software product page for more information on Cloudera software. For more information on
Cloudera support services, please visit either the Support or Sales page. Feel free to contact us directly to discuss your
specific needs.
Cloudera reserves the right to change any products at any time, and without notice. Cloudera assumes no responsibility nor
liability arising from the use of products, except as expressly agreed to in writing by Cloudera.
Cloudera, Cloudera Altus, HUE, Impala, Cloudera Impala, and other Cloudera marks are registered or unregistered
trademarks in the United States and other countries. All other trademarks are the property of their respective owners.
Disclaimer: EXCEPT AS EXPRESSLY PROVIDED IN A WRITTEN AGREEMENT WITH CLOUDERA,
CLOUDERA DOES NOT MAKE NOR GIVE ANY REPRESENTATION, WARRANTY, NOR COVENANT OF
ANY KIND, WHETHER EXPRESS OR IMPLIED, IN CONNECTION WITH CLOUDERA TECHNOLOGY OR
RELATED SUPPORT PROVIDED IN CONNECTION THEREWITH. CLOUDERA DOES NOT WARRANT THAT
CLOUDERA PRODUCTS NOR SOFTWARE WILL OPERATE UNINTERRUPTED NOR THAT IT WILL BE
FREE FROM DEFECTS NOR ERRORS, THAT IT WILL PROTECT YOUR DATA FROM LOSS, CORRUPTION
NOR UNAVAILABILITY, NOR THAT IT WILL MEET ALL OF CUSTOMER’S BUSINESS REQUIREMENTS.
WITHOUT LIMITING THE FOREGOING, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE
LAW, CLOUDERA EXPRESSLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, QUALITY, NON-INFRINGEMENT, TITLE, AND
FITNESS FOR A PARTICULAR PURPOSE AND ANY REPRESENTATION, WARRANTY, OR COVENANT BASED
ON COURSE OF DEALING OR USAGE IN TRADE.
Cloudera Runtime | Contents | iii
Contents
Audit Overview......................................................................................................... 4
Audit Overview
Apache Ranger provides a centralized framework for collecting access audit history and reporting data, including
filtering on various parameters. Ranger enhances audit information obtained from Hadoop components and provides
insights through this centralized reporting capability.
Procedure
To view details for a particular operation, click any tab, then Policy ID, Operation name, or Session ID.
4
Cloudera Runtime Managing Auditing with Ranger
5
Cloudera Runtime Managing Auditing with Ranger
6
Cloudera Runtime Managing Auditing with Ranger
Procedure
1. Select Settings > Users/Groups/Roles.
2. Click Add New User.
7
Cloudera Runtime Managing Auditing with Ranger
4. Click Save.
Note: "Time To Live for Solr Collection of Ranger Audits" is also known as the Max Retention Days
attribute.
Procedure
1. From Cloudera Manager choose Ranger > Configuration.
2. In Search, type ranger.audit.solr.config, then press Return.
3. In ranger.audit.solr.config.ttl, set the the number of days to keep audit data.
4. In ranger.audit.solr.config.delete.trigger set the number and units (days, minutes, hours, or seconds) to keep
data for expired documents
8
Cloudera Runtime Ranger Audit Filters
9
Cloudera Runtime Ranger Audit Filters
HBase service:
Knox service
Solr service
Kafka service:
10
Cloudera Runtime Ranger Audit Filters
KMS service
Atlas service
Ozone service
Tag-based service
Default audit filter policies do not exist for Yarn, NiFi, NiFi Registry, Kudu, or schema registry services.
11
Cloudera Runtime Ranger Audit Filters
[
{
"accessResult":"DENIED",
"isAudited":true
},
{
"users":[
"unaudited-user1"
],
"groups":[
"unaudited-group1"
],
"roles":[
"unaudited-role1"
],
"isAudited":false
},
{
"actions":[
"listStatus",
"getfileinfo"
],
"accessTypes":[
"execute"
],
"isAudited":false
},
{
"resources":{
"path":{
"values":[
"/audited"
],
"isRecursive":true
}
},
"isAudited":true
},
{
12
Cloudera Runtime Changing Ranger audit storage location and migrating data
"resources":{
"path":{
"values":[
"/unaudited"
],
"isRecursive":true
}
},
"isAudited":false
}
]
• Each value in the list is an audit filter, which takes the format of a simplified Ranger policy, along with access
results fields.
• Audit filters are defined with rules on Ranger policy attributes and access result attributes.
• Policy attributes: resources, users, groups, roles, accessTypes
• Access result attributes: isAudited, actions, accessResult
• The following audit filter specifies that accessResult=DENIED will be audited.
The isAudited flag specifies whether or not to audit.
{"accessResult":"DENIED","isAudited":true}
• The following audit filter specifies that “resource => /unaudited” will not be audited.
{"resources":{"path":{"values":["/
unaudited"],"isRecursive":true}},"isAudited":false}
• The following audit filter specifies that access to resource database=> sys table=> dump by user “use2” will not
be audited.
{"resources":{"database":{"values":["sys"]},"table":{"values":
["dump"]}},"users":["user2"],"isAudited":false}
• The following audit filter specifies that access result in actions => listStatus, getfileInfo and accessType =>
execute will not be audited.
{"actions":["listStatus","getfileinfo"],"accessTypes":
["execute"],"isAudited":false}
• The following audit filter specifies that access by user "superuser1" and group "supergroup1" will not be audited.
{"users":["superuser1"],"groups":["supergroup1"],"isAudited":false}
• The following audit filter specifies that access to any resource tagged as NO_AUDIT will not be audited.
{"resources":{"tag":{"values":["NO_AUDIT"]}},"isAudited":false}
13
Cloudera Runtime Changing Ranger audit storage location and migrating data
Procedure
1. Create HDFS Directory to store the collection backups.
As an HDFS super user, run the following commands to create the backup directory:
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
<lockType>${solr.lock.type:native}</lockType>
with
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:org.apache.solr.core.HdfsDirectoryFactory}">
<lockType>${solr.lock.type:hdfs}</lockType>
• When migrating your data storage location from HDFS to a local file system, replace these two lines:
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:org.apache.solr.core.HdfsDirectoryFactory}">
<lockType>${solr.lock.type:hdfs}</lockType>
with
<directoryFactory name="DirectoryFactory"
class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
<lockType>${solr.lock.type:native}</lockType>
5. Update the modified configs in Zookeeper.
14
Cloudera Runtime Changing Ranger audit storage location and migrating data
In the preceding command, the important points are name, collection, and location:
name
specifies the name of the backup. It should be unique per collection
collection
specifies the collection name for which the backup will be performed
location
specifies the HDFS path, where the backup will be stored
Repeat the curl command for different collections, modifying the parameters as necessary for each collection.
The expected output would be -
"responseHeader":{
"status":0,
"QTime":10567},
"success":{
"Solr_Server_Hostname:8995_solr":{
"responseHeader":{
"status":0,
"QTime":8959}}}}
• When migrating your data storage location from HDFS to a local file system:
Refer to Back up a Solr collection for specific steps, and make the following adjustments:
• If TLS is enabled for the Solr service, specify the trust store and password by using the
ZKCLI_JVM_FLAGS environment variable before you begin the procedure.
# export ZKCLI_JVM_FLAGS="-Djavax.net.ssl.trustStore=/path/to/
truststore.jks -Djavax.net.ssl.trustStorePassword="
• Create Snapshot
15
Cloudera Runtime Changing Ranger audit storage location and migrating data
# cd /var/lib/solr-infra
Get the value of "Solr Data Directory, using Cloudera Manager > Solr > Configuration.
# ls -ltr
• When migrating your data storage location from HDFS to a local file system, replace these two lines:
16
Cloudera Runtime Changing Ranger audit storage location and migrating data
17