You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We run a Vault instance in the us-gov-west-1 region of GovCloud (aws-us-gov partition) and use it to authenticate other EC2 instances in the same region using IAM auth. This authentication will sometimes stop working after restarting Vault or if leadership changes and the follower node becomes active. When authentication is failing, restarting or stepping down Vault enough times will eventually fix the problem and auth will work until the next restart or step-down event.
When authentication fails, Vault returns this error:
$ vault login -method=aws role=iam-test
Error authenticating: Error making API request.
URL: PUT https://vault.domain/v1/auth/aws/login
Code: 400. Errors:
* error looking up full ARN of entity &{aws-us-gov <account-id> assumed-role <iam-role-name> <instance-id>}: error fetching role "iam-role-name": SignatureDoesNotMatch: Credential should be scoped to a valid region, not 'us-gov-east-1'.
status code: 403, request id: b2b3ea37-0aea-49ea-bd60-c37677475dd1
I believe this is because the fullARN function looks up a region for the partition in a map that associates a random region with each partition at startup. If this map caches us-gov-east-1 as the region, then all authentication attempts fail. Restarting Vault enough times will eventually randomly cache us-gov-west-1 as the region and authentication will start working.
To Reproduce
Steps to reproduce the behavior:
Configure Vault for IAM auth in us-gov-west-1. The Vault role should include a wildcard pattern in the bound_iam_principal_arn property (e.g. match all IAM principals in a specific account).
Run vault login -method=aws role=<role-name> region=us-gov-west-1
The login fails with the error above. If the login works, restart the Vault server process and try again
Expected behavior
The success or failure of authentication should not randomly change when restarting Vault.
Environment:
Vault Server Version (retrieve with vault status): 1.4.2
Vault CLI Version (retrieve with vault version): tested both 1.0.2 and 1.4.2
Server Operating System/Architecture: Ubuntu 16.04
Note that sts_endpoint and sts_region are set to the right region, as is inferred_aws_region.
Additional context
When testing login from the Vault 1.0.2, I made sure both AWS_REGION and AWS_DEFAULT_REGION were set to us-gov-west-1, since region is not accepted as a login parameter.
I'm not sure if us-gov-east-1 is ever valid as a region for IAM operations. It may be that the aws-us-gov partition should always select us-gov-west-1 as the region, similar to how the aws partition always selects us-east-1.
The text was updated successfully, but these errors were encountered:
Describe the bug
We run a Vault instance in the us-gov-west-1 region of GovCloud (
aws-us-gov
partition) and use it to authenticate other EC2 instances in the same region using IAM auth. This authentication will sometimes stop working after restarting Vault or if leadership changes and the follower node becomes active. When authentication is failing, restarting or stepping down Vault enough times will eventually fix the problem and auth will work until the next restart or step-down event.When authentication fails, Vault returns this error:
I believe this is because the
fullARN
function looks up a region for the partition in a map that associates a random region with each partition at startup. If this map cachesus-gov-east-1
as the region, then all authentication attempts fail. Restarting Vault enough times will eventually randomly cacheus-gov-west-1
as the region and authentication will start working.To Reproduce
Steps to reproduce the behavior:
bound_iam_principal_arn
property (e.g. match all IAM principals in a specific account).vault login -method=aws role=<role-name> region=us-gov-west-1
Expected behavior
The success or failure of authentication should not randomly change when restarting Vault.
Environment:
vault status
): 1.4.2vault version
): tested both 1.0.2 and 1.4.2Vault server configuration file(s):
AWS backend configuration:
The server uses an instance profile to authenticate with AWS.
Note that
sts_endpoint
andsts_region
are set to the right region, as isinferred_aws_region
.Additional context
When testing login from the Vault 1.0.2, I made sure both
AWS_REGION
andAWS_DEFAULT_REGION
were set tous-gov-west-1
, sinceregion
is not accepted as a login parameter.I'm not sure if
us-gov-east-1
is ever valid as a region for IAM operations. It may be that theaws-us-gov
partition should always selectus-gov-west-1
as the region, similar to how theaws
partition always selectsus-east-1
.The text was updated successfully, but these errors were encountered: