Apache Ranger (Enterprise)
Apache Ranger holds the access policies of an Ilum installation: table, column, masking and row-filter policies for the
governed Spark SQL engines and Trino, and the bucket and prefix policies that
policy-sync compiles into Ceph RGW. Ilum ships Ranger as the ilum-ranger module, built
from the Apache Ranger 2.9.0 release.
Componenti
| Component | Role |
|---|---|
| Ranger admin | Policy store, REST API and web UI on port 6080. Keeps policies, users and its own audit in PostgreSQL |
| Usersync (optional) | Copies users and groups from LDAP or Active Directory into Ranger |
| Bootstrap Job | Runs after every install and upgrade: registers the ilum-objectstore service definition and creates services and internal users |
The bootstrap creates three services:
| Servizio | Digitare | Read by |
|---|---|---|
ilum_spark | alveare | Governed Spark SQL engines (ilum-sql.governed) |
ilum_trino | Trino | Trino with Ranger access control |
ilum_objectstore | ilum-objectstore | policy-sync |
On a service it creates, the bootstrap removes the items of Ranger's default policies that grant access to the
pubblico group, to {USER} or to the service's lookup user, which Ranger grants everything although Ilum sets up no
lookups. A new service then grants nothing until policies are written, except the items for {OWNER} that let the owner
of a table manage it. Existing services are left as they are.
Fabbisogno
- A PostgreSQL database owned by Ranger's database user. With the bundled PostgreSQL, Ilum creates the database
rangerand Ranger connects with theilum-postgres-credentialsSecret. - The images
ilum/ranger-admineilum/ranger-usersyncin a registry the cluster can reach. - For directory users: an LDAP or Active Directory server and a bind user that may read users and groups.
Installing
Enable the module in helm_aio:
helm upgrade ilum ilum/ilum --reuse-values --set ilum-ranger.enabled=true
The first start of Ranger admin creates its schema and takes several minutes. The bootstrap Job waits for it:
kubectl logs -f job/ilum-ranger-bootstrap-<revision>
The passwords of Ranger's built-in users (Admin, keyadmin, rangerusersync, rangertagsync) are generated into the
Secret ilum-ranger-passwords and kept across upgrades. The Admin password signs in to the Ranger UI:
kubectl get secret ilum-ranger-passwords -o jsonpath='{.data.admin}' | base64 -d
Ranger stores these passwords in its database on the first start. Keep the Secret: it is not removed on uninstall, and a new password does not match a database that already exists.
To use Secrets of your own, create one with the keys Admin, keyadmin, usersync e tagsync (at least 8
characters, letters and digits) and set ilum-ranger.passwords.existingSecret.
Users and groups from the directory
Usersync copies users and groups into Ranger every usersync.intervalMinutes (5 by default). The names Ranger sees must
be the names the engines resolve for a user, so choose the user name attribute once and use it everywhere.
ilum-ranger:
usersync:
Abilitato: vero
LDAP:
URL: LDAP://dc1.example.com:636
bindDn: CN=svc-ranger,OU=Service,DC=example,DC=com
userSearchBase: OU=Users,DC=example,DC=com
userObjectClass: utente
userNameAttribute: sAMAccountName
groupSearchBase: OU=Groups,DC=example,DC=com
groupObjectClass: group
bindPasswordSecret:
nome: ranger-LDAP-bind
chiave: parola d’ordine
To check passwords against the directory when users sign in to the Ranger UI, set authentication.method A LDAP o
ACTIVE_DIRECTORY and fill in authentication.ldap o authentication.activeDirectory. The bind password comes from
authentication.bindPasswordSecret.
Policy download and network access
Engines download policies from Ranger and keep them in a local cache. The Spark and Trino plugins can sign in to Ranger
only with Kerberos or a JWT, so admin.unauthenticatedPolicyDownload (on by default) lets them download without
signing in. A NetworkPolicy admits only pods of the Ilum namespace to Ranger admin; Spark clusters in other namespaces
are added with networkPolicy.extraFrom:
ilum-ranger:
networkPolicy:
extraFrom:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: scintilla-finance
Policies describe who may access what; they carry no data. policy-sync signs in with its own user, policy-sync, which
the bootstrap creates with a password in the Secret ilum-ranger-users.
Governed engines
The Spark SQL engines and Trino enforce the policies of the services ilum_spark e ilum_trino. The file
values-governed.yaml of the helm_aio chart turns on Ranger, SQL sign-in, the governed SQL engines and Trino with
Ranger access control together; apply it after the installation's own values:
helm upgrade --install ilum ilum/ilum -f my-values.yaml -f values-governed.yaml
Ranger policies match the user name of the SQL session. With SQL sign-in
(global.sqlAuth.enabled) that is the signed-in Ilum user: the SQL engine (Kyuubi) requires credentials, SQL editor
queries run as the user who runs them, and SQL clients and BI tools sign in with an Ilum user name and a personal
access token or password. Keep it on: without it, a client can connect to the SQL engine under any user name.
Spark SQL
The SQL engines run on the governed Spark image (ilum/spark:<version>-delta-governed), which carries the Ranger plugin
for Spark SQL, and ilum-core turns on the SQL guard, which blocks statements that would run code or read files past
Ranger. The file replaces ilum-core.presets as a whole, so presets changed for the installation are carried over into
it. The default cluster takes kubernetes.defaultCluster.sparkImage on its first start only; on an existing
installation, the image of the cluster is set in its settings.
A user's groups come from Ranger's user store, so the user and group names must be the ones usersync brings from the directory.
Trino
Trino runs with Ranger access control (access-control.name=ranger) and reads a user's groups from Ranger's user store.
Users reach Trino through the SQL engine (engine type TRINO), which passes the signed-in user. Trino itself trusts the
user name a client sends, so its NetworkPolicy admits only the SQL engine and the Trino pods. The SQL engine refuses
connection settings that would point the Trino engine at another server.
The Superset connection that helm_aio creates goes to Trino directly, as the user ilum. With values-governed.yaml
the NetworkPolicy blocks it; connect Superset through the SQL engine instead, so queries run as the signed-in user.
A new ilum_trino service grants nothing. Before any query runs, two policies are needed in addition to the table
policies:
| Risorsa | Access | Granted to |
|---|---|---|
trinouser = {USER} | impersonate | pubblico: each user acts as itself |
queryid = * | eseguire | pubblico: users may run queries; tables still need their own policies |
When Ranger admin is down
Engines keep the policies they downloaded and go on enforcing them; Trino and running Spark SQL engines are not interrupted. A Spark SQL engine that starts while Ranger admin is down has no policies and serves no data: it denies the tables or does not start at all. Policy changes reach the engines within their poll interval (30 seconds) once Ranger is back.
Audit
Ranger admin records policy changes and sign-ins in its database; they are shown under Audit > Admin in the
Ranger UI. Access decisions are logged by the engines' plugins (logger ranger_audit in the Spark SQL driver,
xaaudit in Trino), and Ranger's own logs go to standard output. The Spark SQL engine, Trino (with values-governed.yaml),
Ranger and policy-sync pods carry the label ilum.logAggregation: "true", so the bundled Promtail ships their logs to Loki
when Loki and Promtail are enabled (global.logAggregation.loki.enabled, global.logAggregation.promtail.enabled).
No Solr or OpenSearch audit store is configured, so the Access tab of the Ranger UI stays empty.
Configurazione
| Nome | Descrizione | Default |
|---|---|---|
ilum-ranger.enabled | Deploy Ranger | falso |
ilum-ranger.admin.externalUrl | URL clients use for Ranger admin | http://ilum-ranger:6080 |
ilum-ranger.admin.unauthenticatedPolicyDownload | Let plugins download policies without signing in | vero |
ilum-ranger.admin.siteProperties | Extra ranger-admin-site.xml proprietà | {} |
ilum-ranger.authentication.method | NONE, LDAP o ACTIVE_DIRECTORY | NONE |
ilum-ranger.database.* | PostgreSQL host, port, database and credentials Secret | bundled PostgreSQL, database ranger |
ilum-ranger.usersync.enabled | Deploy usersync | falso |
ilum-ranger.bootstrap.services | Services the bootstrap creates | ilum_trino, ilum_spark, ilum_objectstore |
ilum-ranger.bootstrap.users | Internal users the bootstrap creates | [policy-sync] |
ilum-ranger.networkPolicy.extraFrom | Extra peers allowed to reach Ranger admin | [] |
ilum-ranger.podLabels | Labels added to every Ranger pod | ilum.logAggregation: "true" |
The chart's README lists every parameter.
Risoluzione dei problemi
- Ranger admin restarts during the first start: the schema creation takes longer than the startup probe allows on a
slow database. Check the pod log for
db_setuperrors; the probe allows ten minutes. - The bootstrap Job fails with
Ranger admin refused the admin password: HTTP 401: theAdminpassword inilum-ranger-passwordsdoes not match the database, usually after the Secret was deleted. Restore the Secret, or reset the password in the Ranger database. - Engines deny everything after Ranger was unreachable at their start: plugins read their policy cache. An engine started without a cache and without Ranger has no policies, and denies.