Hi,
I would like to assign Vault roles to my AWS auth based on either my UserId or the RoleSessionName and I'm not sure how (or if) it's possible.
For example, I've auth'd against AWS:
$ aws sts get-caller-identity --profile example
{
"Account": "1234567890",
}
I have the following auth/aws role:
$ vault read auth/aws/role/ExampleRole
Key Value
--- -----
auth_type iam
bound_iam_principal_arn arn:aws:iam::1234567890:role/ExampleRole
bound_iam_principal_id AROAINNNNNNNN
bound_iam_role_arn n/a
inferred_entity_type n/a
period 0
policies [example_policy]
resolve_aws_unique_ids true
role_tag n/a
....
And when I auth, I get the following:
$ export AWS_PROFILE=example
$ vault login -method=aws
Key Value
--- -----
token a...
token_accessor b...
token_policies [default example_policy]
token_meta_client_user_id AROANNNNNNNNNNNNNNNNN
token_meta_inferred_aws_region n/a
token_meta_inferred_entity_id n/a
token_meta_inferred_entity_type n/a
token_meta_account_id 1234567890
token_meta_auth_type iam
token_meta_canonical_arn arn:aws:iam::1234567890:role/ExampleRole
The backend that permits me to assume ExampleRole enforces that the SessionName is always my email address.
Ideally I would want to do something akin to:
$ vault write auth/aws/role/example-james.atwill auth_type=iam \
policies=user-policy-james.atwill
max_ttl=25h ttl=23h
Is something like this possible / would it be hard to implement?
JAmes