Skip to content

rgw/sts: added logic to disallow role - #70565

Merged
anrao19 merged 2 commits into
ceph:mainfrom
pritha-srivastava:wip-rgw-sts-role-chaining-fix
Aug 11, 2026
Merged

anrao19 merged 2 commits into
ceph:mainfrom
pritha-srivastava:wip-rgw-sts-role-chaining-fix

Conversation

@pritha-srivastava

@pritha-srivastava pritha-srivastava commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

chaining.

fixes: https://tracker-origin.ceph.com/issues/78697

The explanation for the fix is given in the tracker issue above.

Role chaining as a separate STS feature is not officially supported in RGW. It requires the trust policy to have the ARN of the role assuming the role using temporary credentials. There are other rules related to role chaining which are not supported in RGW:

Role chaining limits your AWS Management Console, AWS CLI or AWS API role session to a maximum of one hour. It applies regardless of the maximum session duration configured for individual roles. When you use the [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) API operation to assume a role, you can specify the duration of your role session with the DurationSeconds parameter. You can specify a parameter value of up to 43200 seconds (12 hours), depending on the [maximum session duration setting](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-settings.html#id_roles_update-session-duration) for your role. However, if you assume a role using role chaining and provide a DurationSeconds parameter value greater than one hour, the operation fails.

https://aws.amazon.com/blogs/security/how-to-use-trust-policies-with-iam-roles/
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@pritha-srivastava
pritha-srivastava requested a review from a team as a code owner July 27, 2026 09:38
@github-actions github-actions Bot added the rgw label Jul 27, 2026
@github-actions github-actions Bot added the tests label Jul 29, 2026
Comment thread src/rgw/rgw_rest_sts.cc Outdated
//to verify its permission.
//disallow temporary credentials from invoking assumerole* calls
if (s->auth.identity && s->auth.identity->get_identity_type() == TYPE_ROLE) {
ldout(s->cct, 0) << "Role chaining is not supported!" << dendl;

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.

i don't think we should spam the rgw logs with request auth errors. maybe it should be sent back to the client as an error response via s->err.message?

Comment on lines +445 to +448
try:
chained_sts_client.assume_role(
RoleArn=role_response['Role']['Arn'],
RoleSessionName=get_parameter_name(),

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.

nit: maybe use assert_raises() for this pattern? ex

    e = assert_raises(ClientError, chained_sts_client.assume_role,
            RoleArn=role_response['Role']['Arn'],
            RoleSessionName=get_parameter_name())
    assert (403, 'AccessDenied') == _get_status_and_error_code(e.response)

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.

@cbodley : please re-review

@pritha-srivastava
pritha-srivastava force-pushed the wip-rgw-sts-role-chaining-fix branch from 1c96917 to 47eaf56 Compare August 3, 2026 05:50
@pritha-srivastava

Copy link
Copy Markdown
Contributor Author

@pritha-srivastava
pritha-srivastava force-pushed the wip-rgw-sts-role-chaining-fix branch from 47eaf56 to 1f34a6f Compare August 3, 2026 10:58
@pritha-srivastava
pritha-srivastava force-pushed the wip-rgw-sts-role-chaining-fix branch from 1f34a6f to 0b960f7 Compare August 4, 2026 11:06
@pritha-srivastava

pritha-srivastava commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

successful run here: https://pulpito.ceph.com/prsrivas-2026-08-05_05:01:20-rgw:sts-wip-rgw-sts-role-chaining-fix-distro-default-trial/

INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_chaining_disallowed PASSED [ 97%]
2026-08-05T09:11:13.873 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity PASSED [ 97%]

@cbodley this is ready to be merged

@cbodley

cbodley commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

thanks @pritha-srivastava - this should probably go through the full rgw suite?

@pritha-srivastava

Copy link
Copy Markdown
Contributor Author

thanks @pritha-srivastava - this should probably go through the full rgw suite?

is that needed? this is touching only sts code. does not even touch the auth code/ iam code

@anrao19 anrao19 added the wip-anrao6-testing wip-anrao6-testing label Aug 7, 2026
@pritha-srivastava

Copy link
Copy Markdown
Contributor Author

https://pulpito.ceph.com/prsrivas-2026-08-07_08:39:08-rgw-wip-rgw-sts-role-chaining-fix-distro-default-trial/
there are 2 failures:

2026-08-09T10:42:25.329 DEBUG:teuthology.orchestra.run.trial078:> sudo cp /usr/bin/radosgw-admin.debug /tmp/tmp.Ni5MLiFT6p
2026-08-09T10:42:25.394 INFO:teuthology.orchestra.run.trial078.stderr:cp: cannot stat '/usr/bin/radosgw-admin.debug': No such file or directory
2026-08-09T10:42:25.395 DEBUG:teuthology.orchestra.run:got remote process result: 1
2026-08-09T10:42:25.395 ERROR:teuthology.run_tasks:Manager failed: internal.archive
Traceback (most recent call last):
  File "/home/teuthworker/src/git.ceph.com_teuthology_1fcba62fdc66bf66c0e46aa34af7211788698d08/teuthology/run_tasks.py", line 160, in run_tasks
    suppress = manager.__exit__(*exc_info)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/home/teuthworker/src/git.ceph.com_teuthology_1fcba62fdc66bf66c0e46aa34af7211788698d08/teuthology/task/internal/__init__.py", line 421, in archive
    fetch_binaries_for_coredumps(path, rem)
  File "/home/teuthworker/src/git.ceph.com_teuthology_1fcba62fdc66bf66c0e46aa34af7211788698d08/teuthology/task/internal/__init__.py", line 364, in fetch_binaries_for_coredumps
    remote.get_file(debug_path, coredump_path)
  File "/home/teuthworker/src/git.ceph.com_teuthology_1fcba62fdc66bf66c0e46aa34af7211788698d08/teuthology/orchestra/remote.py", line 695, in get_file
    self.run(args=args)
  File "/home/teuthworker/src/git.ceph.com_teuthology_1fcba62fdc66bf66c0e46aa34af7211788698d08/teuthology/orchestra/remote.py", line 596, in run
    r = self._runner(client=self.ssh, name=self.shortname, **kwargs)

The other failure is:
rgw multisite test failures

The PR can be merged

@anrao19

anrao19 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

pr testing completed and approved by @ivancich , more details : https://tracker.ceph.com/issues/79148
@pritha-srivastava if no further testing is needed then this pr can be merged

@anrao19
anrao19 merged commit 95da1e7 into ceph:main Aug 11, 2026
6 checks passed
@anrao19 anrao19 added TESTED ready-to-merge and removed wip-anrao6-testing wip-anrao6-testing labels Aug 11, 2026
@github-actions

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/31461083863

@cbodley

cbodley commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@pritha-srivastava it looks like we're starting to see sts failures on main after this merge, tracked in https://tracker.ceph.com/issues/79430. could you please take a look?

s3tests/functional/test_sts.py::test_assume_role_allow_head_nonexistent PASSED [ 97%]
s3tests/functional/test_sts.py::test_assume_role_chaining_disallowed PASSED [ 97%]
s3tests/functional/test_sts.py::test_assume_role_with_web_identity FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_on_different_buckets FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_on_same_bucket FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_put_obj_denial FAILED [ 97%]
s3tests/functional/test_sts.py::test_swapping_role_policy_and_session_policy FAILED [ 98%]
s3tests/functional/test_sts.py::test_session_policy_check_different_op_permissions FAILED [ 98%]

@pritha-srivastava

pritha-srivastava commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@pritha-srivastava it looks like we're starting to see sts failures on main after this merge, tracked in https://tracker.ceph.com/issues/79430. could you please take a look?

s3tests/functional/test_sts.py::test_assume_role_allow_head_nonexistent PASSED [ 97%]
s3tests/functional/test_sts.py::test_assume_role_chaining_disallowed PASSED [ 97%]
s3tests/functional/test_sts.py::test_assume_role_with_web_identity FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_on_different_buckets FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_on_same_bucket FAILED [ 97%]
s3tests/functional/test_sts.py::test_session_policy_check_put_obj_denial FAILED [ 97%]
s3tests/functional/test_sts.py::test_swapping_role_policy_and_session_policy FAILED [ 98%]
s3tests/functional/test_sts.py::test_session_policy_check_different_op_permissions FAILED [ 98%]

@cbodley: I am not sure how this is possible, as I had completed a successful run of all sts tests here:
https://pulpito.ceph.com/prsrivas-2026-08-05_05:01:20-rgw:sts-wip-rgw-sts-role-chaining-fix-distro-default-trial/

2026-08-05T09:11:12.593 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_creds_expiry PASSED     [ 97%]
2026-08-05T09:11:12.926 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_deny_head_nonexistent PASSED [ 97%]
2026-08-05T09:11:13.260 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_allow_head_nonexistent PASSED [ 97%]
2026-08-05T09:11:13.522 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_chaining_disallowed PASSED [ 97%]
2026-08-05T09:11:13.873 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity PASSED [ 97%]
2026-08-05T09:11:14.281 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_on_different_buckets PASSED [ 97%]
2026-08-05T09:11:14.652 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_on_same_bucket PASSED [ 97%]
2026-08-05T09:11:15.019 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_put_obj_denial PASSED [ 97%]
2026-08-05T09:11:15.384 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_swapping_role_policy_and_session_policy PASSED [ 98%]
2026-08-05T09:11:15.786 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_different_op_permissions PASSED [ 98%]
2026-08-05T09:11:16.150 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_with_deny_effect PASSED [ 98%]
2026-08-05T09:11:16.516 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_check_with_deny_on_same_op PASSED [ 98%]
2026-08-05T09:11:16.940 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_bucket_policy_role_arn PASSED [ 98%]
2026-08-05T09:11:17.312 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_bucket_policy_session_arn PASSED [ 98%]
2026-08-05T09:11:17.691 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_copy_object PASSED   [ 98%]
2026-08-05T09:11:17.966 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_no_bucket_role_policy PASSED [ 98%]
2026-08-05T09:11:18.331 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_session_policy_bucket_policy_deny PASSED [ 98%]
2026-08-05T09:11:18.711 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_with_sub PASSED [ 98%]
2026-08-05T09:11:19.092 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_with_azp PASSED [ 98%]
2026-08-05T09:11:19.509 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_with_request_tag PASSED [ 98%]
2026-08-05T09:11:19.890 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_with_principal_tag PASSED [ 99%]
2026-08-05T09:11:20.273 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_for_all_values PASSED [ 99%]
2026-08-05T09:11:20.642 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_for_all_values_deny PASSED [ 99%]
2026-08-05T09:11:21.026 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_tag_keys_trust_policy PASSED [ 99%]
2026-08-05T09:11:21.453 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_tag_keys_role_policy PASSED [ 99%]
2026-08-05T09:11:21.830 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_resource_tag PASSED [ 99%]
2026-08-05T09:11:22.200 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_resource_tag_deny PASSED [ 99%]
2026-08-05T09:11:22.619 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_wrong_resource_tag_deny PASSED [ 99%]
2026-08-05T09:11:22.994 INFO:teuthology.orchestra.run.trial138.stdout:s3tests/functional/test_sts.py::test_assume_role_with_web_identity_resource_tag_princ_tag PASSED [ 99%]

@cbodley

cbodley commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

from the rgw log, i see the AssumeRoleWithWebIdentity requests start failing with "token expired"

2026-08-11T18:10:49.102+0000 7fd6effd96c0 10 req 3549180224494298857 0.002999969s sts:assume_role_web_identity Signature validation using x5c failedtoken verification failed: token expired
2026-08-11T18:10:49.102+0000 7fd6effd96c0 0 req 3549180224494298857 0.002999969s sts:assume_role_web_identity Signature can not be validated with the JWKS present.
2026-08-11T18:10:49.102+0000 7fd6effd96c0 5 req 3549180224494298857 0.002999969s sts:assume_role_web_identity Invalid JWT token
2026-08-11T18:10:49.102+0000 7fd6effd96c0 20 req 3549180224494298857 0.002999969s sts:assume_role_web_identity rgw::auth::sts::WebTokenEngine denied with reason=-13
2026-08-11T18:10:49.102+0000 7fd6effd96c0 5 req 3549180224494298857 0.002999969s sts:assume_role_web_identity Failed the auth strategy, reason=-13
2026-08-11T18:10:49.102+0000 7fd6effd96c0 10 failed to authorize request

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.

3 participants