Fix AWS Console (w/ integration) access when using IP Pinning #61489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When IP Pinning is enabled, the certificate's pinned IP and the IP presented by the client in the connection must be the same.
For AWS Console access which uses an integration, we don't use an Application Service to proxy connections, the Proxy Service is used instead.
In this situation, it uses a
net.Pipewhich sets both Local/Remote addrs topipe.When validating whether that's the same IP as the one present in the certificate's pinned IP, it fails because that's the address of an intermediate connection.
This PR fixes this by wrapping the connection with an overrided
RemoteAddrmethod which returns the true client's IP extracted from the context.Backporting to v17 because, even tho Roles Anywhere is v18, this also affects AWS OIDC integration which is present in v17.
Fixes #61437
Changelog: Fixed AWS Console access when using AWS IAM Roles Anywhere or AWS OIDC integrations, when IP Pinning is enabled.