Skip to content

AWS auth backend client unable to use IAM credentials from ECS task metadata #8847

@inkblot

Description

@inkblot

This is a regression

Worked in version: 1.3.0
Broken in version: 1.4.0

Bug Description
I have Vault deployed as an ECS service, using an ECS task definition with an associated task role. I have an AWS auth backend configured with a client that uses the IAM credentials from ECS task metadata. This configuration was working without issues with Vault 1.3.0. After upgrading Vault to version 1.4.0, I am unable to create AWS auth backend roles. Vault is unable to resolve the ARN and produces the following output (IDs and URLs redacted or modified):

$ vault write auth/aws/role/example auth_type=iam bound_iam_principal_arn=arn:aws:iam::3xxxxxxxxxx6:role/example policies=default
Error writing data to auth/aws/role/example: Error making API request.

URL: PUT https://vault.internal:8200/v1/auth/aws/role/example
Code: 400. Errors:

* unable to resolve ARN "arn:aws:iam::3xxxxxxxxxx6:role/example" to internal ID: unable to fetch current caller: InvalidClientTokenId: The security token included in the request is invalid
	status code: 403, request id: 5xxxxxxx-5xxx-4xxx-9xxx-5xxxxxxxxxx

The backend client is apparently able to use the AWS access key id and secret access key from ECS metadata, but not the token which is also required to authenticate.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy Vault 1.4.0 in AWS ECS using a task role that grants ecs:DescribeInstances, iam:GetInstanceProfiles, iam:GetRole, and iam:GetUser
  2. Configure an AWS auth backend, omitting credentials from the backend client
  3. Attempt to create an AWS auth role as indicated in the bug description

Expected behavior
I expect Vault to use AWS credentials (access key, secret key, and token) from ECS metadata, successfully resolve the IAM role, and create the auth role.

Environment:

  • Vault Server Version: 1.4.0
  • Vault CLI Version: 1.4.0
  • Server Operating System/Architecture: vault docker image deployed to AWS ECS

Vault server configuration file template:

storage "consul" {
  address = "${consul_http_address}"
  path    = "${vault_consul_path}"
}

listener "tcp" {
  address         = "0.0.0.0:8200"
  tls_cert_file = "/ssl/certs/server.pem"
  tls_key_file  = "/ssl/private/server.pem"
}

ui = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    auth/awsbugUsed to indicate a potential bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions