Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Cross account config #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

endemics
Copy link
Contributor

Allow automatic role selection for cross-account role by following the source_profile "trail" in .aws/config

This would address #20 (comment)

Before adding documentation for this feature, please let me know if you think this use of source_profile is legit or if I'm abusing it (I couldn't find any documentation anywhere explaining how it's meant to be used).

…e source_profile trail in .aws/config:

If a source_profile is specified in the target profile, then we inspect that source_profile to see if a role_arn was set.
If the source_profile has a role_arn set, then we use it as the cross-account role we are trying to find in the list of
values from <saml2:Attribute Name="https://aws.amazon.com/SAML/Attributes/Role">.

For example, if the configuration is:
```
[default]
region = us-east-1

[profile role1]
source_profile = default
region = us-west-2
role_arn = arn:aws:iam::123456789012:role/cross-account-role-1

[profile role2]
source_profile = role1
region = ap-southeast-2
role_arn = arn:aws:iam::987654321098:role/my-target-role
```

Then when running `oktad role2 -- bash` we will be looking for the role_arn of the source_profile referenced in profile role2,
that is we will try to find arn:aws:iam::123456789012:role/cross-account-role-1 in the values obtained from the SAML assertion.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant