Skip to content
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

SignatureDoesNotMatch when port is 80 #321

Closed
DouglasMarsh opened this issue Jul 25, 2019 · 13 comments · Fixed by #434
Closed

SignatureDoesNotMatch when port is 80 #321

DouglasMarsh opened this issue Jul 25, 2019 · 13 comments · Fixed by #434

Comments

@DouglasMarsh
Copy link

I've discovered an issue with using the minio dotnet client when connected to a minio server over port 80.
The signature generated by the client sets host header using the following code:
SetHostHeader(request, client.BaseUrl.Host + ":" + client.BaseUrl.Port);
This is V4Authenicator.cs: line 114
The issue is, the server doesn't seem to include the port number with host resulting in a signature mismatch.

I've verify buy running the dot-net samples code and removing port number from SetHostHeader. The signature mismatch issue goes away.

@kannappanr
Copy link
Contributor

@DouglasMarsh Thanks for reporting the issue. We will take a look and get back to you.

@poornas
Copy link
Contributor

poornas commented Jul 25, 2019

@DouglasMarsh, are you running minio behind a proxy? If so - please check if the proxy is overwriting host header.

With minio server running on port 80, not able to repro the bug that you see.

@DouglasMarsh
Copy link
Author

yes minio is behind a nginx ingress running kubernetes.
I will check if the ingress is overwritting the host header

@poornas
Copy link
Contributor

poornas commented Aug 9, 2019

ping @DouglasMarsh

@poornas
Copy link
Contributor

poornas commented Aug 26, 2019

@DouglasMarsh, were you able to check your nginx settings?

@Smoothstep
Copy link

This also happens when using a different RestSharp version. Using RestSharp v106.5.0 or higher, the same signature mismatch error is returned for multipart uploads. Tested on dotnet core 2.2.

@poornas
Copy link
Contributor

poornas commented Sep 6, 2019

This also happens when using a different RestSharp version. Using RestSharp v106.5.0 or higher, the same signature mismatch error is returned for multipart uploads. Tested on dotnet core 2.2.

@SpeedPing, can you turn on http tracing for minio server by running mc admin trace -v -a myminio-alias and run minio-dotnet sdk with client.SetTraceOn() and share the output? We are not able to repro this on linux running .netcore examples from here with endpoint at port 80. Are you using nginx as well? If so, make sure that host headers are not being overwritten by your proxy.

@Smoothstep
Copy link

Tested on 2 completely different networks&machines with local and remote setup, same outcome.

Steps to reproduce on windows:

  1. Create dot netcore 2.2 console project
  2. Reference latest minio-dotnet
  3. Reference latest RestSharp
  4. Invoke PutObjectAsync with a stream and size above 5 Mb
  5. Wait for results

mc admin results:
fail.txt
success.txt

@Smoothstep
Copy link

@poornas Can you validate this issue?

@poornas
Copy link
Contributor

poornas commented Sep 12, 2019

@poornas Can you validate this issue?

@SpeedPing , was not able to repro this issue with the latest 3.1.4 version. Are you able to run the sample project successfully? Just change the endpoint and credentials to your local minio server and test your upload against that.

@Smoothstep
Copy link

@poornas It appears to work with https enabled. Having it disabled in Minio.Functional.Tests, I'm encountering the same error message. I'll try to resort to https.

@Maximkaaa
Copy link

@poornas I've faced the same issue, but connecting to a different s3 server. For my work I need to use Yandex S3, which works great with official Java tools and python boto. But MinIO client failes to authenticated with it for this reason. It seems that the server implementation does not expect default :80 port to be present in the host header.

In my case it seems to be a bug in the server implementation. Still other tools work fine with it since they do not include the :80 port in the host header. Do you think it can be beneficial to also not include default port, as more popular tools do, to provide better support for different S3 server implementations? If so, I can make a PR.

kannappanr added a commit to kannappanr/minio-dotnet that referenced this issue Jul 1, 2020
Some object storages do not honor standard ports as part of hostheader

Fixes minio#321, minio#428
harshavardhana pushed a commit that referenced this issue Jul 1, 2020
Some object storages do not honor standard ports as part of hostheader

Fixes #321, #428
@sergei66666
Copy link
Contributor

@Maximkaaa Just to note: yandex team fixed it, now it works fine.

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

Successfully merging a pull request may close this issue.

6 participants