Repository navigation
rgw/oidc: Add support for global OIDC providers. - #68850
Conversation
| } else if (!tenant.empty()) { | ||
| oidc_tenant = tenant; | ||
| } else { | ||
| oidc_tenant = std::string(global_oidc_tenant); |
There was a problem hiding this comment.
what if the admin wants the oidc provider to be created in the empty tenant namespace?
There was a problem hiding this comment.
good point, but we can probably ignore tenant-based roles/oidcs for this feature. it's too late to merge for the umbrella release, and "tenant-based roles and policy" were deprecated in tentacle and can be removed for the v release
so these commands could just treat the lack of --account-id as "global"
There was a problem hiding this comment.
this means we won't be supporting these for existing users that use tenants? we could have done that by adding a --global flag which could have mapped to the global_oidc_tenant. and let the empty tenant map to empty tenant namespace.
There was a problem hiding this comment.
we can also make these ops available only for global oidc providers (both for tenants and accounts) and let the end users use REST APIs for local oidc proviers
There was a problem hiding this comment.
we can also make these ops available only for global oidc providers (both for tenants and accounts) and let the end users use REST APIs for local oidc proviers
once we decide what we want to do, this is trivial change
originally in the design i did not propose adding --global flag and hence the coding was done based on that.
based on consensus I can do what is required.
There was a problem hiding this comment.
we decided we don't need to support tenants for this, as for the restricting it to just global oidc providers for accounts, whats your take on this @cbodley
There was a problem hiding this comment.
There was a problem hiding this comment.
right, we had a discussion internally about it and concluded we wont support it for tenants. but at the same time, my suggestion is to restrict the commands only for global oidc providers. And I was asking @cbodley about his thoughts on the latter
| return EINVAL; | ||
| } | ||
|
|
||
| std::string oidc_tenant; |
There was a problem hiding this comment.
oidc_tenant resolution can be moved to a method and called from all CRUD ops
There was a problem hiding this comment.
oidc_tenant resolution can be moved to a method and called from all CRUD ops
done
|
|
Here if the tenant/account of the authenticating identity is different from that of the oidc provider in the trust policy of the role - then this might fail |
|
i found a recent aws blog post https://aws.amazon.com/about-aws/whats-new/2026/01/aws-sts-supports-validation-identity-provider-claims/ which references https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-wif - these provider-specific condition keys can be used in role trust policy to limit which jwt claims to accept do we support anything like this currently? should we try to do something similar for these global providers? |
The trust policy's Principal.Federated ARN is parsed at line (rgw_iam_policy.cc:566) which extracts only the IDP URL (discards the account from the ARN)
The account ID in the ARN is not matched against the OIDC provider's storage tenant. It's just part of the ARN structure. What actually happens: Step 1: Parse trust policy ARN (rgw_iam_policy.cc:566) Step 2: Match caller identity (rgw_auth.cc:804) |
The trust policy doesn't need to know whether the OIDC provider is global or account-level — the lookup is transparent. During AssumeRoleWithWebIdentity, A role supports both — if an account-level provider exists for the same URL, it takes precedence. If not, the global provider is used. No configuration so what do you want to add for documentation ? anything w.r.t trust policy will make things confusing, we can add support for global oidc provider and add that it works same way as account level with no change in trust policy and permission policy. For Tests: |
Are you saying that the trust policy for a role will not have the requirement for the global oidc provider specified.
Ofcourse we need to tell the users that support for global oidc providers has been added. There is a section here:
Not just for the crud ops, but for the entire workflow when no local oidc provider is present. we have tests for assumerolewithwebidentity in https://github.com/ceph/s3-tests/blob/master/s3tests/functional/test_sts.py. |
|
https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateOpenIDConnectProvider.html if we are trying to provide support for oidc providers along the lines of https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateOpenIDConnectProvider.html |
Yes all claims in the JWT token can be used in the condition element of the role's trust policy currently. Reference to our documentation here: https://docs.ceph.com/en/latest/radosgw/STS/ |
This will allow cross account roles to be assumed via AssumeRoleWithWebIdentity and this is not allowed by AWS, hence I am not sure if this is correct.
again if i understand this correctly, is this use case you talking about Then whole purpose of this PR is to support GLOBAL OIDC, where without setting up the CreateOIDCProvider, user can setup TrustPolicy and assume role |
ceph will try to load the OIDC first from account namespace RGW12345 and then fall back to global if it exist |
done adding test ceph/s3-tests#750 |
Yes, got it, for cross account, the method will fail at the step where it fails to load the provider using the role's tenant/account |
Re-using a trust policy for a local oidc provider for using a global oidc provider - AWS states: The question is why not allow the end user to directly configure a global oidc arn in the trust policy and why enforce the falback? |
|
Another question is what ARN do create and get ops return? From the code it looks like "arn:aws:iam::.global:oidc-provider/example.com", unless there is code to strip off ".global" from the ARN returned. |
i cannot think of, not for the same URL at least.
As mentioned above,
Given this, the user already has full liberty over their trust policy — they can set whatever Conditions they want (aud, sub, etc.) regardless of whether the underlying OIDC provider is local or this was the pure reason for FALLBACK |
it returns .global |
IMO we should do what AWS does - allow the end user to set the global oidc url/arn in the role's trust policy. The code already supports this (atleast setting the global oidc ARN). And for the same reason, having .global in the ARN returned is confusing. |
|
Meanwhile /src/test/cli/radosgw-admin/help.t needs to be updated with the options added for oidc provider in radosgw-admin.cc |
Suite: rgw (centos 9.stream). STS results are green:
Remaining job failures are unrelated to this change (verified: no coredumps except what next is needed? |
There was a problem hiding this comment.
Pull request overview
Adds global OIDC providers as an account fallback for RGW web-identity authentication.
Changes:
- Adds global-provider storage, lookup, and trust-policy matching.
- Adds
radosgw-admin oidc-providermanagement commands. - Adds documentation and integration coverage.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/rgw/rgw_rest_sts.h |
Extends web-token interfaces with global scope. |
src/rgw/rgw_rest_sts.cc |
Adds global provider fallback. |
src/rgw/rgw_auth.h |
Tracks global OIDC identities. |
src/rgw/rgw_auth.cc |
Implements scope-aware principal matching. |
src/rgw/rgw_basic_types.h |
Adds account scope to OIDC principals. |
src/rgw/rgw_iam_policy.cc |
Parses global and scoped OIDC principals. |
src/rgw/rgw_oidc_provider.h |
Defines global provider utilities. |
src/rgw/rgw_oidc_provider.cc |
Formats provider metadata. |
src/rgw/rgw_rest_oidc_provider.cc |
Reuses shared date formatting. |
src/rgw/radosgw-admin/radosgw-admin.cc |
Adds OIDC provider CLI operations. |
src/test/cli/radosgw-admin/help.t |
Updates CLI help expectations. |
src/test/rgw/s3-tests/s3tests/functional/test_sts.py |
Adds global OIDC integration tests. |
qa/tasks/s3tests.py |
Provisions the global test provider. |
qa/tasks/keycloak.py |
Extends test token lifetime. |
doc/radosgw/oidc.rst |
Documents global provider behavior. |
doc/man/8/radosgw-admin.rst |
Documents new CLI commands. |
| for client in config.keys(): | ||
| cluster_name, daemon_type, client_id = teuthology.split_role(client) | ||
| client_with_id = daemon_type + '.' + client_id | ||
| realm_name = os.environ.get('KC_REALM', '') | ||
| thumbprint = os.environ.get('THUMBPRINT', '') | ||
| aud = os.environ.get('AUD', '') | ||
| if realm_name and thumbprint: | ||
| ctx.cluster.only(client).run( | ||
| args=[ | ||
| 'adjust-ulimits', | ||
| 'ceph-coverage', | ||
| '{tdir}/archive/coverage'.format(tdir=testdir), | ||
| 'radosgw-admin', | ||
| '-n', client_with_id, | ||
| '--cluster', cluster_name, | ||
| 'oidc-provider', 'create', | ||
| '--provider-url', | ||
| 'http://localhost:8080/auth/realms/{}'.format(realm_name), | ||
| '--thumbprints', thumbprint, | ||
| '--client-ids', aud, | ||
| ], | ||
| ) | ||
| global_oidc_created = True | ||
| break # only need to create once on one client |
There was a problem hiding this comment.
the remaining test cluster that are created are part of multisite, and oidc is synced as metadata, so other clusters should get the oidc synced and not required to create for each of them
Add a reserved ".global" tenant for OIDC providers that are not tied to any specific account or tenant. The '.' prefix is chosen because it is invalid in tenant names (only [a-zA-Z0-9_] allowed) and does not conflict with metadata separators. Also move format_creation_date() from rgw_rest_oidc_provider.cc to rgw_oidc_provider.cc so it can be reused by radosgw-admin. Signed-off-by: Krunal Chheda <[email protected]>
When WebTokenEngine::load_provider() fails to find an OIDC provider for the request's tenant, retry the lookup using the global_oidc_tenant. This allows cluster-wide OIDC providers to validate tokens for any tenant without requiring per-tenant configuration. Signed-off-by: Krunal Chheda <[email protected]>
Fix Principal parsing and is_identity() to enforce that the trust policy principal scope matches the loaded OIDC provider scope: - Account-scoped provider: trust policy must use the full ARN form (arn:aws:iam::<account>:oidc-provider/<url>) with matching account. - Global provider: trust policy must use the bare URL form (<url>). Changes: - Principal::oidc_provider now stores the account from the ARN - ParseState::parse_principal preserves account for OIDC providers - Bare URL (with dot or slash, no arn: prefix) parsed as global OIDC - load_provider() outputs is_global_oidc flag on global fallback - WebIdentityApplier::is_identity() checks account match for account-scoped and empty account for global providers Signed-off-by: Krunal Chheda <[email protected]>
Add radosgw-admin subcommands for managing OIDC providers: oidc-provider create|modify|get|delete|list New CLI options: --provider-url, --client-ids, --thumbprints. When neither --tenant nor --account-id is given the commands default to the global OIDC tenant. Signed-off-by: Krunal Chheda <[email protected]>
984473c to
29483dd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/rgw/radosgw-admin/radosgw-admin.cc:7654
- Apply the same OIDC field validation when replacing these lists. As written,
modifycan write oversized client IDs/thumbprints even though the IAM API rejects them (rgw_rest_oidc_provider.cc:69-117), so a previously valid provider can be moved into an invalid state through this command.
if (!client_ids_str.empty()) {
info.client_ids.clear();
get_str_vec(client_ids_str, ",", info.client_ids);
}
if (!thumbprints_str.empty()) {
src/rgw/radosgw-admin/radosgw-admin.cc:7594
- Validate the provider URL, client IDs, and thumbprints before persisting them. The IAM create path enforces a 255-byte URL, at most 100 client IDs of 255 bytes, and at most five 40-byte thumbprints (
rgw_rest_oidc_provider.cc:69-117), but this admin path bypasses all of those limits and can create provider records that cannot be created through the public API. Please share the validation logic/constants with both entry points so global and account-scoped records have the same invariants.
This issue also appears on line 7650 of the same file.
info.provider_url = provider_url;
src/test/rgw/s3-tests/s3tests/functional/test_sts.py:2266
- This description names the wrong fixture: the code below uses
get_iam_client(), not the[s3 tenant]user. The latter also has tenanttestx, so the current wording contradicts the empty-tenant behavior this test actually exercises.
Uses the [s3 tenant] user (testid), whose tenant is empty and who has no
account. The OIDC provider and role are created under that same empty
…allback and trust policy scope Create a global OIDC provider via 'radosgw-admin oidc-provider create' during test setup when Keycloak is configured. This enables s3-tests to exercise the global OIDC fallback path in AssumeRoleWithWebIdentity. Signed-off-by: Krunal Chheda <[email protected]>
Add documentation for: - Global vs account-level OIDC provider concepts and fallback behavior - radosgw-admin oidc-provider create/modify/get/delete/list commands - Trust policy format for roles using OIDC providers - Note clarifying that global providers do not bypass trust policy evaluation Signed-off-by: Krunal Chheda <[email protected]>
29483dd to
58fbd6d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/test/rgw/s3-tests/s3tests/functional/test_sts.py:2113
- Phase 2 can still pass if client-ID validation is accidentally skipped: this trust policy only contains the global bare-URL principal, so an account-scoped identity is denied later by principal matching anyway. Include the account-scoped provider ARN as an alternative principal so the wrong client ID is what actually causes Phase 2 to fail, while the bare URL continues to cover Phases 1 and 3.
policy_document = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Federated\":[\""+idp_url+"\"]},\"Action\":[\"sts:AssumeRoleWithWebIdentity\"],\"Condition\":{\"StringEquals\":{\""+idp_url+":sub\":\""+sub+"\"}}}]}"
src/rgw/rgw_rest_sts.cc:120
- The new account-only fallback boundary is not exercised by the added tests. The uid-based test creates a local provider, so it never verifies that a role in a nonempty legacy tenant cannot consume a global provider. Add an integration case for that denial; this is an important isolation property documented by this PR.
if (r == -ENOENT && tenant != global_oidc_id &&
rgw::account::validate_id(tenant)) {
|
jenkins test make check arm64 |
|
pr testing completed and approved by @ivancich , more details in : https://tracker.ceph.com/issues/79449 |
cbodley
left a comment
There was a problem hiding this comment.
looks complete to me 👍
@pritha-srivastava could you please do a final round of review?
| resp=sts_client.assume_role_with_web_identity(RoleArn=role_response['Role']['Arn'],RoleSessionName=role_session_name,WebIdentityToken=token) | ||
| assert False, "Expected failure due to wrong client_id in account-level provider" | ||
| except ClientError as e: | ||
| assert e.response['Error']['Code'] in ('AccessDenied', 'InvalidIdentityToken') |
There was a problem hiding this comment.
which of these is the correct error? do we really need to accept both?
p.s. elsewhere we use this pattern for expected failures:
e = assert_raises(ClientError, sts_client.assume_role_with_web_identity, RoleArn=role_response['Role']['Arn'], RoleSessionName=role_session_name, WebIdentityToken=token)
status, code = _get_status_and_error_code(e.response)
assert status == 403
assert code in ('AccessDenied', 'InvalidIdentityToken')|
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 |
Fixes: https://tracker.ceph.com/issues/76069
based on design doc--> https://docs.google.com/document/d/1SWfTGOP4xVV5GsSx0DhqerblozVSAzE4kEz5VHBk8Co/edit?pli=1&tab=t.0
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.