Skip to content
This repository was archived by the owner on Aug 27, 2023. It is now read-only.

SignatureDoesNotMatch. The request signature we calculated does not match the signature you provided. Check your key and signing method. #36

Open
DimaProskurin opened this issue May 19, 2022 · 2 comments

Comments

@DimaProskurin
Copy link

Hi. I've got such an error while try to download package from UI. Uploading packages works OK and files appear in my S3 bucket.

<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>***</AWSAccessKeyId>
    <StringToSign>AWS4-HMAC-SHA256 20220519T154751Z 20220519/eu-north-1/s3/aws4_request f94e404c24963f3957c5323d8af573834d2ea6bd4333629dab5b0e01cfdb3826</StringToSign>
    <SignatureProvided>719353f1023ce928397a181631d725ae9519ab3130d0d3a2a3e0c9f0bf3c710c</SignatureProvided>
    <StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 32 30 35 31 39 54 31 35 34 37 35 31 5a 0a 32 30 32 32 30 35 31 39 2f 65 75 2d 6e 6f 72 74 68 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 66 39 34 65 34 30 34 63 32 34 39 36 33 66 33 39 35 37 63 35 33 32 33 64 38 61 66 35 37 33 38 33 34 64 32 65 61 36 62 64 34 33 33 33 36 32 39 64 61 62 35 62 30 65 30 31 63 66 64 62 33 38 32 36</StringToSignBytes>
    <CanonicalRequest>GET /b710/example-package-proskurin/example_package_proskurin-0.0.1-py3-none-any.whl X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***%2F20220519%2Feu-north-1%2Fs3%2Faws4_request&X-Amz-Date=20220519T154751Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host host:pypicloud-storage.s3.eu-north-1.amazonaws.com host UNSIGNED-PAYLOAD</CanonicalRequest>
    <CanonicalRequestBytes>47 45 54 0a 2f 62 37 31 30 2f 65 78 61 6d 70 6c 65 2d 70 61 63 6b 61 67 65 2d 70 72 6f 73 6b 75 72 69 6e 2f 65 78 61 6d 70 6c 65 5f 70 61 63 6b 61 67 65 5f 70 72 6f 73 6b 75 72 69 6e 2d 30 2e 30 2e 31 2d 70 79 33 2d 6e 6f 6e 65 2d 61 6e 79 2e 77 68 6c 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 58 58 57 5a 4d 4b 5a 56 41 54 46 42 56 34 57 50 25 32 46 32 30 32 32 30 35 31 39 25 32 46 65 75 2d 6e 6f 72 74 68 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 32 30 35 31 39 54 31 35 34 37 35 31 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 38 36 34 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 0a 68 6f 73 74 3a 70 79 70 69 63 6c 6f 75 64 2d 73 74 6f 72 61 67 65 2e 73 33 2e 65 75 2d 6e 6f 72 74 68 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes>
    <RequestId>JKVYR8H8J05B2KKB</RequestId>
    <HostId>NOnFFZn1YVxkH95lBkh6bHvisfVXAHz1MHOoAHNrq9GqgGkK1LToE2VZiYRKsTdXRBTOMDzKUzc=</HostId>
</Error>

Prerequisites:

  1. I ran service in docker container via docker run -p 8080:8080 -v $(pwd)/config.ini:/etc/pypicloud/config.ini:ro stevearc/pypicloud

  2. This is the part for storage driver in config.ini:

pypi.storage = s3
storage.aws_access_key_id = ***
storage.aws_secret_access_key = ***
storage.bucket = pypicloud-storage
storage.region_name = eu-north-1
storage.signature_version = s3v4
@DimaProskurin
Copy link
Author

DimaProskurin commented May 19, 2022

Update for issue.
After I have logged out from Admin account in UI, then downloading of packages from UI work now.

I logged out from Admin account and logged in. Everything works now.

I haven't understood why such error appeared and why it disappear after logout. Do you have any thoughts about it?

@stevearc
Copy link
Owner

Theoretically logging in or out shouldn't affect this. The URL generation logic is just calling into boto with some standard parameters
https://github.com/stevearc/pypicloud/blob/ac3cc0ae9af0270be37a5c6673b01da5bcb987a7/pypicloud/storage/s3.py#L173-L176

Anything I can think of that could cause this also wouldn't be solved by logging out or simply retrying. Beyond that, I'd need a lot more debug information

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants