Skip to content

RANGER-5655: Shared partition plan library, DB patch 078, plugin SPIFFE auth - #1135

Closed
ramackri wants to merge 8 commits into
apache:masterfrom
ramackri:RANGER-5655-patch1
Closed

RANGER-5655: Shared partition plan library, DB patch 078, plugin SPIFFE auth#1135
ramackri wants to merge 8 commits into
apache:masterfrom
ramackri:RANGER-5655-patch1

Conversation

@ramackri

@ramackri ramackri commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Foundation for RANGER-5655 — Admin-managed Kafka audit partition plan and SPIFFE workload identity. This PR combines the first three merge slices (PR1 + PR2 + PR5 from the feature split); Admin REST (PR3) and Ingestor routing/inbound SPIFFE (PR4) follow in separate PRs.

Parent: RANGER-5655 — Ranger Admin-Managed Kafka Audit Partition Plan & SPIFFE Auth

Sub-tasks covered in this PR:

  • RANGER-5719 — Shared partition-plan library and SPIFFE header auth utilities
  • RANGER-5720 — DB patch 078 for audit partition plan global state
  • RANGER-5723 — Plugin SPIFFE outbound auth for audit-server destination

Sub-tasks deferred to follow-on PRs:

  • RANGER-5721 — Admin-managed audit partition plan REST and lifecycle hooks
  • RANGER-5722 — Ingestor dynamic routing, SPIFFE inbound auth, and Admin plan poller

SPIFFE outbound auth — aligned with RANGER-5700 (#1096)

  • Outbound auth is handled in Java only (RangerAuditServerDestination + PluginHeaderAuthConfig + SpiffeIdentityResolver + RangerRESTClient.setTrustedAuthHeaders()), using the audit destination prefix (JWT-style), not ranger.<service>.authn.* security props.
  • This mirrors #1096: configure auth on the component that owns the HTTP flow, not in every plugin security config.

Audit XML properties for outbound SPIFFE (plugin → audit ingestor)

All SPIFFE outbound settings live under the audit-server destination prefix in ranger-<service>-audit.xml:

xasecure.audit.destination.auditserver

Property Required? Default Purpose
xasecure.audit.destination.auditserver.authn.header.enabled Yes (to enable SPIFFE) false Master switch; SPIFFE headers are not sent unless set to true
xasecure.audit.destination.auditserver.authn.header.spiffe No X-Spiffe-Id HTTP header name for the workload SPIFFE ID
xasecure.audit.destination.auditserver.authn.spiffe.value No (unset) Explicit SPIFFE ID (highest priority)
xasecure.audit.destination.auditserver.authn.spiffe.file No /var/run/secrets/spiffe.io/identity/spiffe SPIRE/agent identity file (first non-blank line)

SPIFFE ID resolution order (when authn.header.enabled=true):

  1. authn.spiffe.value in audit XML
  2. authn.spiffe.file in audit XML (or default SPIRE path above)
  3. SPIFFE_ID environment variable

Minimum enable (typical Kubernetes / SPIRE deployment — identity from file or env):

<property>
  <name>xasecure.audit.destination.auditserver.authn.header.enabled</name>
  <value>true</value>
</property>

Explicit SPIFFE ID (e.g. docker/dev without SPIRE file):

<property>
  <name>xasecure.audit.destination.auditserver.authn.header.enabled</name>
  <value>true</value>
</property>
<property>
  <name>xasecure.audit.destination.auditserver.authn.spiffe.value</name>
  <value>spiffe://example.com/ns/ranger/sa/hive</value>
</property>

Optional custom header name:

<property>
  <name>xasecure.audit.destination.auditserver.authn.header.spiffe</name>
  <value>X-Spiffe-Id</value>
</property>

Also required for audit delivery (unchanged by this PR; not SPIFFE-specific):

  • xasecure.audit.destination.auditserver = true
  • xasecure.audit.destination.auditserver.url = ingestor base URL (e.g. http://ranger-audit-ingestor:7081)

Defaults / safety: authn.header.enabled defaults to false in code (PluginHeaderAuthConfig.isHeaderAuthEnabled). No install-template or enable-script changes are required — operators opt in via audit XML only. Safe to merge before PR4 (ingestor inbound SPIFFE) lands.

  • Per-service audit allow-list on the ingestor comes from policy.download.auth.users in the partition plan (PR3/PR4), not static ingestor XML
  • AuditPluginIdResolver intentionally omitted here; deferred to PR3 with AuditPartitionPlanMgr

Test plan

  • mvn -pl agents-common -am test — partition plan + SPIFFE unit tests pass
  • mvn -pl agents-audit/dest-auditserver -am test -Dtest=RangerAuditServerDestinationTest — pass
  • CI: build-17, plugins-docker-build, services-docker-build, plugins-download-archives
  • DB patch 078 SQL included for all supported DB backends (validated via compile/upgrade path in CI)
  • End-to-end plugin → ingestor SPIFFE POST requires follow-on PR4 (AuditHeaderAuthFilter)

@ramackri
ramackri force-pushed the RANGER-5655-patch1 branch from 1c2f50b to 722ad8a Compare August 5, 2026 04:35
@ramackri
ramackri marked this pull request as draft August 5, 2026 16:45
ramk added 8 commits August 6, 2026 00:27
…FE auth

Adds PR1 shared foundation (partition plan library, PluginHeaderAuthConfig,
SpiffeIdentityResolver, RangerRESTClient trusted headers), PR2 DB patch 078
(global state bootstrap for audit partition plan), and PR5 plugin outbound
SPIFFE auth for audit-server destination with install templates defaulting
to disabled.

Sub-tasks: RANGER-5719, RANGER-5720, RANGER-5723
Do not log auth header names in production INFO logs; log only that
SPIFFE header authentication is enabled for the audit-server destination.
Avoid INFO-level auth mechanism logging in production.
Use static import for requireNonNull per dev-support/checkstyle.xml.
Add SPIFFE tokens to docker plugin install.properties and use %EMPTY%
for optional VALUE/FILE so XmlConfigChanger does not fail during
enable-hdfs-plugin and other docker CI plugin setup.
Complete SPIFFE install.property coverage for all docker and prod
install templates so XmlConfigChanger resolves audit-server SPIFFE
tokens during plugin enable (services-docker-build KMS path).
Align with RANGER-5700 (apache#1096) server-level SPIFFE pattern: map
XAAUDIT.AUDITSERVER.AUTHN.SPIFFE.* directly into
xasecure.audit.destination.auditserver.authn.* via audit-changes.cfg
(JWT-style), remove per-plugin ranger.<service>.authn.* entries from
security-changes.cfg, and use the audit destination prefix in
RangerAuditServerDestination.
Follow RANGER-5700 (apache#1096): outbound SPIFFE is handled in Java via
RangerAuditServerDestination and SpiffeIdentityResolver (SPIRE file
or SPIFFE_ID env). Remove 51 plugin install.properties, audit-changes,
and security-changes SPIFFE entries; revert accidental newline-only
security-changes edits. Operators enable with a single audit-xml property:

xasecure.audit.destination.auditserver.authn.header.enabled=true
@ramackri

ramackri commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of three focused PRs split from this branch:

Merge order: #1137 and #1138 can land in parallel; #1139 after #1137 (rebase onto master).

@ramackri ramackri closed this Aug 6, 2026
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.

1 participant