RANGER-5720: DB patch 078 — x_audit_config table and audit server bootstrap - #1138
RANGER-5720: DB patch 078 — x_audit_config table and audit server bootstrap#1138ramackri wants to merge 9 commits into
Conversation
Add patch 078 and optimized schema updates for all DB backends: seed rangerauditserver with ROLE_ADMIN_AUDITOR and register RangerAuditPartitionPlan global state name for RANGER-5655 admin-managed partition plans.
There was a problem hiding this comment.
Pull request overview
Adds DB patch 078 across all supported Ranger databases for audit partition-plan state and machine-user setup.
Changes:
- Widens
app_datafor partition-plan growth. - Seeds the initial audit partition plan.
- Creates
rangerauditserverwithROLE_ADMIN_AUDITOR.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| security-admin/db/sqlserver/patches/078-audit-partition-plan-global-state.sql | Updated as part of this pull request. |
| security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql | Updated as part of this pull request. |
| security-admin/db/sqlanywhere/patches/078-audit-partition-plan-global-state.sql | Updated as part of this pull request. |
| security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql | Updated as part of this pull request. |
| security-admin/db/postgres/patches/078-audit-partition-plan-global-state.sql | Updated as part of this pull request. |
| security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql | Updated as part of this pull request. |
| security-admin/db/oracle/patches/078-audit-partition-plan-global-state.sql | Updated as part of this pull request. |
| security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql | Updated as part of this pull request. |
| security-admin/db/mysql/patches/078-audit-partition-plan-global-state.sql | Updated as part of this pull request. |
| security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql | Updated as part of this pull request. |
Suppressed comments (2)
security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql:600
- The plan is not bounded to this seed: it grows with plugin/service entries and each service's
policy.download.auth.users. MySQLTEXTis limited to 65,535 bytes, so a sufficiently populated plan will fail to update even though the other backends use LOB/max types. Use at leastMEDIUMTEXTand keep the upgrade and fresh-install definitions consistent.
`app_data` TEXT NULL DEFAULT NULL,
security-admin/db/mysql/patches/078-audit-partition-plan-global-state.sql:44
- The plan is not bounded to this seed: it grows with plugin/service entries and each service's
policy.download.auth.users. MySQLTEXTis limited to 65,535 bytes, so a sufficiently populated plan will fail to update even though the other backends use LOB/max types. Use at leastMEDIUMTEXTand keep the upgrade and fresh-install definitions consistent.
ALTER TABLE x_ranger_global_state MODIFY app_data TEXT DEFAULT NULL;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Disable JDBC login for rangerauditserver (status=0, empty password) for SPIFFE-only Admin access; fix Oracle app_data ALTER guard; use SQL Anywhere ALTER COLUMN syntax.
… 078. Oracle stores empty string as NULL on NOT NULL PASSWORD; use a space placeholder for rangerauditserver. Remove stale x_policy_ref_user_FK_upd_by CHECK from SQL Server optimized schema (patch 077 regression).
Use LONGTEXT for app_data on MySQL so the partition plan can grow beyond TEXT limits. On Oracle upgrade, migrate VARCHAR2 app_data via add/copy/drop/ rename instead of MODIFY to avoid ORA-22858. Co-authored-by: Cursor <cursoragent@cursor.com>
mneethiraj
left a comment
There was a problem hiding this comment.
@ramackri - in addition to topic partition details, it might be necessary to store additional details, such as audit ingestor endpoint, allowed users per service. How about introducing a new table:
x_audit_config(cfg_name string cfg_value string, version long);
insert into x_audit_config(cfg_name, cfg_value) values ("ingestor.url, "https://ranger-audit-ingestor:8765");
insert into x_audit_config(cfg_name, cfg_value) values ("service.hive.allowed.users", "hive");
insert into x_audit_config(cfg_name, cfg_value) values ("topic-partitions", 30);
Per review feedback, store ingestor URL, per-service allowed users, and topic partition count in x_audit_config (patch 078 + optimized schema on all DB backends). Seed defaults idempotently on fresh install and upgrade. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep ingestor URL and per-service allow-list in x_audit_config; partition routing (topic, topicPartitionCount, plugins, buffer) stays in RangerAuditPartitionPlan JSON only. Drop topic-partitions from x_audit_config. Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit 3b33734.
Store ingestor URL, topic, partition plan JSON, and per-service allow-list in x_audit_config. Revert patch 078 changes to x_ranger_global_state (no app_data widen, no RangerAuditPartitionPlan row). Keep rangerauditserver machine user setup in patch 078. Co-authored-by: Cursor <cursoragent@cursor.com>
mneethiraj
left a comment
There was a problem hiding this comment.
- rename file
078-audit-partition-plan-global-state.sqlas078-add-x_audit_config.sql - is it necessary to add
rangeradminserveruser in user tables?
|
Now we moved to x_audit_config |
Summary
RANGER-5720 — DB patch 078 for RANGER-5655. Adds the
x_audit_configtable for audit runtime settings, seeds default config rows, and creates therangerauditservermachine user. DB-only (no Java); pairs with #1137.Per review feedback, audit configuration lives in
x_audit_config, notx_ranger_global_state. Patch 078 does not widenapp_dataand does not insert aRangerAuditPartitionPlanglobal-state row.Changes
Patch file (all 5 backends):
078-add-x_audit_config.sql(renamed from078-audit-partition-plan-global-state.sql)Schema
x_audit_config(cfg_name,cfg_value,version; unique oncfg_name)Seed rows in
x_audit_configcfg_namecfg_valueingestor.urlhttps://ranger-audit-ingestor:8765service.hive.allowed.usershiveaudit.partition.plan{"topic":"ranger_audits","plugins":{},"buffer":{"partitions":[1,2,3,4,5,6,7,8,9]}}User bootstrap
rangerauditserverportal user +x_userrowROLE_ADMIN_AUDITOR,status=0, empty/disabled JDBC password (Oracle uses' 'placeholder on NOT NULL column)Backend-specific notes
EXECUTE IMMEDIATEfor allx_audit_configDML so PL/SQL compile succeeds before the table exists (avoids ORA-00942 on 077→078 upgrade)CHECK CONSTRAINT x_policy_ref_user_FK_upd_byleft after patch 077 dropped audit columns on policy-ref tablesTesting
CI
build-17/ docker builds: pass on branchDocker DB E2E (local,
dev-support/ranger-docker)Scripts under
scripts/db-test/:verify-patch-078.shtest-patch-078-docker.shtest-patch-078-e2e-docker.shHow we ran upgrade tests
Upgrade path (077→078) simulates production upgrade:
masterDB scripts @ patch 077 (pre-078 baseline)db_setup.py→ DB at patch 077078-add-x_audit_config.sqlinto container; clear patch markersdb_setup.py→ applies patch 078 onlyverify-patch-078.shagainst live DBResults (all docker backends, Aug 2026)
What 10/10 means — each check in
verify-patch-078.sh:rangerauditserverstatus =0(JDBC disabled)rangerauditserverpassword empty (Oracle:' 'counts as empty)ROLE_ADMIN_AUDITORx_audit_config.ingestor.urlseeded correctlyx_audit_config.service.hive.allowed.users=hivex_audit_config.audit.partition.planJSON containsranger_auditsbuffersectionRangerAuditPartitionPlanrow inx_ranger_global_statex_db_version_hx_ranger_global_state.app_dataunchanged (varchar/varchar2/etc. — not widened)Tests validate database state after
db_setup.py; they do not start Admin UI, ingestor, or plugins.Harness note: SQL Server upgrade baseline uses
masteroptimized schema with a one-line fix for the orphaned FK CHECK (master bug from patch 077); branch optimized schema includes the same fix.Related