Skip to content

rgw: check all JWKS for STS - #63047

Merged
cbodley merged 2 commits into
ceph:mainfrom
awojno-bloomberg:sts-fix
Aug 6, 2025
Merged

cbodley merged 2 commits into
ceph:mainfrom
awojno-bloomberg:sts-fix

Conversation

@awojno-bloomberg

@awojno-bloomberg awojno-bloomberg commented Apr 29, 2025 •

Copy link
Copy Markdown
Contributor

Addresses a couple of issues including:

  • When checking if a JWT can be validated with a JWK, if the validation fails, an exception is thrown instead of trying other keys. This would mean that unless the correct key is first in the JWKS array, validation would fail. To address this, I removed the exceptions inside of the loop and only throw if no JWKs match the JWT
  • The certificate endpoint was being validated each time inside of the loop. I moved this to the beginning of validation as this only needs to be done once.

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

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

Comment thread src/rgw/rgw_rest_sts.cc Resolved
Comment thread src/rgw/rgw_rest_sts.cc Resolved
Comment thread src/rgw/rgw_rest_sts.cc Resolved
Comment thread src/rgw/rgw_rest_sts.cc Resolved
Comment thread src/rgw/rgw_rest_sts.cc Resolved
@pritha-srivastava

pritha-srivastava commented Apr 30, 2025 •

Copy link
Copy Markdown
Contributor

@cbodley @mattbenjamin @adamemerson : In continuation to my earlier comment and wrt discussions we've had about this - This PR introduces code change to make AWS compliant thumbprint verification code, common to all JWK (this was introduced only for n&e in d970f62, so that we could deprecate the current method for thumbprint verification for x5c in a phased manner and make that common for all JWK). This will affect the current end users using x5c. So this should be a separate commit ( a PR will be better) with doc changes. And we also need to think about how we can test this as the current keycloak setup in teuthology is an http connection and the TLS connection verification will fail in that case. Should we introduce unit tests etc. And this does not address tracker https://tracker.ceph.com/issues/54562, instead should be linked to https://tracker.ceph.com/issues/51346 or more specifically to https://tracker.ceph.com/issues/69106

@cbodley

cbodley commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

And we also need to think about how we can test this as the current keycloak setup in teuthology is an http connection and the TLS connection verification will fail in that case

is there no way to rectify this teuthology setup?

@pritha-srivastava

Copy link
Copy Markdown
Contributor

And we also need to think about how we can test this as the current keycloak setup in teuthology is an http connection and the TLS connection verification will fail in that case

is there no way to rectify this teuthology setup?

This needs to be looked into, I don't have an answer right away. The setup in teuthology was done by Kalpesh.

Comment thread src/rgw/rgw_rest_sts.cc Resolved
@awojno-bloomberg
awojno-bloomberg force-pushed the sts-fix branch 2 times, most recently from 38190a1 to deedf3e Compare June 2, 2025 19:40
@pritha-srivastava

Copy link
Copy Markdown
Contributor

@awojno-bloomberg : the code looks fine to me, just that the name of the config option rgw_verify_oidc_thumbprint and its description should be modified to indicate this validates the JWKS url endpoint making it AWS compliant. Because now we do have thumbprint verification but it is specific to x5c only and is therefore not compliant with AWS. Once done, we can start testing this to rule out any regressions.

Added `rgw_enable_jwks_url_verification` to control verification.

Signed-off-by: Alex Wojno <[email protected]>
@awojno-bloomberg

Copy link
Copy Markdown
Contributor Author

@awojno-bloomberg : the code looks fine to me, just that the name of the config option rgw_verify_oidc_thumbprint and its description should be modified to indicate this validates the JWKS url endpoint making it AWS compliant. Because now we do have thumbprint verification but it is specific to x5c only and is therefore not compliant with AWS. Once done, we can start testing this to rule out any regressions.

Okay, I changed the config to rgw_enable_jwks_url_verification and updated the description to reflect the logic updates.

@pritha-srivastava

pritha-srivastava commented Jun 6, 2025 •

Copy link
Copy Markdown
Contributor

@awojno-bloomberg : the code looks fine to me, just that the name of the config option rgw_verify_oidc_thumbprint and its description should be modified to indicate this validates the JWKS url endpoint making it AWS compliant. Because now we do have thumbprint verification but it is specific to x5c only and is therefore not compliant with AWS. Once done, we can start testing this to rule out any regressions.

Okay, I changed the config to rgw_enable_jwks_url_verification and updated the description to reflect the logic updates.

Looks great, qa can be started on this PR now.

@awojno-bloomberg

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@awojno-bloomberg

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@awojno-bloomberg

Copy link
Copy Markdown
Contributor Author

@pritha-srivastava

Copy link
Copy Markdown
Contributor

I kicked off a QA run for this build that seems to be failing for unrelated reasons: https://pulpito.ceph.com/bcs-ceph-2025-06-12_15:31:06-rgw-wip-awojno-sts-fixes-distro-default-smithi/

Any advice @pritha-srivastava?

@awojno-bloomberg : Is it possible for you to list out the exact failures here? I can see there are some "dead" jobs also. Can you please rebase with latest main and run this through teuthology once more?

@pritha-srivastava

Copy link
Copy Markdown
Contributor

@awojno-bloomberg : did you run the rgw:sts suite on this PR to rule out any regressions?

@BBoozmen

Copy link
Copy Markdown
Contributor

Hi @pritha-srivastava ,
Based on your earlier comment, the changes look good I believe. Will you be able to approve it?

Hi @cbodley ,

nrao19 added the wip-anrao1-testing label 2 weeks ago
cbodley removed the needs-qa label 2 weeks ago

Is the reason why this change-set is not going thru qa-testing (needs-qa label) because it's not approved yet or will @anrao19 's testing be enough to get this merged in?

We at Bloomberg have been looking forward to this fix for some time now. While we could work around it by patching it into our internal custom version, we'd really love to see it merged upstream with the community's support.

@kfox1111

Copy link
Copy Markdown

There are other projects that would also benefit from getting this into the next ceph patch release if possible.

@adamemerson

Copy link
Copy Markdown
Contributor

@cbodley @adamemerson : please advise on whether a re-run is needed for dead jobs? A substantial number of jobs are dead and as far as I know we need to re-run the PR through teuthology again.

lets focus on the test failures first? this one seems to be failling consistently:

=================================== FAILURES ===================================
____________________________ test_lifecycle_delete _____________________________

    @pytest.mark.lifecycle
    def test_lifecycle_delete():
        client = get_client()
        bucket_name = get_new_bucket(client)

        e = assert_raises(ClientError, client.get_bucket_lifecycle_configuration, Bucket=bucket_name)
        status, error_code = _get_status_and_error_code(e.response)
        assert status == 404
        assert error_code == 'NoSuchLifecycleConfiguration'

        # returns 204 even if there is no lifecycle config
        response = client.delete_bucket_lifecycle(Bucket=bucket_name)
        assert response['ResponseMetadata']['HTTPStatusCode'] == 204

        rules=[{'ID': 'test1/', 'Expiration': {'Days': 31}, 'Prefix': 'test1/', 'Status':'Enabled'},
               {'ID': 'test2/', 'Expiration': {'Days': 120}, 'Prefix': 'test2/', 'Status':'Enabled'}]
        lifecycle = {'Rules': rules}
        client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle)
        client.get_bucket_lifecycle_configuration(Bucket=bucket_name)

        response = client.delete_bucket_lifecycle(Bucket=bucket_name)
        assert response['ResponseMetadata']['HTTPStatusCode'] == 204

>       e = assert_raises(ClientError, client.get_bucket_lifecycle_configuration, Bucket=bucket_name)

s3tests_boto3/functional/test_s3.py:8340:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

excClass = <class 'botocore.exceptions.ClientError'>
callableObj = <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.S3 object at 0x7fad58659870>>
args = (), kwargs = {'Bucket': 'test-17vx34fvkk30jqbg568p50ox-434'}
excName = 'ClientError'

    def assert_raises(excClass, callableObj, *args, **kwargs):
        """
        Like unittest.TestCase.assertRaises, but returns the exception.
        """
        try:
            callableObj(*args, **kwargs)
        except excClass as e:
            return e
        else:
            if hasattr(excClass, '__name__'):
                excName = excClass.__name__
            else:
                excName = str(excClass)
>           raise AssertionError("%s not raised" % excName)
E           AssertionError: ClientError not raised

s3tests_boto3/functional/utils.py:19: AssertionError

Did you address this failure?

@pritha-srivastava

Copy link
Copy Markdown
Contributor

Hi @pritha-srivastava , Based on your earlier comment, the changes look good I believe. Will you be able to approve it?

Hi @cbodley ,

nrao19 added the wip-anrao1-testing label 2 weeks ago
cbodley removed the needs-qa label 2 weeks ago

Is the reason why this change-set is not going thru qa-testing (needs-qa label) because it's not approved yet or will @anrao19 's testing be enough to get this merged in?

We at Bloomberg have been looking forward to this fix for some time now. While we could work around it by patching it into our internal custom version, we'd really love to see it merged upstream with the community's support.

There was a path that I asked @awojno-bloomberg to test to rule out any STS regressions, I have not seen any response on that yet. Also @cbodley are you aware if the STS tests have passed (asking since you removed the needs-qa label).

@pritha-srivastava

Copy link
Copy Markdown
Contributor

I kicked off a QA run for this build that seems to be failing for unrelated reasons: https://pulpito.ceph.com/bcs-ceph-2025-06-12_15:31:06-rgw-wip-awojno-sts-fixes-distro-default-smithi/
Any advice @pritha-srivastava?

@awojno-bloomberg : Is it possible for you to list out the exact failures here? I can see there are some "dead" jobs also. Can you please rebase with latest main and run this through teuthology once more?

If you still find unrelated failures, you can check for teuthology runs for rgw against main and compare the results. You should schedule an additional run for "rgw:sts" suite to rule out any regressions in STS. If you need help with the exact commands, let me know.

Looking at main branch runs of teutology, it looks like they have the same issue with dead jobs and rgw suite failing. If it failing there, I'm not sure rebasing and rerunning will really do anything. It seems that teutology failing jobs is a constant issue with my experience. I can submit a run for rgw:sts suite though as that is not something that I have done yet.
@BBoozmen : Please refer to my comment above.

@cbodley

cbodley commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Also @cbodley are you aware if the STS tests have passed (asking since you removed the needs-qa label).

@pritha-srivastava from https://pulpito.ceph.com/bcs-ceph-2025-06-12_15:31:06-rgw-wip-awojno-sts-fixes-distro-default-smithi/ it looks like all of the rgw/sts jobs were 'dead'. i'd removed the label because it looked like this failed qa. the test_lifecycle_delete failure above may just mean that this pr branch needed a rebase. lets try a fresh rebase and rerun qa?

@pritha-srivastava

Copy link
Copy Markdown
Contributor

Also @cbodley are you aware if the STS tests have passed (asking since you removed the needs-qa label).

@pritha-srivastava from https://pulpito.ceph.com/bcs-ceph-2025-06-12_15:31:06-rgw-wip-awojno-sts-fixes-distro-default-smithi/ it looks like all of the rgw/sts jobs were 'dead'. i'd removed the label because it looked like this failed qa. the test_lifecycle_delete failure above may just mean that this pr branch needed a rebase. lets try a fresh rebase and rerun qa?

Sure, I'll take that up.

@BBoozmen

BBoozmen commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

@pritha-srivastava from https://pulpito.ceph.com/bcs-ceph-2025-06-12_15:31:06-rgw-wip-awojno-sts-fixes-distro-default-smithi/ it looks like all of the rgw/sts jobs were 'dead'. i'd removed the label because it looked like this failed qa. the test_lifecycle_delete failure above may just mean that this pr branch needed a rebase. lets try a fresh rebase and rerun qa?

Sure, I'll take that up.

Thank you @pritha-srivastava ! Hopefully, that will seal the deal.

@kfox1111
Any chance of this for v18.2.8?
There are other projects that would also benefit from getting this into the next ceph patch release if possible.

I'm not sure what @cbodley / @adamemerson / @pritha-srivastava think but AFAIK there's no plan to backport this change to Reef (v18) or even to Squid (v19). Pritha had another related set of changes prior to this PR so the backport of the full set of changes might be challenging I think. So, it looks like you'll need to wait for a Tentacle RC to utilize this change.

@kfox1111

kfox1111 commented Aug 1, 2025

Copy link
Copy Markdown

I was thinking that patch set got backported already, and that one was more of a feature, and this one is more of a bugfix?

@kfox1111

kfox1111 commented Aug 1, 2025

Copy link
Copy Markdown

@pritha-srivastava

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/prsrivas-2025-08-04_03:44:18-rgw:sts-wip-prsrivas-sts-fix-testing-distro-default-smithi/ - the STS tests have passed - there is no regression

@pritha-srivastava

pritha-srivastava commented Aug 4, 2025 •

Copy link
Copy Markdown
Contributor

A bunch of failures are there in the whole rgw test suite run:
1.

2025-08-04T04:12:04.998 INFO:teuthology.orchestra.run.smithi187.stdout:==== 1 failed, 3 passed, 1054 deselected, 17 warnings in 568.15s (0:09:28) =====
2025-08-04T04:14:52.057 INFO:teuthology.orchestra.run.smithi073.stdout:FAILED test_dedup.py::test_dedup_dry_basic - assert 0
2025-08-04T04:14:52.057 INFO:teuthology.orchestra.run.smithi073.stdout:FAILED test_dedup.py::test_dedup_dry_small_multipart - assert 0
2025-08-04T04:14:52.057 INFO:teuthology.orchestra.run.smithi073.stdout:FAILED test_dedup.py::test_dedup_dry_small - assert 0
2025-08-04T04:14:52.058 INFO:teuthology.orchestra.run.smithi073.stdout:FAILED test_dedup.py::test_dedup_dry_small_large_mix - assert 0
2025-08-04T04:14:52.058 INFO:teuthology.orchestra.run.smithi073.stdout:FAILED test_dedup.py::test_dedup_dry_basic_with_tenants - assert 0
  1. multisite failures
Traceback (most recent call last):
 File "/home/teuthworker/src/git.ceph.com_teuthology_bb07fbf8b821d133ffd961d10a72c4813e0d7a11/teuthology/run_tasks.py", line 105, in run_tasks
   manager = run_one_task(taskname, ctx=ctx, config=config)
 File "/home/teuthworker/src/git.ceph.com_teuthology_bb07fbf8b821d133ffd961d10a72c4813e0d7a11/teuthology/run_tasks.py", line 83, in run_one_task
   return task(**kwargs)
 File "/home/teuthworker/src/github.com_pritha-srivastava_ceph_51318d2a1a04a1b63a2a0bc725651913a8ce4794/qa/tasks/radosgw_admin.py", line 870, in task
   assert len(out) > 0
AssertionError
2025-08-04T04:20:12.491 INFO:tasks.workunit.client.0.smithi119.stdout:da637269-280f-4768-8d75-c9ca3ad7a974.4206.6__shadow_.ubd3q4i8aixBlDFnpR93ZIKYjP-0QRv_1
2025-08-04T04:20:12.491 INFO:tasks.workunit.client.0.smithi119.stdout:ERROR: orphans found when none expected
2025-08-04T04:20:12.491 INFO:tasks.workunit:Stopping ['rgw/test_rgw_orphan_list.sh'] on client.0..
sudo yum install -y kernel
8.
```valgrind error: Leak_DefinitelyLost operator new[](unsigned long) Objecter::linger_register(object_t const&, object_locator_t const&, int) neorados::RADOS::watch_(neorados::Object, neorados::IOContext, std::optional<std::chrono::duration<long, std::ratio<1l, 1l> > >, fu2::abi_400::detail::function<fu2::abi_400::detail::config<true, false, fu2::capacity_default>, fu2::abi_400::detail::property<true, false, void (boost::system::error_code, unsigned long, unsigned long, unsigned long, ceph::buffer::v15_2_0::list&&)> >, boost::asio::any_completion_handler<void (boost::system::error_code, unsigned long)>)

valgrind error: Leak_PossiblyLost operator new[](unsigned long) Objecter::start_tick() Objecter::start(OSDMap const*)
10.

2025-08-04T04:08:50.516 ERROR:teuthology.orchestra.connection:Error authenticating with smithi046.front.sepia.ceph.com: SSHException('No existing session') (No SSH private key found!)

Command failed (bucket notification tests against different endpoints) on smithi083 with status 1: 'BNTESTS_CONF=/home/ubuntu/cephtest/ceph/src/test/rgw/bucket_notification/bn-tests.client.0.conf /home/ubuntu/cephtest/ceph/src/test/rgw/bucket_notification/virtualenv/bin/python -m nose -s /home/ubuntu/cephtest/ceph/src/test/rgw/bucket_notification/test_bn.py -v -a kafka_failover'

@pritha-srivastava

Copy link
Copy Markdown
Contributor

None of these failures are related to changes in this PR, so this can be merged @cbodley and @adamemerson

@pritha-srivastava

Copy link
Copy Markdown
Contributor

also the tracker issue that this PR addresses was fixed and backported in another PR, this is an improvement over the earlier fix, so @cbodley and @adamemerson what process should be followed to backport this fix? shall I re-open the backport tickets for squid and reef and perform the backports?

@awojno-bloomberg

Copy link
Copy Markdown
Contributor Author

None of these failures are related to changes in this PR, so this can be merged @cbodley and @adamemerson

@cbodley and @adamemerson , any concerns with merging this?

@cbodley

cbodley commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

shall I re-open the backport tickets for squid and reef and perform the backports?

@pritha-srivastava i would suggest creating a new tracker issue for this pr's backports, rather than reusing existing issues

@cbodley
cbodley merged commit f153bb2 into ceph:main Aug 6, 2025
@kfox1111

kfox1111 commented Aug 6, 2025

Copy link
Copy Markdown

Could you please post the links to the backport issues here when created so we can follow along?

@awojno-bloomberg
awojno-bloomberg deleted the sts-fix branch August 6, 2025 15:04
@pritha-srivastava

Copy link
Copy Markdown
Contributor

@cbodley : I created a new tracker issue for this: https://tracker.ceph.com/issues/72457. But when I executed the create-backport-issue script, no backports were created. Did I miss any field here?

@cbodley

cbodley commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

@cbodley : I created a new tracker issue for this: https://tracker.ceph.com/issues/72457. But when I executed the create-backport-issue script, no backports were created. Did I miss any field here?

@pritha-srivastava we saw this in the bug scrub - you had set "Pending Backport" in the Tags field instead of the Status, so the create-backport-issue script missed it. backport trackers got created after we fixed that

@pritha-srivastava

Copy link
Copy Markdown
Contributor

@cbodley : I created a new tracker issue for this: https://tracker.ceph.com/issues/72457. But when I executed the create-backport-issue script, no backports were created. Did I miss any field here?

@pritha-srivastava we saw this in the bug scrub - you had set "Pending Backport" in the Tags field instead of the Status, so the create-backport-issue script missed it. backport trackers got created after we fixed that

Actually I had left it empty, even then the script didn't create any backport trackers, so I tried again by setting the tag field to Pending Backports. Anyway I will perform the backports in the coming days

@pritha-srivastava

Copy link
Copy Markdown
Contributor

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.

7 participants