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

Cannot rotate identity keys when assuming a role #9

Open
dewe opened this issue Apr 17, 2019 · 0 comments
Open

Cannot rotate identity keys when assuming a role #9

dewe opened this issue Apr 17, 2019 · 0 comments

Comments

@dewe
Copy link

dewe commented Apr 17, 2019

Any call to iam.CurrentUser() (lazy loaded) will blow up when having assumed a role, throwing api error: An error occurred (ValidationError) when calling the ListAccessKeys operation: Must specify userName when calling with non-User credentials

This is a bit annoying when having the AWS_MFA_ROTATE_IDENTITY_KEYS environment variable set.

awsmfa arn:aws:iam:: 123456789012:role/myRole -d 3600 --rotate-identity-keys
MFA Token Code: 
Temporary credentials will expire in 0:59:59.861841.
Traceback (most recent call last):
  File "/usr/local/bin/awsmfa", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/awsmfa/__main__.py", line 47, in main
    err = rotate(args, credentials)
  File "/usr/local/lib/python2.7/site-packages/awsmfa/__main__.py", line 193, in rotate
    in iam.CurrentUser().access_keys.all()
  File "/usr/local/lib/python2.7/site-packages/awsmfa/__main__.py", line 192, in <genexpr>
    current_access_key = next((key for key
  File "/usr/local/lib/python2.7/site-packages/boto3/resources/collection.py", line 83, in __iter__
    for page in self.pages():
  File "/usr/local/lib/python2.7/site-packages/boto3/resources/collection.py", line 166, in pages
    for page in pages:
  File "/usr/local/lib/python2.7/site-packages/botocore/paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/paginate.py", line 332, in _make_request
    return self._method(**current_kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the ListAccessKeys operation: Must specify userName when calling with non-User credentials
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

No branches or pull requests

1 participant