-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
HttpClientHandler.ServerCertificateCustomValidationCallback blows up on OSX #17723
Comments
cc: @stephentoub |
Yes, to use several of the HttpClient features related to certificates, like ServerCertificateCustomValidationCallback, you need to be using a version of libcurl built against OpenSSL; the version you're using is the one that comes with macOS, built against the SecureTransport backend. We do not have the ability to plug in to that backend, hence we throw an exception to indicate that the callback won't be used. |
@stephentoub I don't think this acceptable. I couldn't make any http request because of it and I'm using the install instructions on the main website which many many others are going to use (that are on osx). Could we get a check to see if it's supported like other handler features? Any request without validation callback is better than nothing.. I get why you are throwing it.. but most peoples http client code is going to be try catched and they are not going to see this... |
We can look to augment the instructions / release notes with related details.
I'm not understanding this part. If you want to avoid the error, you can avoid hooking up the callback. And if you've specified a callback, not invoking it could be a significant security hole, as we'd end up using the default validation of a security certificate rather than the validation the developer has explicitly requested via the callback.
I don't understand this part either. Can you elaborate?
You mean a capability property, like IsCustomServerCertificateValidationSupported? That's a reasonable request for the future. Thanks. |
Yeah, I get all of your points and agree when it comes to security.
|
@stephentoub @bartonjs feel free to submit a PR to update the release notes / docs to make this more clear. |
How is this supposed to work on OSX? Install some package on OSX? Or there is no way to make it work on OSX? |
I don't think there is any way for this to work on OSX currently (at least I haven't found a way) |
I'm sure there are other ways, but I did:
and then with that library being used:
I can successfully use these features...
|
Fantastic, the export DYLD_LIBRARY_PATH=/usr/local/lib/ was what i was missing! Thanks |
What's the fix for CentOS? |
@jchannon CentOS 6 had a curl-openssl package which would (have) work(ed). The problem is that the default libcurl package on CentOS uses Mozilla NSS as the TLS provider, and we don't have the ability to interpret their certificate pointers. Normal CentOS curl:
Normal Ubuntu curl:
Note the Ubuntu one in this example is Since curl doesn't have their own abstraction of certificates we would have to have support for each of the (currently 8) possible providers. Right now OpenSSL is the only one. Since there's not a CentOS package for that anymore that I can find offhand; that might mean you have to build from source. Or maybe there's just something I'm missing in the CentOS package tree. |
@bartonjs we have it working on CentOS now, what we did was |
However trying to debug my app on OSX I followed the above instructions with
Now when I run
I am less than amused 😠 Also these instructions are the complete opposite of what is shown on www.dot.net
|
https://github.com/dotnet/cli/issues/3964 see this issue @jchannon |
Thanks, the fix buried in there was to run Quite frankly this is shit show and MS need to sort this out. |
Trying to debug a simple http request with osx now results in this error message
The code is:
Yet when I run
The solution to this when debugging is to set the
|
I agree, it would be great if someone could figure out an easy solution. MacOS 10.11.x (El Capitan) makes it harder to change the OpenSSL version that ships with OS. I am hoping that 10.12 (Sierra) has a version of OpenSSL that plays nicer with ASP.NET. /usr/bin/openssl on MacOS 10.11 (El Capitan) Haven't had a chance to install 10.12 beta yet. |
Also, I deploy my Asp.Net core web app to an Azure instance and than I see the error message of
|
With Core 1.1, I run into this issue again on Mac Sierra. Reinstalled with the instructions (OpenSSL 1.0.2j) and the symlinks. The dotnet new command runs fine, but when I use the httpclient:
I used the instructions in other reports to use a openssl-build of curl, and the command line reports doing so. But the dotnet project seems to reference the system version?
libcurl.dylib -> ../Cellar/curl/7.52.1/lib/libcurl.dylib When using DYLD_LIBRARY_PATH things mess up quickly (methods not found etc), and the rpath commands do not seem to help at all. As I understood, things changed in core 1.1 to both support native Apple and OpenSSL. But how do I choose between them? |
@hlogmans The 1.1 release started using Security.framework for hashing, HMAC, and symmetric encryption. Asymmetric cryptography, certificates, and TLS are all still performed by OpenSSL.
|
System.Net.Http.Native.dylib: /usr/lib/libcurl.4.dylib: So that seems quite logical that it targets the wrong one. Next step: how to fix it form me, and how to fix it for everyone... (and thanks for your support @bartonjs) Update: |
@niemyjski Apart from the documentation update, can you create another issue with an api proposal for the API you've mentioned in this comment. The API proposal process information is here |
Is it about the installation instructions on the dot.net site @Priya91? |
@mairaw Yes.. |
It might be possible to bring the libcurl+openssl1.0 workaround back for 2.0. https://github.com/dotnet/corefx/issues/19718 tracks the work. (Client authentication still won't work on macOS with HttpClient, because the bridge only reliably goes one way) |
If you hit this and need the workaround, please go ASAP and vote for the issue dotnet/corefx#19718 which @bartonjs created. Thanks! |
What's the fix for Fedora26? |
FYI getting this on my mac using dotnet core 2.0.2. my mac version: I updated my curl via homebrew and ran through the
As i'm reading through this thread it appears that the issue is with a bug in curl and there is no workaround? |
@jrmacks In .NET Core 2.0 the certificates library and TLS library used on macOS are from Security.framework, there's no longer support on macOS for custom callbacks via libcurl+openssl. And, unfortunately, libcurl+darwinssl (SecureTransport) doesn't support callbacks. |
Thanks @bartonjs for the quick reply. Are there any plans to have parity on mac with this feature? Based on your response I'm assuming it's not possible with the current architecture. |
Any updates on this issue when running on macOS? |
@niemyjski it would be best to not continue discussion on closed issues - we do not monitor them in general. |
They shouldn't be closed if they are still an active issue ;) There are issues when you have this handler registered on macOS... |
@niemyjski, what is it you're concerned is still active? With the default libcurl on macOS, ServerCertificateCustomValidationCallback is simply not supported with arbitrary delegates. However, the issue you originally opened was using a delegate that always returned true, and that has been fully addressed via the DangerousAcceptAnyServerCertificateValidator member that was added in .NET Core 2.0. This also won't be an issue when using the new managed handler implementation that's on a path to ship in 2.1. If you continue to have concerns, please open a different issue. |
What's the 2.1 change you mention? Any docs etc?
…On 3 January 2018 at 13:19, Stephen Toub ***@***.***> wrote:
@niemyjski <https://github.com/niemyjski>, what is it you're concerned is
still active? With the default libcurl on macOS,
ServerCertificateCustomValidationCallback is simply not supported with
arbitrary delegates. However, the issue you originally opened was using a
delegate that always returned true, and that has been fully addressed via
the DangerousAcceptAnyServerCertificateValidator member that was added in
.NET Core 2.0. This also won't be an issue when using the new managed
handler implementation that's on a path to ship in 2.1. If you continue to
have concerns, please open a different issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/dotnet/corefx/issues/9728#issuecomment-355009780>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAGapujo8hBdAJPStLWaGhmUQiVtyQSHks5tG35bgaJpZM4JAdiR>
.
|
It's not done yet. |
Hi Guys I am running dotnet Core 2.0 application on this container (registry.access.redhat.com/dotnet/dotnet-20-rhel7:latest) in linux 7.3, but when login to application and enter password gives me this error - "One or more errors occurred. (The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.28.3").)" Please suggest me any resolution for this issue? Much Appreciated if anyone can help me with this Thanks |
I'm having the same issue on Mac and RHEL 7.4 |
@omajid Is there an optional package that people need on RHEL to get libcurl backed by OpenSSL? I thought it was marked as a dependency for the dotnet package(s)? |
Using 2.1.300-preview1-008174 on MacOSX the issue still occurs
@stephentoub https://github.com/dotnet/corefx/tree/master/src/System.Net.Http/src/System/Net/Http/Managed looks like it os renamed to I was hoping in the 2.1 release.... |
It is in in 2.1 preview1 @evertmulder. But you need to enable it either via app context or via environmental variable. |
@wfurt is it? Executing this (or exporting the env variable) still leads to a stack trace including the CurlHandler...
But changing my test program to use DangerousAcceptAnyServerCertificateValidator, could help until something like https://github.com/dotnet/corefx/issues/18972 is fixed. (custom root certificate authorities) var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
var _httpClient = new HttpClient(handler); |
Sorry about that @evertmulder. It changed after preview1 cut. Please follow notes from https://blogs.msdn.microsoft.com/dotnet/2018/02/27/announcing-net-core-2-1-preview-1/ |
Did you get that working @evertmulder? (just curious) |
@wfurt No, I will try again when the SocketsHttpHandler is available in a preview release. |
@wfurt I run .NET Core stack on Docker for Windows with Kubernetes (Linux container on Windows 10) and got the following exception. I tried to use
|
@thangchung, I'm not sure what that error has to do with this issue. The key part of that message is "System.Net.Sockets.SocketException: Address not available", which means it couldn't resolve |
I just updated my Project to RTM and did testing on Windows and everything worked. I then went to test on OSX 10.11.5 (latest stable everything, dotnet, openssl) and ran into issues very quickly..
I'm getting
The libcurl library in use (7.43.0) and its SSL backend (\"SecureTransport\") do not support custom handling of certificates. A libcurl built with OpenSSL is required.
in stable latest everything on macOS...I narrowed it down to defining a custom validation callback breaks the http client.. I can't even do a
GET
.All the code can be found here: http://github.com/exceptionless/Exceptionless.Net
The text was updated successfully, but these errors were encountered: