@@ -528,6 +528,14 @@ func main() {
528528 Name : "aws-profile" ,
529529 Usage : "The AWS profile to use for requests to AWS" ,
530530 },
531+ cli.StringFlag {
532+ Name : "aws-kms-endpoint" ,
533+ Usage : "The AWS KMS Endpoint to use for requests to AWS. Ex: https://kms.ap-southeast-2.amazonaws.com" ,
534+ },
535+ cli.StringFlag {
536+ Name : "aws-sts-endpoint" ,
537+ Usage : "The AWS STS Endpoint to use for requests to AWS. Ex: https://sts.ap-southeast-2.amazonaws.com" ,
538+ },
531539 cli.StringSliceFlag {
532540 Name : "gcp-kms" ,
533541 Usage : "the GCP KMS Resource ID the new group should contain. Can be specified more than once" ,
@@ -572,7 +580,7 @@ func main() {
572580 group = append (group , pgp .NewMasterKeyFromFingerprint (fp ))
573581 }
574582 for _ , arn := range kmsArns {
575- group = append (group , kms .NewMasterKeyFromArn (arn , kms .ParseKMSContext (c .String ("encryption-context" )), c .String ("aws-profile" )))
583+ group = append (group , kms .NewMasterKeyFromArn (arn , kms .ParseKMSContext (c .String ("encryption-context" )), c .String ("aws-profile" ), c . String ( "aws-kms-endpoint" ), c . String ( "aws-sts-endpoint" ) ))
576584 }
577585 for _ , kms := range gcpKmses {
578586 group = append (group , gcpkms .NewMasterKeyFromResourceID (kms ))
@@ -890,6 +898,14 @@ func main() {
890898 Name : "aws-profile" ,
891899 Usage : "The AWS profile to use for requests to AWS" ,
892900 },
901+ cli.StringFlag {
902+ Name : "aws-kms-endpoint" ,
903+ Usage : "The AWS KMS Endpoint to use for requests to AWS" ,
904+ },
905+ cli.StringFlag {
906+ Name : "aws-sts-endpoint" ,
907+ Usage : "The AWS STS Endpoint to use for requests to AWS" ,
908+ },
893909 cli.StringFlag {
894910 Name : "gcp-kms" ,
895911 Usage : "comma separated list of GCP KMS resource IDs" ,
@@ -1228,6 +1244,14 @@ func main() {
12281244 Name : "aws-profile" ,
12291245 Usage : "The AWS profile to use for requests to AWS" ,
12301246 },
1247+ cli.StringFlag {
1248+ Name : "aws-kms-endpoint" ,
1249+ Usage : "The AWS KMS Endpoint to use for requests to AWS" ,
1250+ },
1251+ cli.StringFlag {
1252+ Name : "aws-sts-endpoint" ,
1253+ Usage : "The AWS STS Endpoint to use for requests to AWS" ,
1254+ },
12311255 cli.StringFlag {
12321256 Name : "gcp-kms" ,
12331257 Usage : "comma separated list of GCP KMS resource IDs" ,
@@ -1602,6 +1626,14 @@ func main() {
16021626 Name : "aws-profile" ,
16031627 Usage : "The AWS profile to use for requests to AWS" ,
16041628 },
1629+ cli.StringFlag {
1630+ Name : "aws-kms-endpoint" ,
1631+ Usage : "The AWS KMS Endpoint to use for requests to AWS" ,
1632+ },
1633+ cli.StringFlag {
1634+ Name : "aws-sts-endpoint" ,
1635+ Usage : "The AWS STS Endpoint to use for requests to AWS" ,
1636+ },
16051637 cli.StringFlag {
16061638 Name : "gcp-kms" ,
16071639 Usage : "comma separated list of GCP KMS resource IDs" ,
@@ -2085,7 +2117,7 @@ func getEncryptConfig(c *cli.Context, fileName string) (encryptConfig, error) {
20852117
20862118func getMasterKeys (c * cli.Context , kmsEncryptionContext map [string ]* string , kmsOptionName string , pgpOptionName string , gcpKmsOptionName string , azureKvOptionName string , hcVaultTransitOptionName string , ageOptionName string ) ([]keys.MasterKey , error ) {
20872119 var masterKeys []keys.MasterKey
2088- for _ , k := range kms .MasterKeysFromArnString (c .String (kmsOptionName ), kmsEncryptionContext , c .String ("aws-profile" )) {
2120+ for _ , k := range kms .MasterKeysFromArnString (c .String (kmsOptionName ), kmsEncryptionContext , c .String ("aws-profile" ), c . String ( "aws-kms-endpoint" ), c . String ( "aws-sts-endpoint" ) ) {
20892121 masterKeys = append (masterKeys , k )
20902122 }
20912123 for _ , k := range pgp .MasterKeysFromFingerprintString (c .String (pgpOptionName )) {
@@ -2274,7 +2306,7 @@ func keyGroups(c *cli.Context, file string) ([]sops.KeyGroup, error) {
22742306 return nil , common .NewExitError ("Invalid KMS encryption context format" , codes .ErrorInvalidKMSEncryptionContextFormat )
22752307 }
22762308 if c .String ("kms" ) != "" {
2277- for _ , k := range kms .MasterKeysFromArnString (c .String ("kms" ), kmsEncryptionContext , c .String ("aws-profile" )) {
2309+ for _ , k := range kms .MasterKeysFromArnString (c .String ("kms" ), kmsEncryptionContext , c .String ("aws-profile" ), c . String ( "aws-kms-endpoint" ), c . String ( "aws-sts-endpoint" ) ) {
22782310 kmsKeys = append (kmsKeys , k )
22792311 }
22802312 }
0 commit comments