Skip to content

RANGER-5712: Fix Trino/Ozone plugin auth in ranger-docker - #1116

Open
ramackri wants to merge 12 commits into
apache:masterfrom
ramackri:RANGER-5712
Open

RANGER-5712: Fix Trino/Ozone plugin auth in ranger-docker#1116
ramackri wants to merge 12 commits into
apache:masterfrom
ramackri:RANGER-5712

Conversation

@ramackri

@ramackri ramackri commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix Ozone and Trino plugin authentication in ranger-docker so policy/role download works when Ranger Admin unauthenticated download is disabled (RANGER-5635).

Root cause: Plugins poll Admin without a session while ranger.admin.allow.unauthenticated.download.access=false. Ozone/Trino must authenticate (Kerberos SPNEGO → /secure/.../download/ URLs) instead of using legacy unauthenticated download endpoints, which return HTTP 400 (Unauthenticated access not allowed).

Ozone (Kerberos policy/role pull)

  • Mount KDC keytabs and krb5.conf on OM/SCM/DN via docker-compose.ranger-ozone.yml
  • Configure OM/SCM/DN Kerberos in scripts/ozone/docker-config (envtoconf.py)
  • Use RANGER_KERBEROS_ENABLED + wait_for_keytab / wait_for_scm in ranger-ozone-setup.sh (avoid Ozone entrypoint krb5:8081 wait)
  • Provision om / scm / dn principals in KDC entrypoint.sh
  • Pin OZONE_VERSION=2.1.1 in docker .env (matches pom.xml)

Trino

  • Add Ranger Admin Basic auth in docker ranger-trino-security.xml for secure download

Deploy notes (Ozone 2.1.1 docker)

  1. Ensure KDC keytabs exist: dist/keytabs/om, scm, datanode
  2. Deploy ozone plugin tarball and docker install files:
cd dev-support/ranger-docker
./scripts/ozone/ozone-plugin-docker-setup.sh
# Quarantine host jersey-server only (avoid WadlAutoDiscoverable ClassCastException on Ozone 2.1.x):
OZONE_LIB="downloads/ozone-${OZONE_VERSION}/share/ozone/lib"
mkdir -p "${OZONE_LIB}/.ranger-jersey-workaround"
mv "${OZONE_LIB}"/jersey-server-*.jar "${OZONE_LIB}/.ranger-jersey-workaround/" 2>/dev/null || true
rm -f "downloads/ozone-${OZONE_VERSION}/.setupDone"
docker compose -f docker-compose.ranger.yml -f docker-compose.ranger-ozone.yml up -d --no-deps --force-recreate datanode scm om
  1. Confirm Admin access log shows /service/plugins/secure/policies/download/dev_ozone HTTP 200 (not HTTP 400 on non-secure /download/)

Verification (Ranger Admin access log)

Before (non-secure URLs, no Kerberos session):

GET /service/plugins/policies/download/dev_ozone?... HTTP/1.1" 400
GET /service/roles/download/dev_ozone?... HTTP/1.1" 400

After (Kerberos SPNEGO on secure endpoints, Ozone 2.1.1 / Java 21):

GET /service/roles/secure/download/dev_ozone?pluginId=ozone@om.rangernw-dev_ozone&... HTTP/1.1" 401
GET /service/roles/secure/download/dev_ozone?pluginId=ozone@om.rangernw-dev_ozone&... HTTP/1.1" 200
GET /service/plugins/secure/policies/download/dev_ozone?... HTTP/1.1" 200
GET /service/gds/secure/download/dev_ozone?... HTTP/1.1" 200
GET /service/tags/secure/download/dev_ozone?... HTTP/1.1" 200

The initial 401 → 200 on roles is expected Kerberos SPNEGO behavior. Steady-state polls return 304 (not modified) with lastKnownVersion=25 / lastKnownRoleVersion=8.

Test plan

  • OM/SCM/DN start with Kerberos; /etc/keytabs mounted; no krb5:8081 wait
  • PolicyRefresher downloads policies/roles (policyVersion=25, roleVersion=8 on Ozone 2.1.1)
  • Admin access log: secure download URLs for dev_ozone return 200; no recurring 400 on non-secure /download/
  • Trino secure policy/role download (Basic auth config in this PR)

@ramackri
ramackri requested a review from mneethiraj July 30, 2026 03:52
Configure policy.rest.client username/password so the Trino plugin uses secure download endpoints instead of relying on unauthenticated Admin access.
@ramackri ramackri changed the title RANGER-5712: Enable unauthenticated plugin download in ranger-docker dev sandbox RANGER-5712: Authenticate Trino plugin to Ranger Admin in docker Jul 30, 2026
Wire OM/SCM/DN keytabs, ozone-site kerberos settings, and plugin JAAS so the Ozone plugin authenticates to Ranger Admin via secure download instead of unauthenticated access.
@ramackri ramackri changed the title RANGER-5712: Authenticate Trino plugin to Ranger Admin in docker RANGER-5712: Fix Trino/Ozone plugin auth in ranger-docker Jul 30, 2026
ramk added 4 commits July 30, 2026 09:39
Policy download uses OM kerberos from docker-config; Solr audit JAAS settings are not needed in install.properties.
Policy download auth is driven by policy.download.auth.users and OM Kerberos from docker-config, not the service hadoop.security.authentication field.
Do not pass KERBEROS_ENABLED into Ozone containers because Ozone libexec/entrypoint.sh waits for its own mini-KDC at krb5:8081. Ranger already provisions om/scm/dn keytabs via ranger-kdc; use RANGER_KERBEROS_ENABLED for setup-script keytab wait and keep Kerberos enabled via ozone-site.xml plus mounted keytabs.
Align dev-support/ranger-docker .env with pom.xml ozone.version for
Kerberos policy-download testing on Ozone 2.1.x.
@ramackri
ramackri requested review from rameeshm and vperiasamy July 30, 2026 12:41
Quarantine jersey-server from Ozone lib on host setup and OM startup to
avoid WadlAutoDiscoverable ClassCastException when Kerberos secure download
uses the Ranger plugin Jersey client.
Align plugin-ozone.xml packaging with RANGER-5642 so the plugin uses Ozone's
Jersey on the app classpath and avoids WadlAutoDiscoverable ClassCastException
when Kerberos secure policy download is enabled.
Comment thread dev-support/ranger-docker/README.md Outdated
ramk added 2 commits July 30, 2026 23:26
Keep the Jersey/Jackson assembly fix in plugin-ozone.xml only.
Restore dev-support/ranger-docker/README.md to match master.
Comment thread dev-support/ranger-docker/scripts/ozone/quarantine-ozone-jersey-server.sh Outdated
The plugin-ozone.xml packaging fix excludes duplicate Jersey/Jackson from the
plugin tarball; quarantining Ozone lib jars is no longer needed.
@kumaab

kumaab commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Thanks @ramackri for the patch. I think at least one authz call from Ozone and Trino into Ranger should be tested and see that we observe an audit record in Audits tab in Ranger UI after these changes.

Jersey 2.x needs javax.annotation.Priority on the same classpath as Ozone's
jersey-client after excluding duplicate Jersey from the plugin tarball.
OZONE_VERSION: ${OZONE_VERSION}
RANGER_KERBEROS_ENABLED: ${KERBEROS_ENABLED}
# Jersey 2.x on Ozone's OM classpath needs javax.annotation.Priority (jar is under share/ozone/lib but omitted from default OM CP).
OZONE_MANAGER_CLASSPATH: /opt/hadoop/ranger-ozone-plugin/lib/libext/*:/opt/hadoop/ranger-ozone-plugin/conf:/opt/hadoop/share/ozone/lib/javax.annotation-api-*.jar

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env variable is already present in Dockerfile, please see if it can be removed from here.

Adding @adoroszlai for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants