-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Bug: reqwest can send an invalid TLS SNI extension, by using IP in the host name #1328
Comments
Is there any progress on this? I'm pretty sure I'm running into the same issue... I have a client that runs reqwest connecting to a server that uses rustls for TLS. When I use IP addresses (with matching certificates) to connect to the server, I get "invalid SNI" errors - but if I use hostnames, it works. It would be really great if there was some fix or workaround for this, since I can't use hostnames for all the domains in my project - and moreover, testing locally is a nightmare since I'm using Docker containers (which don't use the host's For what it's worth, I'm using the |
If I am remembering correctly, the current workaround is to do the following: -use rustls feature of reqwest (make sure to disable default features or force use of rustls by API) but then you are effectively ignoring certificate validation. |
I see, thanks! I might be able to use that for local testing :) But since this indeed disables host verification, I won't be able to use that when trying to connect to the domains which only have an IP - so I'll keep looking for a solution for that. Maybe that I can do something with a custom DNS resolver, if that doesn't prove too hard to implement myself (and if reqwest supports that). If I manage, I'll post it here, just for future reference. Thanks! |
I think native-tls works with IPs out of box if the other end is not based on rustls or something with the same problem.. |
Well, the other end is based on rustls, so maybe that doesn't improve that much... But thanks for the suggestion nonetheless :) On that note - thanks even more for creating a pull request with the workaround! I'm excited to see this merged :D |
Closed as it was fixed in rust-openssl (which is used by native tls). |
This get rejected by servers based on rustls as can be seen here. From this issue, @ctz says this is not permitted by the standard.
Below I provide how to reproduce the bug.
Client src/main.rs
Cargo.toml
To run a sample server locally
The server output:
The client output:
To check for the SNI extension, inside tls folder from rocket run:
Relevant Output:
The text was updated successfully, but these errors were encountered: