-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is the code using S3 support V4 signature #876
Comments
I have successfully debugged the v4 signature. |
i got error s3ErrorCode = "InvalidRequest", s3ErrorMessage = "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256." by cargohold |
Hi, I also faced with such problem, more details in #1123 |
|
cargohold packages.yaml - aws >=0.18 ,chang it >=0.19 |
@maybeTomorrow, no way, it is still not working: diff --git a/services/cargohold/package.yaml b/services/cargohold/package.yaml
index 3f4ffe45..ac5731f5 100644
--- a/services/cargohold/package.yaml
+++ b/services/cargohold/package.yaml
@@ -38,7 +38,7 @@ library:
- base >=4 && <5
- attoparsec >=0.12
- auto-update >=0.1.4
- - aws >=0.18
+ - aws >=0.19
- byteable >=0.1
- base16-bytestring >=0.1
- cargohold-types >=0.5 logs:
|
Hi, thanks for opening an issue. If you are using our However, our code in Cargohold doesn't make use of the v4 signature, which can be seen in We still use As far as I know we already use V4 signatures in the other services and I think this is something we can change here, too. We just have to do some testing against both S3 and Minio. I'll look into it! |
Thanks I just tried to recompile wire-server with: diff --git a/services/cargohold/package.yaml b/services/cargohold/package.yaml
index 3f4ffe45..ac5731f5 100644
--- a/services/cargohold/package.yaml
+++ b/services/cargohold/package.yaml
@@ -38,7 +38,7 @@ library:
- base >=4 && <5
- attoparsec >=0.12
- auto-update >=0.1.4
- - aws >=0.18
+ - aws >=0.19
- byteable >=0.1
- base16-bytestring >=0.1
- cargohold-types >=0.5
diff --git a/services/cargohold/src/CargoHold/App.hs b/services/cargohold/src/CargoHold/App.hs
index 9745abf0..397c5597 100644
--- a/services/cargohold/src/CargoHold/App.hs
+++ b/services/cargohold/src/CargoHold/App.hs
@@ -129,7 +129,8 @@ endpointToConfig :: AWSEndpoint -> Aws.S3Configuration qt
endpointToConfig (AWSEndpoint host secure port) =
(Aws.s3 (toProtocol secure) host False)
{ Aws.s3Port = port,
- Aws.s3RequestStyle = Aws.PathStyle
+ Aws.s3RequestStyle = Aws.PathStyle,
+ Aws.s3SignVersion = Aws.S3SignV4 { _s3SignPayloadMode = Aws.SignWithEffort }
}
where
toProtocol :: Bool -> Aws.Protocol But now I see
|
Original Plan – Support for SigV2 ends on June 24, 2019. Revised Plan – Any new buckets created after June 24, 2020 will not support SigV2 signed requests, although existing buckets will continue to support SigV2 while we work with customers to move off this older request signing method. i think we should update to v4 @mheinzel |
Thanks @maybeTomorrow, we bumped the priority of this to get it done in time. @kvaps, this issue seems related, we'll investigate. |
endpointToConfig (AWSEndpoint host secure port) = |
@maybeTomorrow I was able rebuild cargohold to make uploads working, but downloads still don't: cargohold logs are clean nginz log:
response: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIARVXF5BFS6KZEMRFD</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20200604T095720Z
20200604/eu-central-1/s3/aws4_request
9d4c2ada616a21c82f7bc26689fc52ac2b8b40883b35d4a0df08c432622ed3f8</StringToSign><SignatureProvided>21f7235bc8cae2f06825d095deff9b11f34fc709a6b783bd1ce84478694f2ae0</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 30 30 36 30 34 54 30 39 35 37 32 30 5a 0a 32 30 32 30 30 36 30 34 2f 65 75 2d 63 65 6e 74 72 61 6c 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 39 64 34 63 32 61 64 61 36 31 36 61 32 31 63 38 32 66 37 62 63 32 36 36 38 39 66 63 35 32 61 63 32 62 38 62 34 30 38 38 33 62 33 35 64 34 61 30 64 66 30 38 63 34 33 32 36 32 32 65 64 33 66 38</StringToSignBytes><CanonicalRequest>GET
/omegaim-test/v3/persistent/ef09b148-76ec-4db2-b8bd-14ce7d1f420c
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIARVXF5BFS6KZEMRFD%2F20200604%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20200604T095720Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host%3Bx-amz-content-sha256%3Bx-amz-date
host:s3.eu-central-1.amazonaws.com
x-amz-content-sha256:
x-amz-date:
host;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD</CanonicalRequest><CanonicalRequestBytes>47 45 54 0a 2f 6f 6d 65 67 61 69 6d 2d 74 65 73 74 2f 76 33 2f 70 65 72 73 69 73 74 65 6e 74 2f 65 66 30 39 62 31 34 38 2d 37 36 65 63 2d 34 64 62 32 2d 62 38 62 64 2d 31 34 63 65 37 64 31 66 34 32 30 63 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 52 56 58 46 35 42 46 53 36 4b 5a 45 4d 52 46 44 25 32 46 32 30 32 30 30 36 30 34 25 32 46 65 75 2d 63 65 6e 74 72 61 6c 2d 31 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 32 30 30 36 30 34 54 30 39 35 37 32 30 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 33 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 68 6f 73 74 25 33 42 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 25 33 42 78 2d 61 6d 7a 2d 64 61 74 65 0a 68 6f 73 74 3a 73 33 2e 65 75 2d 63 65 6e 74 72 61 6c 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 0a 0a 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes><RequestId>227AC48D01B45631</RequestId><HostId>fYKmauvsU6gQzD7fWZmHu6Sfye7me3izRYolR2Qr9Jn/Mpn6QmQv5fyL3yGei3LCl26m5KMuwwo=</HostId></Error> my modifications: diff --git a/services/cargohold/package.yaml b/services/cargohold/package.yaml
index 3f4ffe45..ac5731f5 100644
--- a/services/cargohold/package.yaml
+++ b/services/cargohold/package.yaml
@@ -38,7 +38,7 @@ library:
- base >=4 && <5
- attoparsec >=0.12
- auto-update >=0.1.4
- - aws >=0.18
+ - aws >=0.19
- byteable >=0.1
- base16-bytestring >=0.1
- cargohold-types >=0.5
diff --git a/services/cargohold/src/CargoHold/App.hs b/services/cargohold/src/CargoHold/App.hs
index 9745abf0..8a5b84d8 100644
--- a/services/cargohold/src/CargoHold/App.hs
+++ b/services/cargohold/src/CargoHold/App.hs
@@ -127,7 +127,7 @@ initAws o l m = do
endpointToConfig :: AWSEndpoint -> Aws.S3Configuration qt
endpointToConfig (AWSEndpoint host secure port) =
- (Aws.s3 (toProtocol secure) host False)
+ (Aws.s3v4 (toProtocol secure) host False Aws.SignWithEffort)
{ Aws.s3Port = port,
Aws.s3RequestStyle = Aws.PathStyle
}
diff --git a/services/cargohold/src/CargoHold/S3.hs b/services/cargohold/src/CargoHold/S3.hs
index bdbcba4c..a2a27306 100644
--- a/services/cargohold/src/CargoHold/S3.hs
+++ b/services/cargohold/src/CargoHold/S3.hs
@@ -111,7 +111,7 @@ uploadV3 ::
Maybe V3.AssetToken ->
ConduitM () ByteString IO () ->
ExceptT Error App ()
-uploadV3 prc (s3Key . mkKey -> key) (V3.AssetHeaders ct cl md5) tok src = do
+uploadV3 prc (s3Key . mkKey -> key) (V3.AssetHeaders ct cl _) tok src = do
Log.debug $
"remote" .= val "S3"
~~ "asset.owner" .= toByteString prc
@@ -123,7 +123,7 @@ uploadV3 prc (s3Key . mkKey -> key) (V3.AssetHeaders ct cl md5) tok src = do
let body = requestBodySource (fromIntegral cl) src
void . tryS3 . exec $
(putObject b key body)
- { poContentMD5 = Just md5,
+ { poContentMD5 = Nothing,
poContentType = Just (encodeMIMEType ct),
poExpect100Continue = True,
poMetadata = |
i test a demo code and success upload file 。
|
@kvaps comment this line: but the link to get the image doesn't work.it return SignatureDoesNotMatch; |
signedURL path = do b <- s3Bucket <$> view aws |
@maybeTomorrow @kvaps Do you want to give the branch |
Sorry I swap project to google cloud, and I have no opportunity to check V4 signing anymore :/ |
My question:
I tried to use S3 provided by AWS, I found the wire-server use the V2 signature and the s3 service we got only supports V4 signature.
Is there anything I could do to bypass the problem or some fixes? Will the newer version of wire will support the V4 signature?
The text was updated successfully, but these errors were encountered: