Apache Ranger: Centralized Policies, Audit and Row Masking

Big Data and Hadoop Administrator 15 min min read Updated: Nov 17, 2026 Advanced
Apache Ranger: Centralized Policies, Audit and Row Masking
Advanced Topic 4 of 5

What Ranger Does

Apache Ranger is a central authorization and audit framework. Admins write policies once in a web console. Small plugins inside each service download policies and enforce them locally.

text Ranger Admin (UI + REST, DB: MySQL/PostgreSQL) | policies (JSON, cached by plugins) ^ audit events v | HDFS plugin Hive plugin HBase plugin Kafka plugin YARN plugin Knox plugin | Audit store: Solr / OpenSearch / HDFS Usersync: LDAP/AD -> Ranger users and groups
ComponentPurpose
Ranger AdminWeb UI, policy store, REST API
PluginsRun in the service JVM and check each request against cached policies
UsersyncImports users and groups from LDAP, AD or Unix
TagsyncImports classifications (tags) from Apache Atlas
AuditRecords allowed and denied accesses (Solr, OpenSearch, HDFS)
Performance: Plugins evaluate policies in memory, so a Ranger Admin outage does not stop access checks. Plugins use their last cached policies.

Access Evaluation Order (Simplified)

  1. Deny policies and deny exceptions are checked
  2. Allow policies are checked
  3. If Ranger has no matching policy, many plugins fall back to native permissions (HDFS) if configured
  4. Otherwise access is denied

Policy Anatomy

FieldExample
Serviceprod_hadoop (HDFS), prod_hive
ResourceHDFS path /data/finance/*, Hive db=sales, table=orders, column=*
Users / Groups / Rolesgroup finance_analysts
Permissionsread, write, execute (HDFS); select, update, create, drop (Hive)
ConditionsIP range, time window, tags
Deny conditionsExplicit blocks and exceptions
json { "service": "prod_hive", "name": "sales_orders_select", "resources": { "database": { "values": ["sales"] }, "table": { "values": ["orders"] }, "column": { "values": ["*"] } }, "policyItems": [ { "groups": ["finance_analysts"], "accesses": [ { "type": "select", "isAllowed": true } ] } ] }
bash # create a policy through the REST API curl -u admin:*** -H "Content-Type: application/json" -X POST \ https://ranger.example.com:6182/service/public/v2/api/policy -d @sales_orders_select.jso

Column Masking and Row Filters (Hive)

FeatureEffect
Masking: Partial show last 41234-5678-9012-3456 becomes xxxx-xxxx-xxxx-3456
Masking: Hash / Nullify / Date show yearHide or reduce sensitive values
Row filter expressionregion = 'EU' so a group only sees its rows

Users query the same table. Ranger rewrites the query on the fly, so there are no duplicated 'masked' copies of the data.

Tag-Based Policies

Instead of writing a policy per table, classify data in Apache Atlas (for example tag PII). Tagsync sends tags to Ranger. One policy 'deny PII except group hr' then covers every table and file with that tag, even new ones.

Audit

  • Who accessed what, when, from which IP, result (allowed or denied) and which policy applied
  • Store hot audit in Solr or OpenSearch for the UI, and long-term audit in HDFS or object storage
  • Set retention and size limits, audit volume can be huge on busy clusters
  • Forward important events to your SIEM

Typical Rollout Plan

  1. Install Ranger Admin with a production database and TLS
  2. Enable usersync from your directory
  3. Add services and enable plugins in audit-only mode first, to learn real access patterns
  4. Create policies by group, not by individual user
  5. Turn off permissive fallback only when ready
  6. Add masking, row filters and tag policies
  7. Review policies and audit reports regularly
Native permissions still exist: A user blocked in Ranger could still read data through a different path if HDFS permissions are open (for example, reading Hive files directly in HDFS). Keep HDFS permissions tight and use Ranger HDFS policies for the warehouse directories.
Naming conventions: Name policies clearly (<service>_<dataset>_<role>) and keep an export of policies in Git as a backup and review trail.

Conclusion

Ranger centralises authorization with per-service plugins, group-based policies, masking, row filters, tag policies and audit. Roll out with audit first, keep native permissions tight and back up policies.

Quick Summary: Ranger Admin + plugins; policy = resource + group + permission; masking; tag policies; audit.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators