Aller au contenu principal

Apache Ranger (Entreprise)

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.

Composants​

ComponentRole
Ranger adminPolicy 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 JobRuns after every install and upgrade: registers the ilum-objectstore service definition and creates services and internal users

The bootstrap creates three services:

ServiceTypeRead by
ilum_sparkrucheGoverned Spark SQL engines (ilum-sql.governed)
ilum_trinoTrinoTrino with Ranger access control
ilum_objectstoreilum-objectstorepolicy-sync

On a service it creates, the bootstrap removes the items of Ranger's default policies that grant access to the public 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.

Exigences​

  • A PostgreSQL database owned by Ranger's database user. With the bundled PostgreSQL, Ilum creates the database ranger and Ranger connects with the ilum-postgres-credentials Secret.
  • The images ilum/ranger-admin et ilum/ranger-usersync in 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
avertissement

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 et 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:
Activé: vrai
LDAP:
URL: LDAPS://dc1.example.com:636
bindDn: CN=svc-ranger,OU=Service,DC=example,DC=com
userSearchBase: OU=Users,DC=example,DC=com
userObjectClass: utilisateur
userNameAttribute: sAMAccountName
groupSearchBase: OU=Groups,DC=example,DC=com
groupObjectClass: group
bindPasswordSecret:
nom: ranger-LDAP-bind
clé: mot de passe

To check passwords against the directory when users sign in to the Ranger UI, set authentication.method À LDAP ou ACTIVE_DIRECTORY and fill in authentication.ldap ou 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: étincelle-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 et 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.

Trinitaire​

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.

note

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:

RessourceAccessGranted to
trinouser = {USER}impersonatepublic: each user acts as itself
queryid = *exécuterpublic: 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.

Configuration​

NomDescriptionFaire défaut
ilum-ranger.enabledDeploy Rangerfaux
ilum-ranger.admin.externalUrlURL clients use for Ranger adminhttp://ilum-ranger:6080
ilum-ranger.admin.unauthenticatedPolicyDownloadLet plugins download policies without signing invrai
ilum-ranger.admin.sitePropertiesExtra ranger-admin-site.xml properties{}
ilum-ranger.authentication.methodNONE, LDAP ou ACTIVE_DIRECTORYNONE
ilum-ranger.database.*PostgreSQL host, port, database and credentials Secretbundled PostgreSQL, database ranger
ilum-ranger.usersync.enabledDeploy usersyncfaux
ilum-ranger.bootstrap.servicesServices the bootstrap createsilum_trino, ilum_spark, ilum_objectstore
ilum-ranger.bootstrap.usersInternal users the bootstrap creates[policy-sync]
ilum-ranger.networkPolicy.extraFromExtra peers allowed to reach Ranger admin[]
ilum-ranger.podLabelsLabels added to every Ranger podilum.logAggregation: "true"

The chart's README lists every parameter.

Dépannage​

  • 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_setup errors; the probe allows ten minutes.
  • The bootstrap Job fails with Ranger admin refused the admin password: HTTP 401: the Admin password in ilum-ranger-passwords does 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.