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

Handle AWS_SESSION_TOKEN environment variable #557

Closed

Conversation

philsnow
Copy link

This allows s3cmd to be used with temporary credentials as provided by aws-cli's aws sts get-session-token command, which is useful if your API key is required by a policy to use MFA.

@philsnow
Copy link
Author

philsnow commented Jun 8, 2015

@mdomsch -- you look like the most recently-prolific committer
@dudyk -- you worked on the role config stuff before

Is there any chance either of you could take a look ? Thanks!

@mdomsch
Copy link
Contributor

mdomsch commented Jun 9, 2015

if awscli can get the session token, why can't s3cmd? Why call aws sts get-session-token, store it in the environment, then invoke s3cmd? At that point, might as well just use awscli for everything...

@philsnow
Copy link
Author

philsnow commented Jun 9, 2015

I'm not saying s3cmd couldn't get session tokens itself. I would prefer not to re-invent the wheel.

As for using awscli for everything, s3cmd has better performance and I think the 'sync' command has somewhat different semantics, making it not quite a drop-in replacement for s3cmd in existing scripts.

Philip Snowberger added 3 commits June 11, 2015 14:46
This allows s3cmd to be used with temporary credentials as provided by
aws-cli's `aws sts get-session-token` command, which is useful if your
API key is required by a policy to use MFA.

Add option to fetch temporary credentials from EC2's metadata service
even if the config file or environment variables have them.  This can
be convenient if you'd rather not remove environment variables from
your environment but you do want to use an IAM role.

Rename access_token to session_token.  This is the canonical name for
the temporary token, see [0].

[0] http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs
If access_key and secret_key command line args were passed, and there
was no config file or environment variables set, the
Config.used_role_config option got set which caused us to try to
re-fetch temporary credentials on every request.
@philsnow philsnow force-pushed the philsnow/sts-use-session-token branch from 23f3759 to aa422b6 Compare June 11, 2015 21:46
@mdomsch
Copy link
Contributor

mdomsch commented Jun 14, 2015

I'd much rather merge a patch that gets the session token directly.

@philsnow
Copy link
Author

philsnow commented Jul 2, 2015

fair. closing this. if anybody else wants this as-is, it's in my fork.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants