-
Notifications
You must be signed in to change notification settings - Fork 266
Description
Describe the bug
This is an indirect bug report from a user of Vector, which uses the AWS SDK.
When using the default credential chain, they see the loader reporting that it saw a 301, but it doesn't seem to automatically follow it, as I would expect.
The user is using KIAM to intercept the requests which is likely why the behavior differs from IMDSv2 generally.
See debug logs below.
Expected Behavior
The default credentials loader follows any observed 301s to fetch the IAM credentials.
Current Behavior
When a 301 is observed, it stops and bubbles up an error.
Reproduction Steps
Unfortunately I haven't observed this behavior myself, but we could ask the user for additional details if necessary.
Possible Solution
Default credential loader follows 301s from IMDSv2 API.
Additional Information/Context
User is running KIAM to intercept the metadata requests.
Vector issue: vectordotdev/vector#13211
Version
├── aws-config v0.11.0
│ ├── aws-http v0.11.0
│ │ ├── aws-smithy-http v0.41.0
│ │ │ ├── aws-smithy-eventstream v0.41.0
│ │ │ │ ├── aws-smithy-types v0.41.0
│ │ │ ├── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-types v0.11.0
│ │ │ ├── aws-smithy-async v0.41.0
│ │ │ ├── aws-smithy-client v0.41.0
│ │ │ │ ├── aws-smithy-async v0.41.0 (*)
│ │ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ │ ├── aws-smithy-http-tower v0.41.0
│ │ │ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ │ ├── aws-smithy-types v0.41.0 (*)
│ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-sdk-sso v0.11.0
│ │ ├── aws-endpoint v0.11.0
│ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ ├── aws-types v0.11.0 (*)
│ │ ├── aws-http v0.11.0 (*)
│ │ ├── aws-sig-auth v0.11.0
│ │ │ ├── aws-sigv4 v0.11.0
│ │ │ │ ├── aws-smithy-eventstream v0.41.0 (*)
│ │ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ ├── aws-smithy-eventstream v0.41.0 (*)
│ │ │ ├── aws-smithy-http v0.41.0 (*)
│ │ │ ├── aws-types v0.11.0 (*)
│ │ ├── aws-smithy-async v0.41.0 (*)
│ │ ├── aws-smithy-client v0.41.0 (*)
│ │ ├── aws-smithy-http v0.41.0 (*)
│ │ ├── aws-smithy-http-tower v0.41.0 (*)
│ │ ├── aws-smithy-json v0.41.0
│ │ │ └── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-types v0.11.0 (*)
│ ├── aws-sdk-sts v0.11.0
│ │ ├── aws-endpoint v0.11.0 (*)
│ │ ├── aws-http v0.11.0 (*)
│ │ ├── aws-sig-auth v0.11.0 (*)
│ │ ├── aws-smithy-async v0.41.0 (*)
│ │ ├── aws-smithy-client v0.41.0 (*)
│ │ ├── aws-smithy-http v0.41.0 (*)
│ │ ├── aws-smithy-http-tower v0.41.0 (*)
│ │ ├── aws-smithy-query v0.41.0
│ │ │ ├── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-smithy-types v0.41.0 (*)
│ │ ├── aws-smithy-xml v0.41.0
│ │ ├── aws-types v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-json v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-cloudwatch v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-query v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-smithy-xml v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-cloudwatchlogs v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-json v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-firehose v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-json v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-kinesis v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-json v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-s3 v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-sigv4 v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-eventstream v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-smithy-xml v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sdk-sqs v0.11.0
│ ├── aws-endpoint v0.11.0 (*)
│ ├── aws-http v0.11.0 (*)
│ ├── aws-sig-auth v0.11.0 (*)
│ ├── aws-smithy-async v0.41.0 (*)
│ ├── aws-smithy-client v0.41.0 (*)
│ ├── aws-smithy-http v0.41.0 (*)
│ ├── aws-smithy-http-tower v0.41.0 (*)
│ ├── aws-smithy-query v0.41.0 (*)
│ ├── aws-smithy-types v0.41.0 (*)
│ ├── aws-smithy-xml v0.41.0 (*)
│ ├── aws-types v0.11.0 (*)
├── aws-sigv4 v0.11.0 (*)
├── aws-smithy-async v0.41.0 (*)
├── aws-smithy-client v0.41.0 (*)
├── aws-smithy-http v0.41.0 (*)
├── aws-smithy-http-tower v0.41.0 (*)
├── aws-smithy-types v0.41.0 (*)
├── aws-types v0.11.0 (*)
Environment details (OS name and version, etc.)
x86_64-unknown-linux-musl
Logs
2022-06-21T15:09:44.896310Z INFO provide_credentials{provider=default_chain}: aws_config::meta::credentials::chain: provider in chain did not provide credentials provider=Environment context=environment variable not set
2022-06-21T15:09:44.896352Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}: aws_config::fs_util: loaded home directory src="HOME"
2022-06-21T15:09:44.896368Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_config_file: aws_config::profile::parser::source: performing home directory substitution home="/root" path="~/.aws/config"
2022-06-21T15:09:44.896379Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_config_file: aws_config::profile::parser::source: home directory expanded before="~/.aws/config" after="/root/.aws/config"
2022-06-21T15:09:44.896429Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_config_file: aws_config::profile::parser::source: config file not found path=~/.aws/config
2022-06-21T15:09:44.896447Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_config_file: aws_config::profile::parser::source: config file loaded path=~/.aws/config size=0
2022-06-21T15:09:44.896458Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_credentials_file: aws_config::profile::parser::source: performing home directory substitution home="/root" path="~/.aws/credentials"
2022-06-21T15:09:44.896477Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_credentials_file: aws_config::profile::parser::source: home directory expanded before="~/.aws/credentials" after="/root/.aws/credentials"
2022-06-21T15:09:44.896487Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_credentials_file: aws_config::profile::parser::source: config file not found path=~/.aws/credentials
2022-06-21T15:09:44.896493Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Profile}:load_credentials_file: aws_config::profile::parser::source: config file loaded path=~/.aws/credentials size=0
2022-06-21T15:09:44.896511Z INFO provide_credentials{provider=default_chain}: aws_config::meta::credentials::chain: provider in chain did not provide credentials provider=Profile context=No profiles were defined
2022-06-21T15:09:44.896529Z INFO provide_credentials{provider=default_chain}: aws_config::meta::credentials::chain: provider in chain did not provide credentials provider=WebIdentityToken context=$AWS_WEB_IDENTITY_TOKEN_FILE was not set
2022-06-21T15:09:44.896543Z INFO provide_credentials{provider=default_chain}: aws_config::meta::credentials::chain: provider in chain did not provide credentials provider=EcsContainer context=ECS provider not configured
2022-06-21T15:09:44.896558Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}: aws_config::imds::credentials: loading credentials from IMDS
2022-06-21T15:09:44.896567Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}: aws_config::fs_util: loaded home directory src="HOME"
2022-06-21T15:09:44.896576Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_config_file: aws_config::profile::parser::source: performing home directory substitution home="/root" path="~/.aws/config"
2022-06-21T15:09:44.896585Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_config_file: aws_config::profile::parser::source: home directory expanded before="~/.aws/config" after="/root/.aws/config"
2022-06-21T15:09:44.896595Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_config_file: aws_config::profile::parser::source: config file not found path=~/.aws/config
2022-06-21T15:09:44.896609Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_config_file: aws_config::profile::parser::source: config file loaded path=~/.aws/config size=0
2022-06-21T15:09:44.896619Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_credentials_file: aws_config::profile::parser::source: performing home directory substitution home="/root" path="~/.aws/credentials"
2022-06-21T15:09:44.896628Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_credentials_file: aws_config::profile::parser::source: home directory expanded before="~/.aws/credentials" after="/root/.aws/credentials"
2022-06-21T15:09:44.896644Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_credentials_file: aws_config::profile::parser::source: config file not found path=~/.aws/credentials
2022-06-21T15:09:44.896650Z DEBUG provide_credentials{provider=default_chain}:load_credentials{provider=Ec2InstanceMetadata}:load_credentials_file: aws_config::profile::parser::source: config file loaded path=~/.aws/credentials size=0
2022-06-21T15:09:44.898362Z WARN provide_credentials{provider=default_chain}: aws_config::meta::credentials::chain: provider failed to provide credentials provider=Ec2InstanceMetadata error=An error occurred while loading credentials: Error response from IMDS (code: 301). Response { status: 301, version: HTTP/1.1, headers: {"content-type": "text/html; charset=utf-8", "location": "/latest/meta-data/iam/security-credentials/", "date": "Tue, 21 Jun 2022 15:09:44 GMT", "content-length": "78"}, body: SdkBody { inner: Once(Some(b"<a href=\"/latest/meta-data/iam/security-credentials/\">Moved Permanently</a>.\n\n")), retryable: true } }
Metadata
Metadata
Assignees
Labels
Type
Projects
Status