-
Notifications
You must be signed in to change notification settings - Fork 339
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
Support AssumeRole when credential_source = Environment
#181
Comments
Hey @b-willard, thanks for opening this! I think it would be good to support |
Hi @samuelkarp I'm planning to take a look at this - do you have any ideas what you wanted in terms of a new environment variable? I've not looked at this a great deal yet, but I'm even wondering if it would be possible to just use the presence of |
Hi @benhowes, I am currently blocked from using the credential helper as I need use |
@StephanePaulus the PR works, but does require you to build it. I'm quite surprised to have not heard anything from the AWS team about it by now to be honest! FWIW it is quite easy to build/distribute a binary for go if you need to and it's looking like we're going to have no choice but to do that. |
@benhowes Sorry about that. I've just reviewed your PR. |
Use Case
I am storing credentials (
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
) encrypted in a remote vault and do not want to expose them to the docker host in question via ~/.aws/credentials. Instead, credentials should temporarily exist on the docker host via the environment. The environment is populated during a configuration management run or image build provisioning process which interfaces with the remote vault and decrypts the credentials.Issue
The configuration required to meet this use case results in a catch-22:
~/.aws/config with environment credential source
environment vars
where
arn:aws:iam::xxxxxxxxxxxx:role/Some-ECR-ReadOnly-Role
uses the AWS ECR Read Only managed policy and the IAM user associated toAWS_ACCESS_KEY_ID
has the following policy directly attached:With this setup and aws-go-sdk's credential load precedence, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are used directly rather than AssumeRole'ing and using the resulting STS credentials instead. As a result, any
docker pull
ordocker push
under this configuration results in #164. This is acknowledged with a solution in the sdk's documentation.Solution
I have a working
docker-credential-ecr-login
binary meeting my needs based on the diff below. (I did not submit this as an official PR because these are the first lines of Go I've ever written :D so I'm certain there are better methods.) The change essentially asks two questions:AWS_SDK_LOAD_CONFIG
andAWS_PROFILE
set?AWS_SDK_LOAD_CONFIG
truthy?Iff both answers are 'yes' then create a session with the
Profile
option set to the value ofAWS_PROFILE
. Otherwise, business as usual. Prior to applying this diff I updated aws-sdk-go tov1.23.17
in order to pick up aws/aws-sdk-go#1901 and aws/aws-sdk-go#2385.The text was updated successfully, but these errors were encountered: