-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
sts assume-role doesn't work with non-admin permissions #6001
Comments
I found a workaround, but I still think it's a weird behavior/requirement for the CLI, since this works without this in the Console.
where ACCOUNT_ID is the exact same account number of the account I am in (so the target role IAM account). |
Hi @warden, Thanks for writing in! I definitely agree that the initial configuration of As for why it worked in the console and not the CLI— I think it's possible that enabling cross-account access may automatically allow for you to assume roles of connected accounts, but it's hard to say whether or not that is the case. Please let me know if you need any more assistance on this! |
@stobrien89 I have seen the page you referenced indeed but I don't see anything that would help in this (quite standard for cross-IAM approach I'd say) use case. I think I wasn't clear enough with the IAM trust relationship, so let me rephrase:
This worked fine on AWS Console to allow me to switch from a user in the root IAM account to the ViewOnly role on the target account. However, it did not work with aws-cli. It seems that aws-cli does a double assume-role call (see detailed error message above) and to get it worked I needed to add an additional trust relationship mentioned above which I believe is quite weird as the initial role assumption worked, as stated by the error message. |
Notice that in the added Trust Relationship clause also I needed to remove MFA condition, with it in place it also does not work. So it seems that behind the scenes:
I think this is a bug, especially that as I stated above, with admin permissions on the role it all works fine without adding the additional trust relationship. |
Hi @warden, My apologies for the misunderstanding on your initial post. I do agree that this could potentially be a bug, but I think there may be an explanation for why the double assume-role call is happening. Would you be able to share the contents of your config file (just the affected profiles)? Please obscure any sensitive information. Thanks! |
Sure, there you go:
|
Hi @warden, Thank you for the additional information. Is your "admin" profile configured in a similar fashion? We could also get a better handle on what's happening by taking a look at the debug logs. From what I can see, the two |
Yes, the only difference for the Admin profile is that the assumed role is having AdministratorAccess role.
Indeed, that is the case and your idea is good, but... it is not supported in the workflow with YubiKey ;-)
If I would just use What is even more frustrating, is that I need to have the $ASSUMED_ROLE and $MFA_ARN things hardcoded in the role assumption script as I cannot get them easily from the config (this is unrelated/somehow related to this bug, but just for you to have the full picture). The script currently looks like this:
Now, to get rid of the hardcoded MFA_ARN and ASSUMED_ROLE I could use
and we're stuck in an endless loop ;-) |
Hi @warden, Thanks again for the additional information. I was going to ask more about your workflow, but this definitely clears things up! I realize your current workflow is far from ideal, but given the current CLI functionality and lack of U2F support, I'm not seeing any other ways we could optimize this. I'll definitely run this by the development team on Monday to see what their thoughts are. |
Hi @warden, Thank you for your patience while I reviewed with the team. They couldn't find any aspects of your workflow that could be optimized without U2F support— We do have an open feature request for this, but it has been open for quite some time, so it's anyone's guess as to when/if this would be implemented. Closing for now, but please let me know if you need any additional support! |
|
Scenario:
Now:
Details:
This works:
The exact same command for ReadOnly role doesn't work:
It looks like the role assumption went through but for some reason the CLI tries to re-assume from the botocore session to the actual session, since this works fine for the role with Full permissions, do I need specific IAM permissions for STS, but as the documentation states it should not. It also works in AWS Console UI...
This looks awfully similar to #2279.
Edit:
Adding AdministratorAccess role to the target account makes it work... definitely it looks like a permission issue that is not mentioned anywhere I looked.
SDK version number
The text was updated successfully, but these errors were encountered: