From 7c91a8495ff2f754480f1440aa24a5dca653d8f6 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 23 Nov 2015 13:39:57 -0800 Subject: [PATCH] signature/region: Remove 'milkyway' and use 'us-east-1' as default. Fixes #980 --- AWS-SDK-GO.md | 4 ++-- api-errors.go | 2 +- api-signature.go | 2 +- pkg/fs/signature.go | 4 ++-- server_fs_test.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AWS-SDK-GO.md b/AWS-SDK-GO.md index b6b4e176a..4eebbe68a 100644 --- a/AWS-SDK-GO.md +++ b/AWS-SDK-GO.md @@ -23,11 +23,11 @@ import ( ) func main() { - // Create an S3 service object in the "milkyway" region + // Create an S3 service object in the default region. s3Client := s3.New(&aws.Config{ Credentials: credentials.NewStaticCredentials("", "", ""), Endpoint: aws.String("http://localhost:9000"), - Region: aws.String("milkyway"), + Region: aws.String("us-east-1"), DisableSSL: aws.Bool(true), S3ForcePathStyle: aws.Bool(true), }) diff --git a/api-errors.go b/api-errors.go index 3237e9cb9..a75c60752 100644 --- a/api-errors.go +++ b/api-errors.go @@ -213,7 +213,7 @@ var errorCodeResponse = map[int]APIError{ }, AuthorizationHeaderMalformed: { Code: "AuthorizationHeaderMalformed", - Description: "The authorization header is malformed; the region is wrong; expecting 'milkyway'.", + Description: "The authorization header is malformed; the region is wrong; expecting 'us-east-1'.", HTTPStatusCode: http.StatusBadRequest, }, MalformedPOSTRequest: { diff --git a/api-signature.go b/api-signature.go index 27b3543da..5e41e4d6d 100644 --- a/api-signature.go +++ b/api-signature.go @@ -77,7 +77,7 @@ func isValidRegion(authHeaderValue string) *probe.Error { return err.Trace() } region := credentialElements[2] - if region != "milkyway" { + if region != "us-east-1" { return probe.NewError(errInvalidRegion) } return nil diff --git a/pkg/fs/signature.go b/pkg/fs/signature.go index e53106ce0..355fd933c 100644 --- a/pkg/fs/signature.go +++ b/pkg/fs/signature.go @@ -210,7 +210,7 @@ func (r Signature) getPresignedCanonicalRequest(presignedQuery string) string { func (r Signature) getScope(t time.Time) string { scope := strings.Join([]string{ t.Format(yyyymmdd), - "milkyway", + "us-east-1", "s3", "aws4_request", }, "/") @@ -229,7 +229,7 @@ func (r Signature) getStringToSign(canonicalRequest string, t time.Time) string func (r Signature) getSigningKey(t time.Time) []byte { secret := r.SecretAccessKey date := sumHMAC([]byte("AWS4"+secret), []byte(t.Format(yyyymmdd))) - region := sumHMAC(date, []byte("milkyway")) + region := sumHMAC(date, []byte("us-east-1")) service := sumHMAC(region, []byte("s3")) signingKey := sumHMAC(service, []byte("aws4_request")) return signingKey diff --git a/server_fs_test.go b/server_fs_test.go index 308b51c75..d44e90dfe 100644 --- a/server_fs_test.go +++ b/server_fs_test.go @@ -234,7 +234,7 @@ func (s *MyAPIFSCacheSuite) newRequest(method, urlStr string, contentLength int6 scope := strings.Join([]string{ t.Format(yyyymmdd), - "milkyway", + "us-east-1", "s3", "aws4_request", }, "/") @@ -244,7 +244,7 @@ func (s *MyAPIFSCacheSuite) newRequest(method, urlStr string, contentLength int6 stringToSign = stringToSign + hex.EncodeToString(sum256([]byte(canonicalRequest))) date := sumHMAC([]byte("AWS4"+s.secretAccessKey), []byte(t.Format(yyyymmdd))) - region := sumHMAC(date, []byte("milkyway")) + region := sumHMAC(date, []byte("us-east-1")) service := sumHMAC(region, []byte("s3")) signingKey := sumHMAC(service, []byte("aws4_request"))