Storage Access Control with Ranger (Enterprise)
Table policies in Ranger protect data that is read through a SQL engine. Files in object storage are protected separately: an
identity that holds storage keys can read every object its keys allow, whatever the table policies say. Ilum policy-sync closes
that gap for Ceph RGW. Bucket and prefix permissions are written in Ranger, in a service of type ilum-objectstore, and
policy-sync compiles them on a schedule into the IAM policies of the RGW accounts that own the buckets.
How it works
- A Ranger service of type
ilum-objectstoreholds policies on two resources:bucketومسار(a prefix inside the bucket, recursive or not), with the access typeslist,قرأ,يكتبوحذف. - Each storage identity is an IAM user of an RGW account (one per workspace and per engine catalog). Ranger groups are bound to an IAM group or an IAM user of the account that owns the bucket.
- policy-sync runs as a Kubernetes CronJob. Each run downloads the policies from Ranger, compiles one IAM document per
bound principal and bucket, compares it with what the account holds and writes the difference as inline group or user
policies named
<managedPrefix><bucket>(by defaultilum-psync-<bucket>). - Every statement id names the Ranger policy and its version (
rangerP12V3Read), so each permission in RGW traces back to the policy that granted it.
A policy change reaches RGW within one schedule interval (5 minutes by default) plus the run time.
المتطلبات
- Ceph Squid (19.x) or later, for RGW accounts. Tentacle 20.2.4 or later is recommended for a new installation.
- Apache Ranger 2.9 with a user that may download the service's policies.
- Network access from the CronJob to Ranger and to the RGW endpoints.
Account model
Accounts separate permissions: an identity of one account has no access to the buckets of another unless granted there. A layout that keeps sensitive data apart:
| Account | Holds |
|---|---|
acct-platform | Platform and application buckets |
acct-domains | Domain buckets (finance, sales, ...) |
acct-hr | HR buckets and every identity allowed to read them |
acct-published | Masked derived tables |
Every identity that may read HR raw objects is a user of acct-hr, so no cross-account grant is needed. A Ranger group bound
only in another account gets nothing on an HR bucket, and the run reports it.
Setting up
1. Create the accounts
Accounts and their root users are created with radosgw-admin:
radosgw-admin account create --account-name=acct-domains [البريد الإلكتروني محمي]
radosgw-admin user create --uid=acct-domains-root --display-name="acct-domains root" \
--account-id=<account id> --account-root --gen-access-key --gen-secret
Store the root keys of each account in a Kubernetes Secret with the keys access-key و secret-key. Only policy-sync reads
these Secrets.
2. Provision identities and buckets
policy-sync provision creates the IAM users and groups, the group memberships and the buckets of a model, and sets a bucket
guard that denies every request without TLS. It is idempotent and reports each step as created, changed or existing. Members
a group has beyond the model are reported, never removed. Access keys are not created by this step.
accounts:
acct-domains:
المستعملون: [ws-finance, svc-ترينو]
المجموعات:
ws-finance: [ws-finance]
buckets:
finance: {requireTls: صحيح}
acct-hr:
المستعملون: [ws-hr, svc-ترينو-hr]
المجموعات:
ws-hr: [ws-hr]
buckets:
hr-raw: {requireTls: صحيح}
policy-sync provision --config config.yaml --model model.yaml
Issue an access key for each identity with radosgw-admin key create or the IAM CreateAccessKey call, and store it where the
workspace or the engine catalog reads it.
RGW sets the aws:SecureTransport condition key only on connections it terminates with TLS itself; the guard therefore denies
every request that reaches RGW over plain HTTP. When a load balancer or ingress terminates TLS in front of RGW, set
rgw_trust_forwarded_https = true and make sure the proxy sends X-Forwarded-Proto: https, or the guard denies all requests
to the guarded buckets. Check one request through the real path before guarding a bucket in use.
3. Register the service in Ranger
policy-sync bootstrap registers the ilum-objectstore service definition and creates the service named in the
configuration, with the policy-download user. It needs a Ranger administrator and is idempotent:
policy-sync bootstrap --config config.yaml --admin-user admin --admin-password-file ./ranger-admin-password
4. Install the chart
ال ilum-policy-sync chart deploys the CronJob, its configuration and a NetworkPolicy that denies all ingress and allows
egress only to DNS and, on the configured ports, to pods of the cluster. An RGW outside the cluster is added with
networkPolicy.egressCidrs. The chart starts in mode: plan:
ranger:
عنوان URL: HTTP://ilum-ranger:6080
خدمة: objectstore
المصادقه: {اسم المستخدم: policy-sync, existingSecret: ranger-policy-sync}
targets:
- اسم: acct-domains
نقطه النهايه: https://rgw.example.internal
existingSecret: rgw-acct-domains
buckets: [finance]
principals:
GG-Finance-Eng: {group: ws-finance}
- اسم: acct-hr
نقطه النهايه: https://rgw.example.internal
existingSecret: rgw-acct-hr
buckets: [hr-raw]
principals:
GG-HR: {group: ws-hr}
svc-trino-hr: {مستخدم: svc-ترينو-hr}
networkPolicy:
egressCidrs: ["10.20.0.0/24"]
helm install ilum-policy-sync ilum/ilum-policy-sync -f policy-sync-values.yaml
kubectl logs -l app.kubernetes.io/instance=ilum-policy-sync --tail=1
Each run prints one JSON run record. Once the planned changes match the intent, set mode: apply.
Writing policies
A policy names buckets (wildcards * و ? expand to the matching buckets of the targets) and paths. Access types compile
to S3 actions as follows:
| Access | S3 actions | مورد |
|---|---|---|
list | s3:ListBucket with an s3:prefix condition, and s3:GetBucketLocation | The bucket |
قرأ | s3:GetObject | The objects under the path |
يكتب | s3:PutObject, s3:AbortMultipartUpload, s3:ListMultipartUploadPartsو s3:ListBucketMultipartUploads on the bucket | The objects under the path |
حذف | s3:DeleteObject | The objects under the path |
compile.versionedBuckets adds s3:GetObjectVersion و s3:DeleteObjectVersion. A recursive path /curated covers
curated/*; a non-recursive path names one object. Deny items compile to Deny statements, which win over every allow.
A list deny on a path also denies listing the bucket root and every prefix above the path. A listing with a shorter
prefix, or with none, returns the keys under the path as well, so a deny limited to the path itself could be bypassed.
s3:ListBucketMultipartUploads is granted on the whole bucket with يكتب, because RGW does not evaluate s3:prefix for
it; it lists the keys and ids of uploads in progress, not object data.
What is not supported
Only group items have a storage identity. User and role items are reported and have no effect. A policy that uses any of the following is not applied at all and is reported as an error:
- allow exceptions or deny exceptions;
- conditions on the policy or on an item, and validity schedules;
- excluded resources;
- masking and row-filter policies, and additional resource sets;
- unknown access types, malformed resources, and macros such as
{USER}in a path.
Policies of a tag service linked to the ilum-objectstore service are not applied either; the run reports them as an
error.
policy-sync validate --config config.yaml --policies <exported answer> reports these without contacting Ranger or RGW.
Safety
- policy-sync changes only policies whose name starts with
compile.managedPrefix. Other inline policies of bound principals are reported as unmanaged and left alone. - A run that cannot read Ranger or an account changes nothing.
- An empty answer from Ranger is refused unless
safety.allowEmptySourceis set: it usually means a broken source rather than an intent to revoke every grant. The same applies when no policy compiles to a document (for example, all are unsupported) and the run would delete every managed policy. - A run that would remove more statements than
safety.maxRemovedStatements(50) is refused. After reviewing the plan, add--forceلextraArgsfor one run. - A run that would replace or delete a managed policy it cannot read is refused until it is reviewed and run with
--force. - A document over
compile.maxDocumentBytes(256 KiB) is not written; the stored one stays and the run reports an error. - Unknown keys in the configuration are rejected, so a misspelt option never falls back to a default.
- Changes made by hand to a managed policy are drift: the next run reports and reverts them.
رصد
Each run prints a run record with the policy-set version read, the findings, the planned changes and what was applied.
The exit code is 0 when the run succeeded, 1 on a Ranger, RGW or apply failure, 2 on an invalid configuration, 3 when
drift found differences and 4 when a safety rule refused the run.
مع metrics.pushgatewayUrl set, every run pushes:
| Metric | Meaning |
|---|---|
policy_sync_last_run_timestamp_seconds | End of the last run, successful or not |
policy_sync_last_success_timestamp_seconds | End of the last run that read Ranger and every account; alert on its age |
policy_sync_last_run_failed | 1 when the last run failed or was refused |
policy_sync_errors | Errors of the last run |
policy_sync_unsupported_policies | Policies or documents not applied in the last run |
policy_sync_warnings | Warnings of the last run, such as a user item or a group without a principal |
policy_sync_drift_documents{change} | Documents the last run created, updated or deleted (or would have, in plan mode) |
policy_sync_unmanaged_policies | Policies of bound principals without the managed prefix |
policy_sync_source_version | Policy-set version the last run read |
Changes in RGW and how to undo them
policy-sync changes no RGW configuration. It writes and deletes inline IAM policies of the bound groups and users, and
provision creates users, groups, memberships, buckets and the TLS guard statement (ilumPolicySyncRequireTls) in bucket
policies.
- To stop all changes, set
suspend: trueأوmode: plan. - To remove every grant policy-sync wrote, delete the inline policies whose name starts with the managed prefix, or run
apply --allow-empty-source --forceagainst an empty service. - To remove the TLS guard, set
requireTls: falsefor the bucket and runprovisionagain; other statements of the bucket policy are kept.
استكشاف الاخطاء
group/<name> does not exist in target <account>: the principal bound intargets[].principalsis missing in the account. Create it withprovision.- Ranger answers 403: the download user is not in the service's
policy.download.auth.users. Runbootstrapمع--download-user. - AccessDenied with an empty message in
aws-cli: RGW sends an empty<Message>on denial, which someaws-cli2.x versions fail to parse. The denial itself is correct.