Skip to content

Commit 0c7b585

Browse files
author
Arthur Silva Sens
authored
Merge pull request #649 from rajagopalanand/13364
Add SigV4 FIPS STS endpoint config
2 parents 804fbbe + 77ec85c commit 0c7b585

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

sigv4/sigv4.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"sync"
2424
"time"
2525

26+
"github.com/aws/aws-sdk-go/aws/endpoints"
27+
2628
"github.com/aws/aws-sdk-go/aws"
2729
"github.com/aws/aws-sdk-go/aws/credentials"
2830
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
@@ -59,10 +61,16 @@ func NewSigV4RoundTripper(cfg *SigV4Config, next http.RoundTripper) (http.RoundT
5961
creds = nil
6062
}
6163

64+
useFIPSSTSEndpoint := endpoints.FIPSEndpointStateDisabled
65+
if cfg.UseFIPSSTSEndpoint {
66+
useFIPSSTSEndpoint = endpoints.FIPSEndpointStateEnabled
67+
}
68+
6269
sess, err := session.NewSessionWithOptions(session.Options{
6370
Config: aws.Config{
64-
Region: aws.String(cfg.Region),
65-
Credentials: creds,
71+
Region: aws.String(cfg.Region),
72+
Credentials: creds,
73+
UseFIPSEndpoint: useFIPSSTSEndpoint,
6674
},
6775
Profile: cfg.Profile,
6876
})

sigv4/sigv4_config.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import (
2323
// AWS's SigV4 verification process. Empty values will be retrieved using the
2424
// AWS default credentials chain.
2525
type SigV4Config struct {
26-
Region string `yaml:"region,omitempty"`
27-
AccessKey string `yaml:"access_key,omitempty"`
28-
SecretKey config.Secret `yaml:"secret_key,omitempty"`
29-
Profile string `yaml:"profile,omitempty"`
30-
RoleARN string `yaml:"role_arn,omitempty"`
26+
Region string `yaml:"region,omitempty"`
27+
AccessKey string `yaml:"access_key,omitempty"`
28+
SecretKey config.Secret `yaml:"secret_key,omitempty"`
29+
Profile string `yaml:"profile,omitempty"`
30+
RoleARN string `yaml:"role_arn,omitempty"`
31+
UseFIPSSTSEndpoint bool `yaml:"use_fips_sts_endpoint,omitempty"`
3132
}
3233

3334
func (c *SigV4Config) Validate() error {

sigv4/testdata/sigv4_good.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ access_key: AccessKey
33
secret_key: SecretKey
44
profile: profile
55
role_arn: blah:role/arn
6+
use_fips_sts_endpoint: true

0 commit comments

Comments
 (0)