Skip to content

rgw: Add Keystone scope information to ops logging - #66111

Merged
irq0 merged 1 commit into
ceph:mainfrom
fa-at-pulsit:wip-73702-rgw-keystone-scope
Mar 2, 2026
Merged

irq0 merged 1 commit into
ceph:mainfrom
fa-at-pulsit:wip-73702-rgw-keystone-scope

Conversation

@fa-at-pulsit

Copy link
Copy Markdown
Contributor

Summary

This PR adds detailed OpenStack Keystone authentication scope information to RGW operations logs.
It enables more comprehensive audit trails for multi-tenant and compliance-sensitive environments.

  • Adds keystone_scope field (project, user, domain, roles, application credentials)
  • Extends TokenEnvelope to parse application credential info
  • Updates log entry version (v16) with backward compatibility
  • Adds configuration flags for enabling and filtering scope details

Tracker: https://tracker.ceph.com/issues/73702

@github-actions

github-actions Bot commented Nov 3, 2025

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_keystone_scope_include_user (rgw.yaml.in)
+ added: rgw_keystone_scope_enabled (rgw.yaml.in)
+ added: rgw_keystone_scope_include_roles (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

/config check ok

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the auth and ops logging changes look very reasonable to me. only minor comments about encoding

Comment on lines +70 to +72
encode(id, bl);
encode(name, bl);
domain.encode(bl);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please prefer the free functions encode(domain, bl) and decode(domain, p) for consistency with builtin/std types

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed. I've switched to using free functions for consistency:

  • Added namespace-level free function overloads for all types
  • Top-level calls now use encode(project, bl) style
  • Inside nested structs, kept domain.encode(bl) to avoid forward-declaration issues
  • Added using ceph::encode/decode for template visibility

Comment thread src/rgw/rgw_keystone_scope.h Outdated
Comment on lines +145 to +157
__u8 has_user = user.has_value();
encode(has_user, bl);
if (has_user) {
user->encode(bl);
}

encode(roles, bl);

__u8 has_app_cred = app_cred.has_value();
encode(has_app_cred, bl);
if (has_app_cred) {
app_cred->encode(bl);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that include/encoding.h already supports encode/decode for std::optional, so you should be able to encode(user, bl) and encode(app_cred, bl) directly

same for rgw_log_entry::keystone_scope

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now using encode(user, bl) and encode(app_cred, bl) directly, leveraging the std::optional support from include/encoding.h. Removed all manual __u8 has_* flags.

Comment on lines +957 to +964
- name: rgw_keystone_scope_enabled
type: bool
level: advanced
desc: Enable logging of Keystone scope information in ops log
long_desc: When enabled, operations authenticated via Keystone will include project,
user, domain, and role information in the ops log. Requires rgw_enable_ops_log
to be enabled.
default: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this off by default for the same privacy reasons as rgw_keystone_scope_include_user?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated config expanation. Clarified in the long_desc that it's disabled by default to avoid adding overhead to every log entry, not for privacy (user identity has separate privacy control via rgw_keystone_scope_include_user).

@cbodley

cbodley commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

@tobias-urdin @mdw-at-linuxbox can i please ask for your review on the keystone-facing bits?

@tobias-urdin

Copy link
Copy Markdown
Contributor

The Keystone parts LGTM, but you mention GDPR shouldn't that also apply for project name and domain name if we are to only log user/operator names if config options is true? In other words, should we hide project name and domain name when dumping the scope unless at config is true for that?

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

@tobias-urdin You’re right that project and domain names can identify users in some deployments, so it makes sense to treat them the same as other “human-readable identity” fields.

I will adjust the logging so that:

  • When rgw_keystone_scope_enabled is true, RGW always logs opaque IDs only (e.g., project_id, project_domain_id, and user_id when present).
  • Human-readable names (project_name, project_domain_name, user_name, user/domain names) are included only when rgw_keystone_scope_include_user is true.
  • Roles continue to follow rgw_keystone_scope_include_roles.

This ensures that:

  • Auditing still works using IDs alone, which is GDPR-friendly.
  • rgw_keystone_scope_include_user becomes the single switch for all identity-like names.
  • Operators can cross-reference IDs with Keystone without exposing names in logs.

I’ll update the implementation and configuration documentation accordingly. Agree?

@tobias-urdin

Copy link
Copy Markdown
Contributor

@tobias-urdin You’re right that project and domain names can identify users in some deployments, so it makes sense to treat them the same as other “human-readable identity” fields.

I will adjust the logging so that:

  • When rgw_keystone_scope_enabled is true, RGW always logs opaque IDs only (e.g., project_id, project_domain_id, and user_id when present).
  • Human-readable names (project_name, project_domain_name, user_name, user/domain names) are included only when rgw_keystone_scope_include_user is true.
  • Roles continue to follow rgw_keystone_scope_include_roles.

This ensures that:

  • Auditing still works using IDs alone, which is GDPR-friendly.
  • rgw_keystone_scope_include_user becomes the single switch for all identity-like names.
  • Operators can cross-reference IDs with Keystone without exposing names in logs.

I’ll update the implementation and configuration documentation accordingly. Agree?

Sounds good to me! :)

@fa-at-pulsit
fa-at-pulsit force-pushed the wip-73702-rgw-keystone-scope branch from c8d5c46 to 3143da3 Compare November 20, 2025 07:37
@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

@tobias-urdin - it's done, as described

@irq0

irq0 commented Dec 1, 2025

Copy link
Copy Markdown
Member

jenkins test make check

@irq0

irq0 commented Dec 1, 2025

Copy link
Copy Markdown
Member

jenkins test make check arm64

@irq0

irq0 commented Dec 1, 2025

Copy link
Copy Markdown
Member

jenkins test api

@irq0

irq0 commented Dec 1, 2025

Copy link
Copy Markdown
Member

jenkins test docs

@fa-at-pulsit
fa-at-pulsit force-pushed the wip-73702-rgw-keystone-scope branch from 3143da3 to c83c836 Compare December 2, 2025 12:05
@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@kshtsk

kshtsk commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

jenkins test docs

@anrao19

anrao19 commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

irq0 added a commit to irq0/ceph that referenced this pull request Feb 20, 2026
…uid' into release/cobaltcore-storage-v19.2.3+fasttrack-1

PR ceph#66111

* backports/19.2.3/filipp-wip-73702-rgw-keystone-scope-squid:
  rgw: Add Keystone scope information to ops logging
@anrao19

anrao19 commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Execution complete, tracker approved by @ivancich. tracker detail: https://tracker.ceph.com/issues/74079
@fa-at-pulsit , If no further testing needed, pr can be merged

@anrao19

anrao19 commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

jenkins test docs

irq0 added a commit to irq0/ceph that referenced this pull request Feb 25, 2026
…uid' into release/cobaltcore-storage-v19.2.3-fasttrack-2

PR ceph#66111

* backports/19.2.3/filipp-wip-73702-rgw-keystone-scope-squid:
  rgw: Add Keystone scope information to ops logging
@irq0

irq0 commented Feb 25, 2026

Copy link
Copy Markdown
Member

jenkins test docs

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@s0nea

s0nea commented Feb 26, 2026

Copy link
Copy Markdown
Member

jenkins rebuild docs

@fa-at-pulsit
fa-at-pulsit force-pushed the wip-73702-rgw-keystone-scope branch from c83c836 to 3180812 Compare February 26, 2026 12:06
@fa-at-pulsit

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@s0nea

s0nea commented Feb 27, 2026

Copy link
Copy Markdown
Member

jenkins test windows

@irq0
irq0 merged commit 5d6d51e into ceph:main Mar 2, 2026
6 checks passed
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/22582234052

@irq0

irq0 commented Mar 2, 2026

Copy link
Copy Markdown
Member

Would backports to tentacle, squid be accepted?

irq0 added a commit to irq0/ceph that referenced this pull request Mar 6, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-4

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  rgw: fix role name copy only up to admin
  rgw: Feature flag keystone role injection
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Mar 6, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-5

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  rgw: fix role name copy only up to admin
  rgw: Feature flag keystone role injection
  backport: Account for pre NotEquals OR->AND PR ceph#65606
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Mar 10, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-6

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  backport: Account for pre NotEquals OR->AND PR ceph#65606
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Fix missing keystone scope initialization
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Mar 10, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-7

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  backport: Account for pre NotEquals OR->AND PR ceph#65606
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Fix missing keystone scope initialization
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Mar 10, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-8

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  backport: Account for pre NotEquals OR->AND PR ceph#65606
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Fix missing keystone scope initialization
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Mar 11, 2026
…nto release/cobaltcore-storage-v19.2.3-fasttrack-9

PR ceph#66111 + WIP S3 Bucket Policy Keystone Role Support

* backports/19.2.3/rgw-keystone-scope-s3-bucket-policy:
  backport: Account for pre NotEquals OR->AND PR ceph#65606
  rgw: Inject keystone roles into IAM policy
  backport: iam policy condition test infrastructure
  rgw: Fix missing keystone scope initialization
  rgw: Add Keystone scope information to ops logging
irq0 added a commit to irq0/ceph that referenced this pull request Jun 4, 2026
Retroactive <uuid>.md for the Keystone scope logging + IAM role
injection backport already landed on this branch as merge commit
c582732.

Backport-Id: 019e92ed-d2cc-7bce-a481-77ca769cfda9
Backport-Merge: c582732
Upstream-PRs: ceph#66111, ceph#67752
irq0 added a commit to cobaltcore-dev/ceph that referenced this pull request Jun 10, 2026
Backport-Id: 019eb0c0-4142-7fc8-9332-370dc54e89c9
Backport-PR: #5
Upstream-PRs: ceph#66111
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 6, 2026
Backport-Id: 01a06155-747f-7eb1-a335-4f887b8cef7e
Backport-PR: #11
Upstream-PRs: ceph#66111, ceph#68627
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 7, 2026
Backport-Id: 01a11121-2d48-7bc9-b20f-193fd7344cfd
Backport-PR: #23
Upstream-PRs: ceph#66111, ceph#71580
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 14, 2026
Backport-Id: 01a06155-747f-7eb1-a335-4f887b8cef7e
Backport-PR: #11
Upstream-PRs: ceph#66111, ceph#68627
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 16, 2026
…#36)

Backport-Id: 01a14457-8152-7959-bc90-fa067d6a5230
Backport-PR: #36
Upstream-PRs: ceph#66111, ceph#68627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants