VMware: PowerNSX on Mac Invoke-nsxwebrequest unknown exception

Blarg!
Summary:
All was well and dandy until I tried to actually "do" something.  I was trying to create a new logical switch (New-NSXLogicalSwitch) when these errors reared their ugly head:
https://github.com/vmware/powernsx/issues/493
One or more errors occurred. (The handler does not support custom handling of certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").) ---> System.PlatformNotSupportedException: The handler does not support custom handling of certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").

Workaround:
Windows w/ full Powershell does not have these issues.  Have yet to see if it is a thing specific to Powershell Core.  So use it if you can.

If you don't have a Windows box handy, you can modify the PowerNSX.psm module file to get around this error.  I'm unsure if it can become a permanent solution, but it effectively accomplishes the same thing as the current httpclienthandler.

Location of PowerNSX.psm file on Mac:
/usr/local/share/powershell/Modules/PowerNSX/<versionnumber>/PowerNSX.psm1

You need to modify line 105 from this:
ServerCertificateCustomValidationCallback = delegate { return true; };

To this:
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

*One line and case sensitive, must be verbatim.

Comments

Unknown said…
Thanks Chris - I will add a link to this in the PowerNSX issue
Anonymous said…
~/.local

Popular posts from this blog

NSX-T: Release associated invalid node ID from certificate

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.