-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #944 from synfinatic/aws-ssl-test
add test tool for ssl bug
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ config.yaml* | |
store.json | ||
__debug_bin | ||
coverage.out | ||
aws-ssl-test | ||
*.crt | ||
*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |