RANGER-5743: Docker setup for Apache Ranger ElasticSearch plugin and Integrate ES plugin with x-pack-security on ES 7.17 by pradeepagrawal8184 · Pull Request #1153 · apache/ranger · GitHub
This PR makes the Ranger Elasticsearch plugin work with Elasticsearch 7.17 + X-Pack Security instead of relying on client-supplied identity headers. It adds end-to-end Docker bring-up, fixes plugin packaging/classloading for ES 7.17, and wires audits through the Ranger audit ingestor path under Kerberos.
How was this patch tested?
The two commits were tested at three levels: automated unit tests (commit 1 only), manual Docker integration (commit 2, and validating commit 1 in a real ES stack), and problem reproduction before the fix. There is no new CI/integration test suite checked into the PR for the Docker or audit paths.
Commit 1 — RANGER-5740 (X-Pack caller identity)
Automated unit tests
Run with:
mvn -pl ranger-elasticsearch-plugin-shim verify
This was run repeatedly during development and passes today. It includes 5 JUnit 5 tests in two classes:
Test class
What it verifies
TestElasticsearchAuthenticatedUserResolver
Verified user comes from X-Pack SecurityContext; null when no user; system context skips auth requirement
TestRangerSecurityRestFilter
Rejects unverified Authorization: Basic (401, handler not called); accepts when X-Pack has set a verified user
These are mock-based unit tests — they do not start Elasticsearch or Ranger Admin.
Manual / planned testing
The commit message / PR test plan also listed manual checks that were not automated in the repo:
Deploy on ES 7.17 with X-Pack Security enabled
Authenticated REST requests authorized under the ES-authenticated user
Wrong Basic password must not grant another user’s Ranger permissions
Pre-fix validation (motivation)
The original issue was reproduced separately on Ranger 2.9.0 in an isolated runtime replay: wrong Basic password still authorized as the named user. That confirmed the bug before this fix.
Commit 2 — RANGER-5743 (Docker + full ES 7.17 / X-Pack integration)
No new automated tests
This commit adds no new unit or integration tests. Validation was done by bringing up the Ranger Docker stack and exercising ES manually.
Documented in dev-support/ranger-docker/README.md:
curl -u elastic:rangerR0cks! http://localhost:9201/test-index/_search # expect 200 or policy 403, not 401
curl http://localhost:9201/test-index/_search # expect 401
Docker integration testing (manual, iterative)
The second commit was validated through many rebuild / recreate cycles of ranger-elasticsearch against a running stack (Ranger Admin, KDC, Solr, Kafka, audit ingestor, etc.). Issues found and fixed during testing included:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR makes the Ranger Elasticsearch plugin work with Elasticsearch 7.17 + X-Pack Security instead of relying on client-supplied identity headers. It adds end-to-end Docker bring-up, fixes plugin packaging/classloading for ES 7.17, and wires audits through the Ranger audit ingestor path under Kerberos.
How was this patch tested?
The two commits were tested at three levels: automated unit tests (commit 1 only), manual Docker integration (commit 2, and validating commit 1 in a real ES stack), and problem reproduction before the fix. There is no new CI/integration test suite checked into the PR for the Docker or audit paths.
Commit 1 — RANGER-5740 (X-Pack caller identity)
Automated unit tests
Run with:
This was run repeatedly during development and passes today. It includes 5 JUnit 5 tests in two classes:
These are mock-based unit tests — they do not start Elasticsearch or Ranger Admin.
Manual / planned testing
The commit message / PR test plan also listed manual checks that were not automated in the repo:
Pre-fix validation (motivation)
The original issue was reproduced separately on Ranger 2.9.0 in an isolated runtime replay: wrong Basic password still authorized as the named user. That confirmed the bug before this fix.
Commit 2 — RANGER-5743 (Docker + full ES 7.17 / X-Pack integration)
No new automated tests
This commit adds no new unit or integration tests. Validation was done by bringing up the Ranger Docker stack and exercising ES manually.
Documented in dev-support/ranger-docker/README.md:
Smoke tests from the README:
Docker integration testing (manual, iterative)
The second commit was validated through many rebuild / recreate cycles of ranger-elasticsearch against a running stack (Ranger Admin, KDC, Solr, Kafka, audit ingestor, etc.). Issues found and fixed during testing included:
Authorization smoke tests (verified in Docker)
Against test-index on port 9201:
Test users are created offline via file realm (roles.yml + elasticsearch-users) because Ranger blocks ES security REST APIs.
Audit pipeline testing (partial)
Also tested manually in the same Docker stack:
Not fully verified end-to-end: audits appearing in Solr via Kafka/dispatcher (Solr Kerberos blocked direct query verification).