RANGER-5720: DB patch 078 for audit partition plan global state - #1138
RANGER-5720: DB patch 078 for audit partition plan global state#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?
|
Summary
RANGER-5720 — DB patch 078 for RANGER-5655: seed audit partition-plan global state,
x_audit_configruntime settings, and therangerauditservermachine user on all Ranger DB backends. DB-only; no Java changes. Pairs with #1137.Changes
app_datacolumn (per-backend type)RangerAuditPartitionPlanv1 JSON (emptypluginsbaseline)x_audit_configtable (cfg_name,cfg_value,version) with seed rows:ingestor.url→https://ranger-audit-ingestor:8765service.hive.allowed.users→hivetopic-partitions→30rangerauditserveruser +ROLE_ADMIN_AUDITOR(status=0, JDBC disabled; SPIFFE/header auth only)Backend notes: Oracle uses
' 'password placeholder (''→ NULL on NOT NULL column). SQL Server optimized schema drops a stale patch-077 FK CHECK. MySQL usesLONGTEXTforapp_data. Oracle upgrade migratesVARCHAR2→CLOBvia add/copy/drop/rename (avoids ORA-22858).Testing
build-17, docker builds)Docker E2E fresh install (
ranger-docker, DB queried directly afterdb_setup.py):app_datatypetextlongtextCLOBnvarcharWhat 7/7 (or 6/6) means: automated DB checks passed / total checks run per backend (not services or containers).
rangerauditserverstatus =0(JDBC disabled)rangerauditserverpassword empty (Oracle:' 'placeholder counts as empty)ROLE_ADMIN_AUDITORRangerAuditPartitionPlan)ranger_audits(Oracle skipped — CLOB via sqlplus unreliable in harness)x_db_version_h(active = Y)app_datacolumn type widened (per backend)Related