You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On CentOS Powershell uses the system libcurl that does not support custom SSL certificate validation #2511
This is similar to #2211 but for CentOS. This is probably still an issue with dotnet but maybe powershell can patch it in a similar way as the OS X patch. I haven't found a workaround yet.
An error telling you that there is no runtime context on the thread. Which means the execution reached the validation script block.
Actual behavior
Error:
Exception calling "GetResult" with "0" argument(s): "The libcurl library in
use (7.29.0) and its SSL backend ("NSS/3.19.1 Basic ECC") do not support
custom handling of certificates. A libcurl built with OpenSSL is required."
At line:1 char:1
+ $client.GetStringAsync("https://google.com").GetAwaiter().GetResult()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : PlatformNotSupportedException
Exporting LD_LIBRARY_PATH might redirect other executables (e.g. python) to use the new dynamic library. That might be breaking some of them. To limit the scope of the export, one option is to create a bash script that would act as a shortcut for launching powershell.
Example shortcut script:
We are moving back to .NET Core 2.0.0-preview1 via PR #4026 due to regressions in the latest .NET Core 2.0.0-preview2 (dotnet/corefx#21095). So re-open this bug.
and hit this issue passing a client cert:
Invoke-webrequest -Method $method -Uri $protocol$server$resource -Header $header -certificate $certs -UseBasicParsing -Verbose
Leigh Kennedy (@ljckennedy) it is the same issue. cert configurations of CentOS and macOS use something other than libcurl-ssl and as a result the underlying CoreFX cannot perform certificate based authentication.
Is this only fixed when using Invoke-WebRequest or should the hack using the callback of the ServicePointManager still work?
I'm trying to use the old hack because of code that uses System.Net.WebClient.DownloadString.
I have just updated everything (powershell and curl) using homebrew and still get the error:
System.Net.WebException: An exception occurred during a WebClient request. ---> System.PlatformNotSuppor
tedException: The handler does not support custom handling of certificates with this combination of libc
url (7.57.0) and its SSL backend ("OpenSSL/1.0.2n").
at System.Net.HttpWebRequest.GetResponse()
at System.Net.WebClient.GetWebResponse(WebRequest request)
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
PS >$PSVersionTable
Name Value
---------
PSVersion 6.0.0-rc
PSEdition Core
GitCommitId v6.0.0-rc
OS Darwin 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 2918:27:05 PDT 2017; root:xnu-4570.20.62~...
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
ServicePointManager is not sup[ported by Invoke-WebRequest and Invoke-RestMethod on PowerShell Core as they now use the HttpClient API which does not honor any settings in ServicePointManager.
On macOS Certificate Authentication and Certificate Validation is currently not supported by any API due to limitations between Apple's Security.Framework and CoreFX (.NET Core). This is being tracked on #4650
Still getting this on CentOS 7 when using Invoke-RestMethod -Certificate $cert...
Error:
Invoke-RestMethod : The handler does not support client authentication certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.34")
Activity
joeyaiello commentedon Oct 25, 2016
Do you know if CentOS ships--inbox or via yum--a libcurl built with libssl?
atanasa commentedon Oct 26, 2016
I couldn't find one. One of my users found one here:
http://ftp.riken.jp/Linux/cern/centos/7/cern/x86_64/repoview/letter_l.group.html
but that does not look official.
The workaround is to download the libcurl-openssl package from there, then install it with yum localinstall and run
to redirect powershell to discover the new dynamic library.
atanasa commentedon Oct 26, 2016
Exporting LD_LIBRARY_PATH might redirect other executables (e.g. python) to use the new dynamic library. That might be breaking some of them. To limit the scope of the export, one option is to create a bash script that would act as a shortcut for launching powershell.
Example shortcut script:
I tried setting the env variable inside powershell instead of bash, but for some reason that didn't affect the dynamic library resolution.
joeyaiello commentedon Oct 28, 2016
Just for reference, this looks like the upstream CoreFX bug: dotnet/corefx/issues/10146
ryangurazov commentedon Feb 22, 2017
Hi, please provide an update on the issue.
Very much needed and your effort is very much appreciated.
Thank you.
getSurreal commentedon Mar 1, 2017
I installed libcurl-openssl from rpm.pbone.net and overwrote the existing libcurl and was able to make a connection with VMware's PowerCLI Core.
mv /opt/shibboleth/lib64/libcurl.so.4.3.0 /usr/lib64TravisEz13 commentedon Mar 6, 2017
Looks like we are going to face the same issue on OpenSUSE (at least 13.2)
joeyaiello commentedon Mar 6, 2017
Upstream issue has been moved to dotnet/wcf/issues/1792.
Rinat Yangurazov (@ryangurazov) getSurreal we're really blocked without the fix to that issue.
17 remaining items
daxian-dbw commentedon Jun 14, 2017
Verified that this is fixed by PR #3887
daxian-dbw commentedon Jun 15, 2017
We are moving back to .NET Core 2.0.0-preview1 via PR #4026 due to regressions in the latest .NET Core 2.0.0-preview2 (dotnet/corefx#21095). So re-open this bug.
daxian-dbw commentedon Jun 30, 2017
We moved to .NET Core 2.0.0-preview3 via PR #4144. I have verified that this issue is fixed.
ljckennedy commentedon Oct 26, 2017
Just installed the latest as reference here:
https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#centos-7
and hit this issue passing a client cert:
Invoke-webrequest -Method $method -Uri $protocol$server$resource -Header $header -certificate $certs -UseBasicParsing -Verbose
Is this a different issue?
NB: No issue on ubuntu..
markekraus commentedon Oct 26, 2017
Leigh Kennedy (@ljckennedy) it is the same issue. cert configurations of CentOS and macOS use something other than libcurl-ssl and as a result the underlying CoreFX cannot perform certificate based authentication.
ljckennedy commentedon Oct 26, 2017
Ok. I assumed marked as 'Closed' meant it was fixed.
anderssonjohan commentedon Dec 13, 2017
Is this only fixed when using Invoke-WebRequest or should the hack using the callback of the ServicePointManager still work?
I'm trying to use the old hack because of code that uses System.Net.WebClient.DownloadString.
I have just updated everything (powershell and curl) using homebrew and still get the error:
markekraus commentedon Dec 13, 2017
ServicePointManageris not sup[ported byInvoke-WebRequestandInvoke-RestMethodon PowerShell Core as they now use theHttpClientAPI which does not honor any settings inServicePointManager.On macOS Certificate Authentication and Certificate Validation is currently not supported by any API due to limitations between Apple's Security.Framework and CoreFX (.NET Core). This is being tracked on #4650
markekraus commentedon Dec 13, 2017
I should note that
-SkipCertificateCheckdoes work on macOS and is the only available option.liger1978 commentedon Jul 25, 2018
Still getting this on CentOS 7 when using
Invoke-RestMethod -Certificate $cert...Error:
liger1978 commentedon Jul 25, 2018
Forget it, installing powershell-preview (
6.1.0~preview.4-1.rhel.7) fixes this.