Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix IAM joining failing in some cases when a web identity was used as an AWS credential #46764

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

capnspacehook
Copy link
Contributor

@capnspacehook capnspacehook commented Sep 19, 2024

When the Teleport service attempting to join a cluster using an IAM token was running in FIPS mode in an AWS region without a FIPS STS endpoint, and a web identity token was used as the AWS credential, the local AWS region would be used to build the STS request. We had logic to detect this and fallback to the us-east-1 region instead, but that was done by passing an additional config to sts.New. The config that the AWS session.Session contains takes priority over all others. The us-east-1 region was initially used to build the STS request, but when calling Request.Sign on the STS request the URL was changed to use the region configured in the session.Session.

Instead, rebuild the session.Session and STS client sts.STS when the region needs to be changed.

Fixes https://github.com/gravitational/customer-sensitive-requests/issues/308.

changelog: fix IAM joining failing in some cases when a web identity was used as an AWS credential

… an AWS credential

When the Teleport service attempting to join a cluster using an IAM token
was running in FIPS mode in an AWS region without a FIPS STS endpoint,
and a web identity token was used as the AWS credential, the local AWS
region would be used to build the STS request. We had logic to detect this
and fallback to the `us-east-1` region instead, but that was done by
passing an additional config to `sts.New`. The config that the AWS
`session.Session` contains takes priority over all others. The `us-east-1`
region was initially used to build the STS request, but when calling
`Request.Sign` on the STS request the URL was changed to use the region
configured in the `session.Session`.

Instead, rebuild the `session.Session` and STS client `sts.STS` when the
region needs to be changed.

This comment was marked as resolved.

Copy link
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

Would migrating the sts client to aws-sdk-go-v2 allow this problem to be solved in a different manner? Would this even be a problem with the aws-sdk-go-v2 sts client?

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not sure if this is unit testable, probably tricky, maybe we should add this case to the test plan?

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