Skip to main content

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​

Press Play or step through one by one. Underlined names lead to the Glossary.

UserWho asks
AnalystSends a SELECT
ServiceWhere the request arrives
Trino CoordinatorReceives the query
Ranger pluginDecides in the same process
Policy cacheLocal copy of the policies
RangerWho defines the rules
Ranger AdminStores and serves the policies
UserSyncBrings in users and groups
Identities and auditWhat feeds in and what records
LDAP / ADDirectory of users and groups
AuditRecord of every decision
Step 1 of 6

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.

  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.
  2. 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.
  3. 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.
  4. 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.
  5. Allowed or denied. With the plugin's decision, Trino runs the query if access was allowed, or rejects it if access was denied.
  6. 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.
Figure 1 - An access decided by Ranger. The policies reach the service before the request, and the decision happens inside it, with the local copy that the plugin keeps.

Architecture​

A central server defines the policies. The plugins enforce them inside each service.

Apache Ranger architecture: Ranger Admin, UserSync, TagSync, plugin-enabled services and auditOn the left, the identity sources (LDAP or Active Directory, Unix and file) feed the UserSync, and Apache Atlas feeds the TagSync. Both send users, groups and tags to Ranger Admin, which stores the policies, users, groups and roles, offers the audit query, the REST API and the web interface, and uses a policy database. On the right, Trino, Kafka and NiFi each run a Ranger plugin with a local cache, which receives the policies from Ranger Admin by polling. The plugins send the access records to the audit destination, such as Solr or HDFS, which Ranger Admin queries.LDAP / ADUnixFileIdentity sourcesClassificationsApache AtlasUserSyncUsers and groupsTagSyncResource tagsPoliciesUsers, groups and rolesAudit queryREST API and web interfacePolicy databaseRanger AdminTrinoPluginLocal cacheKafkaPluginLocal cacheNiFiPluginLocal cachePlugin-enabled servicesPolicies,by pollingAudit destinationSolr, HDFS and other destinationsAccess recordsQuery
Figure 2 - Ranger architecture: UserSync and TagSync feed the Ranger Admin. The plugins fetch the policies and send the audit. Underlined terms lead to the Glossary.

What the figure shows:

  1. 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.
  2. TagSync brings in the classifications that Apache Atlas associates with the resources and sends the tags to the Ranger Admin.
  3. 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.
  4. 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.
  5. 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.
  1. 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.
  2. 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.
  3. 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.
  4. 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.
Figure 3 - A policy, level by level: the service gathers the policies, each policy protects resources, and each item states who receives which permissions.

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.

RequestWho asks for what
scott: SELECTDatabase finance. Member of finance and interns
TagsEvaluated first
Tag-based policyApplies to classified resources
Policy rulesDeny, allow, and exceptions
DenyGroup interns
Deny exceptionscott, on SELECT
AllowGroup finance
Allow exceptionWho is left out of the allowance
ResultWhat the service receives
DeniedThe service rejects it
AllowedThe service runs it
No decisionFollows the service's rule
Step 1 of 5

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.

  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.
  2. 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.
  3. 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.
  4. Then, the allow. The allow for the finance group matches the request, and no allow exception covers scott. Access is allowed.
  5. 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.
Figure 4 - How the plugin reaches a decision: tags first, then denials, and finally permissions.

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.

Where it comes from

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​

Available in the TDP editions
EditionVersionDocumentation
TDP Datacenter2.4.0TDP Datacenter components
TDP Kubernetes2.7.0 · chart tdp-ranger 3.0.3Configuration 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.

Service components

RANGER_ADMIN (master, one or more), RANGER_TAGSYNC (slave, optional, one instance) and RANGER_USERSYNC (master, one instance). Component category.

Plugins that can be enabled in Ambari

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.

How the plugin receives the policies

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.

Users and groups

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.

Atlas tags

TagSync receives the classifications from Apache Atlas, which can be enabled in ranger-tagsync-site with ranger.tagsync.source.atlas.

Audit

Destinations configurable in ranger-env, such as Solr (xasecure.audit.destination.solr) and HDFS (xasecure.audit.destination.hdfs). See Security in TDP Datacenter.

Database

Configured in admin-properties (DB_FLAVOR). In the documented installation, Ranger and Ranger KMS use their own PostgreSQL databases.

Surrounding security

Kerberos authenticates services and users, Knox is the gateway for the APIs and interfaces, and Ranger KMS manages the HDFS encryption keys.

Required by

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.

Audit

Stored in the chart's Solr, with a persistent volume enabled by default in tdp-ranger.solr.persistence.enabled.

Database

PostgreSQL. An external database is prepared by a chart Job, with tdp-ranger.postgres.enabled turned off and TDP-Settings.externalDatabase.enabled turned on.

Interface access

Through Ingress or Gateway API, one or the other, in TDP-Settings.gateway.

License

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.

Kafka

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.

NiFi

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

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.

UserSync

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.

Ranger roles

Rules in tdp-ranger.usersync.roleAssignment.rules grant roles to the synchronized users and groups, such as ROLE_SYS_ADMIN and ROLE_ADMIN_AUDITOR.

Ranger login

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​

Sources​