Self Contained Deployments throw exception when setting custom SSL certificate handlers
See original GitHub issueSteps to reproduce
Within a .Net Core application running on Centos7/RHEL7 with the distribution standard libcurl installed, create an SSL session using e.g. WebClient and set a custom ServerCertificateValidationCallback, i.e.
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
Expected behavior
This should set a custom certificate validation callback and not raise an exception. (I.e. it should behave identically to a framework dependent build, and not vary in behavior depending on the specific linux distribution in use).
Actual behavior
On a Centos/RHEL7 machine, where libcurl is built against NSS instead of OpenSSL, an SCD build will throw System.PlatformNotSupportedException, i.e.:
Unhandled Exception: System.Net.WebException: An exception occurred during a WebClient request. —> System.PlatformNotSupportedException: The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend (“NSS/3.34”).
A framework dependent build will work just fine on the same machine. (On other distributions e.g. Ubuntu, where the system libcurl is built against OpenSSL, the self contained build will work correctly).
This has been demonstrated with both .Net Core 2.0 and 2.1.0-rc1
Environment data
dotnet --info
output:
Host (useful for support): Version: 2.1.0-rc1 Commit: eb9bc92051
.NET Core SDKs installed: No SDKs were found.
.NET Core runtimes installed: Microsoft.NETCore.App 2.1.0-rc1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thank you both for your help; I can confirm that a self contained build using the 2.1 release works perfectly. Happy for the issue to be closed.
I am going to close this issue since the dependency on the library is gone in 2.1 and the issue is already being tracked for 2.0.
Let me know if we should leave it open for some reason.