Skip to content

Commit

Permalink
Merge pull request #944 from synfinatic/aws-ssl-test
Browse files Browse the repository at this point in the history
add test tool for ssl bug
  • Loading branch information
synfinatic authored Jul 6, 2024
2 parents af902d4 + e14be32 commit fc18632
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ config.yaml*
store.json
__debug_bin
coverage.out
aws-ssl-test
*.crt
*.key
31 changes: 31 additions & 0 deletions cmd/aws-ssl-test/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

// Test AWS SDK with custom CA bundle to see if it works with the
// AWS_CONTAINER_CREDENTIALS_FULL_URI environment variable set.

import (
"context"
"fmt"
"os"

"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/sts"
)

func main() {
ca, err := os.Open("./CA.crt")
if err != nil {
panic(fmt.Sprintf("Unable to open CA.crt: %v", err))
}
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithCustomCABundle(ca))
if err != nil {
panic(err)
}

client := sts.NewFromConfig(cfg)
output, err := client.GetCallerIdentity(context.TODO(), nil)
if err != nil {
panic(err)
}
fmt.Printf("identity: %v\n", output)
}

0 comments on commit fc18632

Please sign in to comment.