Skip to content

On OS X powershell loads the system libcurl which fails custom SSL certificate validation #2211

Closed
@atanasa

Description

@atanasa

Steps to reproduce

Install powershell
Run any code/cmdlet that tries to validate ssl certificates through HttpClientHandler.ServerCertificateCustomValidationCallback

Expected behavior

Certificates are validated

Actual behavior

Error:
"One or more errors occurred. (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.)"

Environment data

> $PSVersionTable

Name                           Value                                           
----                           -----                                           
PSVersion                      6.0.0-alpha                                     
PSEdition                      Core                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                         
BuildVersion                   3.0.0.0                                         
GitCommitId                    v6.0.0-alpha.9                                  
CLRVersion                                                                     
WSManStackVersion              3.0                                             
PSRemotingProtocolVersion      2.3                                             
SerializationVersion           1.1.0.1 

The output of

otool -L /usr/local/microsoft/powershell/6.0.0-alpha.9/System.Net.Http.Native.dylib
/usr/local/microsoft/powershell/6.0.0-alpha.9/System.Net.Http.Native.dylib:
    @rpath/System.Net.Http.Native.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 8.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

Note the path where libcurl is being loaded from.

If I manually patch it by running:

brew install curl --with-openssl
sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib /usr/local/microsoft/powershell/6.0.0-alpha.9/System.Net.Http.Native.dylib

Then it is ok.

This bug is more for corefx, but until it is fixed there it would be good to have some workaround for powershell.

cc @ffeldhaus

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions