Repository navigation
rgw: extending STS support for AssumeRoleWithWebIdentity - #60985
awojno-bloomberg wants to merge 4 commits into
Conversation
Adding support for matching JWT to JWK by key ID. Adding support for RSA bare key validation. Updating current x5c logic to search all JWKS by thumbprint. Signed-off-by: Alex Wojno <[email protected]>
|
jenkins test make check |
|
I updated the summary with more information in the second section about what issues we ran into and how this PR addresses those issues and linked a tracker that describes the x5c optional issue. When solving these issues, I tried to conform to the JWT standard as much as possible and referenced the relevant RFCs. As far as trust chaining for AWS, JWT is an industry standard so the way trust is established with JWKs should conform to that standard. Maybe I'm missing something here so please correct me if so. I didn't change any of the previous logic with regards to using thumbprints to check for matches against the x5c certs but with the lack of x5c field, that logic wouldn't apply. |
As mentioned in AWS documentation, which I think is not very obvious but has been pointed out in tracker https://tracker.ceph.com/issues/69106, |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
RE: For the extension to the x5c logic, I only updated it so that each JWK has the x5c checked to fix tracker https://tracker.ceph.com/issues/54562. Previously only the first JWK was tested according to the tracker. The x5c logic does use the thumbprint for validation to make sure the certificates match. Not quite sure about that logic but this PR didn't fundamentally change (or at least it was not my intention) the thumbprint logic with x5c. Perhaps the bare key validation should follow the thumbprint logic with the generated cert. |
Well, I am not talking about verification using trusted root certs in AWS, if they are not there then there is an alternative given to use the thumbprint configured in the IDP to verify the JSON Web Key Set (JWKS) endpoint's TLS certificate. We need to have a discussion around this before concluding anything as we would like to maintain compatibility with AWS as much as possible. @mattbenjamin @mdw-at-linuxbox can you weigh in here? what is the correct thing to do?
|
|
If you follow the discussion on this PR: #41525, even here it has been pointed out that AWS uses the thumbprints to verify the jwks_keys https endpoint:
|
|
As @pritha-srivastava points out, this PR doesn't seem to address my bug; it does make the |
There seem to be two steps to STS:
The current RGW logic is to use the thumbprint to match the JWKs' x5c. This implies the assumption that the same certificate is used as the TLS certificate for the JWKS endpoint and also a certificate added as a JWK. This is a strong assumption that won't be correct for most set ups. Instead, we should use this thumbprint to validate the JWKS url only. This has not been done in my PR currently but can be another tracker. The changes in my PR address the second step, which involves JWT validation, which should be based on the outstanding RFCs. @bootc , I would question that AWS just validates the JWKS url with the thumbprint without looking at the contents as that tells one nothing about the validity of the JWT token. Both are important steps that could use improvement. |
Right, I meant the actual JWKs don't factor into the fingerprint comparison, only the HTTPS TLS certificates do. Once the endpoint has been validated the JWKs are then trusted to validate the JWT in the request. These days AWS also have a set of trusted roots so fingerprints are unnecessary at all in many cases, but I think it would be fine to add that later. |
The signature must be validated and there should be a way to validate that the token is originating from the OIDC provider registered with rgw. ( We do match the 'aud' claim and use the 'iss' claim to fetch the oidc provider info registered with rgw). And for the different ways to validate the signature, some work following RFC https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.1 has been done in the PR: #41525
|
The trust chaining that I am referring to is actually there in the RFC https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.6 which states that |
Signed-off-by: Alex <[email protected]>
f6d8630 to
ba9cbea
Compare
|
Update: I pushed a commit that changes the core logic to address the changes we have been discussing. The main changes are:
FYI @bootc |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
Signed-off-by: Alex Wojno <[email protected]>
e6d8337 to
7095b1d
Compare
|
jenkins test make check |
|
Apologies for the delay in publishing the PR. I was able to successfully test the use cases that the PR addressed. Please take a look when you get a chance @pritha-srivastava @adamemerson |
Do you have something we could add to our test suite? |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
Closed in favor of #63047 |
In order to support the enhancement, the jwt-cpp library was updated to the latest version and the code was updated to reflect that. The relevant changes to the STS logic include:
-- Adding support for matching JWT to JWK key id. Per RFC 7515, the
kidfield is used as a hint to which JWK to be used. While the use is optional, the implication seems to be that if present, it should be used to match to a corresponding JWKkid. Ifkidis present in the JWT but not able to be matched to a JWK, this is a verification failure.-- Added RSA bare key validation. Per RFC 7517 the
x5cJWK parameter is optional. If not present and the key is an RSA key type (RS256/384/512), then thenandevalues can be used to generate a public key that can be used for signature verification.-- Extended the existing
x5cvalidation with new logic to search all of the JWKs for ax5ccertificate that matches the thumbprints. Per RFC 7517, the first certificate in thex5cparameter is the one containing the key value to be used for verification.Addresses: https://tracker.ceph.com/issues/54562
-- The previous logic did not check all of the JWKs correctly. This was extended to loop through all of the JWKs when applicable.
Addresses: https://tracker.ceph.com/issues/69106
-- x5c is an optional field but RGW STS logic assumes it is mandatory. There are other ways to validate a JWT other than x5c, such as bare key validation. Support for that is added.
Enhancement: Use Key ID to match.
-- JWT Key ID provides a hint as to which JWK to use. This field when present should be used to match the JWK. This provides faster checking as not every JWK needs to be checked.
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 retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e