Write the policy once,
enforce it in every service.
Apache Ranger gathers the data access policies in one place, enforces each of them inside the service that receives the request, and records every decision. Follow an access request, from the user to the audit record.
A Ranger policy states who can do what on which resource.
Ranger is the central authorization layer of TDP: it is where the policies of the integrated services are defined, enforced, and audited. Some services also have their own ACLs.
Central administration
One place for all policies
In the Ranger Admin, the policies of all integrated services are created and maintained through the web interface or the REST API.
Inside the service
The decision happens where the request arrives
A lightweight plugin runs in the same process as the service and decides with the locally stored policies, even while the Ranger Admin is temporarily down.
Audit
Every access leaves a record
Who asked, which resource, which action, when, and with what result: the plugin records every decision, and the Ranger Admin gathers the audit in one place.
On this page
- See an access being decided
- Architecture
- Anatomy of a policy
- Deny, allow, or exception
- Why Ranger
- In the TDP editions
See an access being decided
Press Play or step through one by one. Underlined names lead to the Glossary.
1 Users and groups reach Ranger
UserSync reads the users and groups from an identity source, such as LDAP or Active Directory, and synchronizes them with the Ranger Admin. This way, policies can be written for the groups the company already maintains.
In the Glossary: Ranger Admin · UserSync
- Users and groups reach Ranger. UserSync reads the users and groups from an identity source, such as LDAP or Active Directory, and synchronizes them with the Ranger Admin. This way, policies can be written for the groups the company already maintains.
- The plugin fetches the policies. At regular intervals, the plugin asks the Ranger Admin, through the REST API, for the policies of its service and stores a copy in a local cache.
- The request reaches the service. The analyst sends a SELECT to Trino. Before running it, Trino asks the Ranger plugin whether that user can perform that action on that resource.
- The decision comes from the cache. The plugin evaluates the request with the policies in the local cache, in the same process as the service. If the Ranger Admin is temporarily down, the service keeps enforcing the policies it has already received.
- Allowed or denied. With the plugin's decision, Trino runs the query if access was allowed, or rejects it if access was denied.
- The decision becomes a record. The plugin records the decision: the resource, the action, the result, who asked, from which IP address, when, and by which policy. The Ranger Admin shows these records in the audit query.
Architecture
A central server defines the policies. The plugins enforce them inside each service.
What the figure shows:
- UserSync brings in the identities from sources such as LDAP or Active Directory, Unix and file, and sends users and groups to the Ranger Admin.
- TagSync brings in the classifications that Apache Atlas associates with the resources and sends the tags to the Ranger Admin.
- The Ranger Admin is the central web application: it stores the policies, users, groups, and roles, and provides the administration interface and REST API. It also provides the audit query and uses a policy database.
- The plugins run inside the services, such as Trino, Kafka, and NiFi, each with its own local cache, and fetch the policies from the Ranger Admin by polling.
- The audit destination, such as Solr or HDFS, receives the access records from the plugins, and the Ranger Admin queries them.
Anatomy of a policy
A policy answers one question: who can do what, on which resource.
Level 1 of 4
Service
Represents a protected service, such as Trino or Kafka, and gathers its policies. Each service type has its own definition, with the resources and permissions that make sense for it.
- Service definitionDescribes a service type: in Trino, the resources are catalogs, schemas, tables, columns, and procedures. In Kafka, topics.
- Service. Represents a protected service, such as Trino or Kafka, and gathers its policies. Each service type has its own definition, with the resources and permissions that make sense for it.
- Service definition. Describes a service type: in Trino, the resources are catalogs, schemas, tables, columns, and procedures. In Kafka, topics.
- Policy. Applies to a set of resources and gathers the access conditions for them. A policy can apply to all the tables in a schema or to each user's personal directory.
- Resource. What the policy protects: a database, a table, a column, a topic. Wildcards such as * and macros such as {USER} cover several resources in a single policy.
- Policy item. Links who receives the access to the allowed actions: users, groups, or roles, and the permissions of each. A policy has zero or more items.
- Users, groups, and roles. Users and groups come from the corporate directory through UserSync. A role groups users, groups, and other roles, and receives permissions like a group.
- Delegated admin. An item can give users or groups the right to administer the policy, without making them Ranger administrators.
- Permission. The action allowed or denied on the resource. Each service has its own: in Trino, select, insert, create, alter, and drop. In Kafka, publish, consume, create, delete, describe, and configure.
Deny, allow, or exception
When more than one rule applies to the same request, the order decides.
Besides allowing, a policy can deny and open exceptions to each of the two rules.
In the example, the finance group has access to the finance database, the interns group has access denied, and the user scott belongs to both groups.
1 The request reaches the plugin
The user scott asks for a SELECT on the finance database. They are a member of two groups: finance, which has access, and interns, which has access denied.
- The request reaches the plugin. The user scott asks for a SELECT on the finance database. They are a member of two groups: finance, which has access, and interns, which has access denied.
- First, the tags. If the resource has tags, the tag-based policies are evaluated first: a tag-based denial denies access, and a tag-based allow grants it. When the tags do not decide, the resource policies apply.
- Then, the denial. The request matches the denial for the interns group. But a deny exception covers scott on SELECT, and the denial is discarded for this request.
- Then, the allow. The allow for the finance group matches the request, and no allow exception covers scott. Access is allowed.
- When no rule decides. If no allow matches the request, the result is indeterminate. Most services deny access, and HDFS and YARN fall back to their own ACLs.
Beyond allow and deny
Tags
One rule for each classification
With TagSync, the classifications of Apache Atlas, such as PII, reach Ranger as tags, and a tag-based policy applies to every resource with that classification.
Masking and filtering
The data appears, but not in full
Masking policies hide the value of a column at query time, and row filters show each user only the permitted rows. See Security model.
Attributes
Rules that look at who is asking
Conditions can use user attributes, such as the department, brought from the directory by UserSync: this is attribute-based access control.
Why Ranger
Centralization
All security in one interface
Security tasks are managed in a central interface or through the REST API.
Granularity
Authorization per action and per resource
Each action or operation in a component can be authorized separately, from a central administration tool.
Standardization
One method for all components
The same way of authorizing applies to the various components integrated with Ranger.
Flexibility
Roles and attributes
Role-based and attribute-based access control, with conditions specific to each policy.
Audit
Access and administration in the same history
Centralizes the audit of user access and of administrative security actions.
Resilience
No single point of failure
With the policies cached, the plugins keep enforcing the rules even while the central server is temporarily unavailable.
Ranger emerged when YARN brought the Hadoop platform to a data lake architecture, with several workloads in a multi-tenant environment, which called for data security with central administration and access monitoring. It is a project of the Apache Software Foundation, written in Java.
In the TDP editions
| Edition | Version | Documentation |
|---|---|---|
| TDP Datacenter | 2.4.0 | TDP Datacenter components |
| TDP Kubernetes | 2.7.0 · chart tdp-ranger 3.0.3 | Configuration in TDP Kubernetes |
In TDP Datacenter
In TDP Datacenter, Ranger is a stack service, installed and managed by Ambari, and it is the security layer responsible for authorization.
RANGER_ADMIN (master, one or more), RANGER_TAGSYNC (slave, optional, one instance) and RANGER_USERSYNC (master, one instance). Component category.
HDFS, YARN, Hive, HBase, Kafka, Knox, NiFi, NiFi Registry, Solr, Ozone, Atlas, and Trino, each in the Ranger settings for that service, such as ranger-kafka-plugin-properties.
In the plugin's security configuration, such as ranger-kafka-security: the Ranger Admin address in ranger.plugin.kafka.policy.rest.url, the fetch interval in ranger.plugin.kafka.policy.pollIntervalMs, and the cache directory in ranger.plugin.kafka.policy.cache.dir.
UserSync is configured in ranger-ugsync-site: ranger.usersync.source.impl.class chooses the identity source, and ranger.usersync.ldap.url points to the LDAP directory.
TagSync receives the classifications from Apache Atlas, which can be enabled in ranger-tagsync-site with ranger.tagsync.source.atlas.
Destinations configurable in ranger-env, such as Solr (xasecure.audit.destination.solr) and HDFS (xasecure.audit.destination.hdfs). See Security in TDP Datacenter.
Configured in admin-properties (DB_FLAVOR). In the documented installation, Ranger and Ranger KMS use their own PostgreSQL databases.
Kerberos authenticates services and users, Knox is the gateway for the APIs and interfaces, and Ranger KMS manages the HDFS encryption keys.
These services require this one in the cluster: Ranger KMS.
In TDP Kubernetes
In TDP Kubernetes, Ranger is installed by the tdp-ranger chart, with the Ranger Admin and a dedicated Solr for the audit.
Stored in the chart's Solr, with a persistent volume enabled by default in tdp-ranger.solr.persistence.enabled.
PostgreSQL. An external database is prepared by a chart Job, with tdp-ranger.postgres.enabled turned off and TDP-Settings.externalDatabase.enabled turned on.
Through Ingress or Gateway API, one or the other, in TDP-Settings.gateway.
The installation requires a valid TDP license.
Kafka, NiFi, and Trino integrate with Ranger.
Each integration is turned on in rangerIntegrations.<service>.enabled, off by default, and a Job, enabled in rangerIntegrations.configJob.enabled, registers the service in Ranger and can create initial policies.
The broker uses Ranger as its authorizer, with security.authorization.provider set to ranger in the tdp-kafka chart, and fetches the policies from the Ranger Admin through a REST client.
With LDAP login, NiFi uses Ranger as the source of policies, with nifiCluster.security.authorization.mode set to ranger. Ranger communicates with the NiFi API over TLS, with a client certificate.
Trino's access control points to Ranger in tdp-trino.accessControl, and the policies apply to catalogs, schemas, tables, and columns, whichever SQL client is used.
Can be enabled in tdp-ranger.usersync.enabled, off by default. syncSource indicates the identity source, such as ldap, and syncInterval, the interval between synchronizations.
Rules in tdp-ranger.usersync.roleAssignment.rules grant roles to the synchronized users and groups, such as ROLE_SYS_ADMIN and ROLE_ADMIN_AUDITOR.
LDAP or Active Directory authentication in tdp-ranger.ldap.enabled, off by default. LDAPS with a private CA requires Ranger to trust the directory's CA. See Ranger Security.
In both editions, the model is the same: the Ranger Admin stores the policies, and the plugin of each integrated service fetches and enforces them.
Examples of policies per service are in Security model.
Scenario: one policy per team, from the topic to the table
Situation: an operation monitored by events: the events arrive at a Kafka topic, a NiFi flow writes the history to the lakehouse, and the decisions leave through another topic. Three teams have different access: integration, which maintains the flows; analytics, which investigates the history; and operations, which only needs the decisions.
What TDP does: with the Kafka, NiFi, and Trino integrations enabled, the three services fetch the policies from the same Ranger Admin, and the directory groups arrive through UserSync:
- in the Kafka service, the operations group reads only the decisions topic, and the integration group produces and consumes the event topics;
- in the NiFi service, only the integration group edits the flows;
- in the Trino service, the analytics group queries the history tables, and a deny policy closes the integration working schema to the other groups.
Effect: each team sees what its role requires, and a policy change reaches Kafka, NiFi, and Trino through the plugin of each service, which fetches it from the Ranger Admin. The decisions of the three plugins are in the same audit.
Next steps
TDP Kubernetes
Integrations - Ranger
Registration of Kafka, NiFi, and Trino in Ranger and initial policies.
Concept
Security model
Authentication, authorization, and audit on the platform, with policy examples.