# Apache Ranger

**Apache Ranger** 是一个开源框架，用于跨数据平台提供集中式、细粒度的授权与审计，最初为 [Apache Hadoop](https://www.edgepedia.org/zh/apache-hadoop) 生态系统构建，现已扩展至云服务以及 [Apache Iceberg](https://www.edgepedia.org/zh/apache-iceberg) 目录等 AI 时代的数据格式。管理员在中央 Web 应用 Ranger Admin 中定义访问策略，部署在每个受保护服务内部的轻量级插件拉取这些策略，并在每次访问请求时于本地执行授权决策，同时记录审计轨迹<sup>[1](https://github.com/apache/ranger)</sup>。该项目是 Apache 软件基金会的顶级项目，依据 Apache License 2.0 开发<sup>[2](https://apache.github.io/ranger/project/community/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 是什么 | 一个跨数据与 AI 平台提供集中式、细粒度授权与审计的框架<sup>[1](https://github.com/apache/ranger)</sup> |
| 起源 | Hortonworks 从其收购的 XA Secure 中捐赠了约 44 万行代码，在 Apache 孵化器中启动该项目<sup>[3](https://community.cloudera.com/t5/Community-Articles/Apache-Ranger-Graduates-to-a-Top-Level-Project-Part-1-The/ta-p/244561)</sup> |
| 孵化与毕业 | 2014-07-24 进入孵化；2017-01-18 毕业为顶级项目<sup>[4](https://incubator.apache.org/projects/ranger.html)</sup> |
| 首个 Apache 版本 | 2014-11-17 发布的 0.4.0：为 HDFS、HiveServer2、HBase、Knox 和 Storm 提供集中式授权与审计<sup>[2](https://apache.github.io/ranger/project/community/)</sup> |
| 当前稳定版本 | 2.9.0，2026 年 8 月 8 日发布，新增独立 PDP 服务器、Polaris 插件和 Ozone 基于动作的策略<sup>[5](https://apache.github.io/ranger/release-notes/2.9.0/)</sup> |
| 策略类型 | 基于资源、基于标签、基于角色和基于属性的策略，外加数据脱敏和行过滤<sup>[6](https://apache.github.io/ranger/blog/policy-model/)</sup> |
| 执行模型 | 插件运行在每个受保护服务自身的进程内，按配置的间隔（例如 30 秒）从 Ranger Admin 拉取策略并在本地缓存<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup> |

## 目的与目标

Ranger 解决的是在众多独立数据服务之间一致地管理安全性的问题。项目提出五个目标：通过中央 UI 或 REST API 实现集中式安全管理；对 Hadoop 组件上的特定操作进行细粒度授权；跨组件采用标准化授权方法；增强对不同授权方法的支持，如基于角色和基于属性的访问控制；以及对所有组件上的用户访问和安全相关管理操作进行集中审计<sup>[8](https://ranger.apache.org/)</sup>。

随着数据平台本身的演变，该框架也超越了 Hadoop。借助 Apache YARN，Hadoop 可以支持多租户数据湖架构，Ranger 的设计者认为数据安全需要支持多种访问用例，同时提供中央策略管理和监控<sup>[8](https://ranger.apache.org/)</sup>。GitHub 仓库现在将范围描述为“数据与 AI 平台”<sup>[1](https://github.com/apache/ranger)</sup>，而 2.9.0 的一个插件可为 [Apache Polaris](https://www.edgepedia.org/zh/apache-polaris) 管理的 Apache Iceberg 目录授权<sup>[5](https://apache.github.io/ranger/release-notes/2.9.0/)</sup>。

## 架构

从威胁模型的角度看，Ranger 是一个分布式的策略决策与策略执行系统。策略决策权归属于管理服务器，由它编写和分发策略，但执行点以插件代码的形式运行在其所保护的数据服务内部；项目 FAQ 指出，插件与 HDFS 的 NameNode、Hive 的 HiveServer2 以及 HBase 服务器运行在同一进程中<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。

**Ranger Admin** 是中央 Web 应用和 REST 服务，策略在此编写并存储在数据库中。**插件**扩展 `RangerBasePlugin`，后者承担三项职责：通过 `PolicyRefresher` 从 Ranger Admin 后台同步策略；使用 `RangerResourceTrie` 进行区域感知的策略查找以评估访问；以及生成审计记录并将其路由到配置的目的地<sup>[9](https://apache.googlesource.com/ranger/%2B/3a7590544aba27016d9d543aba09cb45f163ad9a/agents-common/README.md)</sup>。插件缓存最近已知的策略，并在策略服务器暂时不可用时继续运行<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。

配套服务完善了部署。Usersync 从 LDAP、Active Directory 或 Unix 等身份源读取用户和组成员关系；TagSync 处理分类标签（例如来自 [Apache Atlas](https://www.edgepedia.org/zh/apache-atlas) 的标签），基于标签的策略依赖这些标签；Ranger KMS 为 HDFS 透明加密提供密钥管理服务<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。从 2.9.0 版本起，新的 `pdp` 模块将策略引擎作为独立服务运行，通过 REST 响应授权请求，并配有 `authz-remote` 库让应用以瘦客户端方式集成；这适用于非 Java 应用、不希望嵌入 Ranger 库的应用，以及希望减小客户端占用的场景<sup>[5](https://apache.github.io/ranger/release-notes/2.9.0/)</sup><sup> • </sup><sup>[10](https://apache.github.io/ranger/blog/integrating-applications/)</sup>。

插件通过 Kerberos、JWT 或基于头部的认证（配合可信代理）以及 SSL/TLS 向 Ranger Admin 进行身份验证<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup><sup> • </sup><sup>[11](https://ranger.apache.org/blogs/integrating_applications.html)</sup>。Ranger 本身在数据访问时不认证最终用户；由宿主服务认证主体，并将已认证的身份交给插件<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。

## 策略模型

应用提交授权请求，标识用户、资源和请求的访问权限；Ranger 根据适用的策略评估请求并返回决策<sup>[11](https://ranger.apache.org/blogs/integrating_applications.html)</sup>。策略可以基于资源、标签或属性，并可以过滤行和脱敏列<sup>[1](https://github.com/apache/ranger)</sup>。

该模型包含若干用于企业管理的构造。委托管理允许组所有者管理有限资源范围内的策略。安全区域可以包含来自多个服务和应用的资源，例如 AWS S3、ADLS-Gen2、GCS、Snowflake、Amazon Redshift、Postgres、Apache Hadoop、Hive、HBase 和 Kafka，并限定授权检查所适用的资源范围<sup>[6](https://apache.github.io/ranger/blog/policy-model/)</sup><sup> • </sup><sup>[12](https://www.impetus-project.eu/images/Deliverables/Deliverable_41.pdf)</sup>。策略支持允许、拒绝和例外条目，资源名中的通配符、宏和变量（例如用用户属性 `${{USER.dept}}` 授予对某部门数据的访问权限），以及限制策略条目生效时间的有效期计划<sup>[6](https://apache.github.io/ranger/blog/policy-model/)</sup><sup> • </sup><sup>[2](https://apache.github.io/ranger/project/community/)</sup>。

## 支持的服务

Ranger 为一系列长名单中的服务提供插件，包括 HDFS（插件位于 NameNode）、Hive（HiveServer2）、HBase（Master 和 RegionServer）、Kafka（broker）、YARN（ResourceManager）、Knox、Storm、Solr、Elasticsearch、NiFi 和 NiFi Registry、Atlas、Sqoop、Kylin、Schema Registry、Kudu、Ozone、Presto、Impala、Trino 和 Polaris<sup>[1](https://github.com/apache/ranger)</sup>。部分插件以 `ranger-<version>-<service>-plugin.tar.gz` 归档形式随 Apache Ranger 发布，而其他服务自行随附插件，并在自身配置中启用插件<sup>[1](https://github.com/apache/ranger)</sup>。未被覆盖的应用可以使用组件中立的授权 API（`authz-api`），在进程内（`authz-embedded`）或通过 PDP 服务器远程（`authz-remote`，2.9.0 起可用）评估策略<sup>[1](https://github.com/apache/ranger)</sup>。

## 历史与版本

Hortonworks 将 XA Secure 代码库（约 44 万行）捐赠给 Apache 软件基金会，以启动该孵化器项目；项目于 2014-07-24 进入孵化，首个版本 ranger-0.4-incubating 于 2014-11-17 发布<sup>[3](https://community.cloudera.com/t5/Community-Articles/Apache-Ranger-Graduates-to-a-Top-Level-Project-Part-1-The/ta-p/244561)</sup><sup> • </sup><sup>[4](https://incubator.apache.org/projects/ranger.html)</sup>。2015 年 6 月的 0.5.0 版本增加了对 YARN、Kafka 和 Solr 的支持<sup>[2](https://apache.github.io/ranger/project/community/)</sup>。项目于 2017-01-18 毕业为顶级项目<sup>[4](https://incubator.apache.org/projects/ranger.html)</sup>。

近期版本显示了项目的方向。2.5.0 版本（2024 年）带来了新的基于 React 的 UI、UserSync 和 TagSync 的高可用性，以及将角色用作安全区域管理员和审计员的支持<sup>[2](https://apache.github.io/ranger/project/community/)</sup>。2.6.0 版本（2025 年 2 月 15 日）改进了策略评估性能，并为 Ozone 资源增加了 TagSync 支持<sup>[2](https://apache.github.io/ranger/project/community/)</sup>。2.7.0 版本（2025 年 7 月 30 日）将审计框架拆分为每个目的地一个库，这对自定义插件实现者是一项破坏性变更，并将脚本现代化以支持 Python 3<sup>[13](https://apache.github.io/ranger/release-notes/2.7.0/)</sup>。2.8.0 版本（2026 年 3 月 1 日）引入了 `authz-api` 和 `authz-embedded` 模块、服务管理的 ACL（内联策略）、Kerberos 化的 Solr 审计支持、移除插件的 `hadoop-common` 依赖，以及插件与 Ranger Admin 之间的 JWT 认证<sup>[14](https://apache.github.io/ranger/release-notes/2.8.0/)</sup>。2.9.0 版本（2026 年 8 月 8 日）增加了 PDP 服务器、Polaris 插件、由功能开关控制的 Ozone 基于动作的策略，以及基于头部的认证<sup>[5](https://apache.github.io/ranger/release-notes/2.9.0/)</sup>。

Apache 发布目录记录的两个最新版本的发布日期略有不同，将 2.8.0 列为 2026 年 2 月 26 日发布，2.9.0 列为 2026 年 8 月 5 日发布<sup>[15](https://release-catalog.apache.org/ranger/index.html)</sup>，而项目自己的发布说明中为 3 月 1 日和 8 月 8 日<sup>[14](https://apache.github.io/ranger/release-notes/2.8.0/)</sup><sup> • </sup><sup>[5](https://apache.github.io/ranger/release-notes/2.9.0/)</sup>。

截至 2026 年中，项目报告有 40 名提交者和 19 名 PMC 成员，董事会报告称活动持续处于中高水平<sup>[16](https://www.apache.org/foundation/board/minutes/Ranger.html)</sup>。

## 运维特性

若干特性对运维人员很重要。策略变更按插件的拉取间隔传播，因此刚被撤销的授权可能持续到下一次成功拉取；项目的威胁模型指出，撤销不应被视为即时生效<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。如果插件既无法评估新策略也无法评估缓存策略，则拒绝访问，但 HDFS 插件例外，它可以回退到原生 ACL<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。执行依赖于宿主服务在每条访问路径上实际调用插件；不调用插件的代码路径不受 Ranger 保护<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。审计条目记录访问决策，但不阻止访问<sup>[7](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)</sup>。

为便于评估和开发，官方 Docker 镜像以 `apache` 组织名义发布，适用于 2.4.0 及以后的版本，将 Ranger Admin 与 [PostgreSQL](https://www.edgepedia.org/zh/postgresql) 数据库镜像和 Solr 审计存储镜像配对；这些镜像使用众所周知的默认密码，不适用于生产环境<sup>[1](https://github.com/apache/ranger)</sup><sup> • </sup><sup>[17](https://apache.github.io/ranger/release-notes/download/)</sup>。

## References

1. [apache/ranger on GitHub](https://github.com/apache/ranger)
2. [Community - Apache Ranger](https://apache.github.io/ranger/project/community/)
3. [Apache Ranger Graduates to a Top Level Project! - Cloudera Community](https://community.cloudera.com/t5/Community-Articles/Apache-Ranger-Graduates-to-a-Top-Level-Project-Part-1-The/ta-p/244561)
4. [Ranger Status - Apache Incubator](https://incubator.apache.org/projects/ranger.html)
5. [Apache Ranger 2.9.0 release notes](https://apache.github.io/ranger/release-notes/2.9.0/)
6. [Apache Ranger policy model](https://apache.github.io/ranger/blog/policy-model/)
7. [ranger THREAT_MODEL.md on GitHub](https://github.com/apache/ranger/blob/master/THREAT_MODEL.md)
8. [Apache Ranger - Introduction](https://ranger.apache.org/)
9. [ranger-plugins-common (agents-common) README](https://apache.googlesource.com/ranger/%2B/3a7590544aba27016d9d543aba09cb45f163ad9a/agents-common/README.md)
10. [Integrating applications with Ranger](https://apache.github.io/ranger/blog/integrating-applications/)
11. [Integrating Applications with Apache Ranger (ranger.apache.org blog)](https://ranger.apache.org/blogs/integrating_applications.html)
12. [Impetus project deliverable describing Ranger architecture](https://www.impetus-project.eu/images/Deliverables/Deliverable_41.pdf)
13. [Apache Ranger 2.7.0 release notes](https://apache.github.io/ranger/release-notes/2.7.0/)
14. [Apache Ranger 2.8.0 release notes](https://apache.github.io/ranger/release-notes/2.8.0/)
15. [Apache Ranger ~ Apache Release Catalog](https://release-catalog.apache.org/ranger/index.html)
16. [Board history: Ranger, Apache Software Foundation](https://www.apache.org/foundation/board/minutes/Ranger.html)
17. [Download and verify - Apache Ranger](https://apache.github.io/ranger/release-notes/download/)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Database security, privacy, and law › Database access control and security management

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/apache-ranger

English original: https://www.edgepedia.org/apache-ranger
