-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set AWS_SDK_LOAD_CONFIG for system services #243
Set AWS_SDK_LOAD_CONFIG for system services #243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm that this configuration does not leak into the environment for orchestrated containers?
Have you confirmed via code inspection that this does nothing if the config file doesn't exist? (What if it's malformed?)
packages/release/aws-config.conf
Outdated
@@ -0,0 +1,3 @@ | |||
[Service] | |||
# Allow system services load ${HOME}/.aws/config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a misleading comment:
- it only applies to system services using the AWS SDK for Go
- those services can already set this variable and load the config if they want
I sort of understand the rationale for applying this as a system-wide setting but it might be good to state it here.
It doesn't:
I'm still confirming your other question. |
I created a simple Go client like so: package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sts"
)
func main() {
sess := session.Must(session.NewSession())
svc := sts.New(sess)
input := &sts.GetCallerIdentityInput{}
result, err := svc.GetCallerIdentity(input)
if err != nil {
fmt.Printf("Error!: %v", err)
return
}
fmt.Println(result)
} And tested as follows with
Error!: RequestError: send request failed
caused by: Post "https://sts-fips.aws-global.amazonaws.com/": dial tcp: lookup sts-fips.aws-global.amazonaws.com: no such host⏎ With ❯ go run main.go
{
Account: "XXXXXXXXXXXX",
Arn: "arn:aws:sts::XXXXXXXXXXXX:assumed-role/<role>/<>",
UserId: "<>"
} I tested similar cases in the ECS agent (e.g. malformed |
The AWS SDK for Go doesn't use the ${HOME}/.aws/config file unless the AWS_SDK_LOAD_CONFIG env variable is set to a truthy value Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
3fa93d3
to
7cd4cd2
Compare
Issue number:
Related: bottlerocket-os/bottlerocket#1667
Description of changes:
The AWS SDK for Go doesn't use the
${HOME}/.aws/config
file unless theAWS_SDK_LOAD_CONFIG
env variable is set to a truthy value. This applies to both v1 and v2 versions of the AWS SDK for Go. The AWS SDK for Rust doesn't requireAWS_SDK_LOAD_CONFIG
to be set to read${HOME}/.aws/config
Testing done:
In an
aws-ecs-2-fips
variant which defaults to have an AWS config as:Without the environment variable set, the ECS agent used the default AWS endpoints. With the environment variable set and the same AWS confg as above, the ECS agent used the FIPS endpoints:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.