Infoblox-Classy icon indicating copy to clipboard operation
Infoblox-Classy copied to clipboard

Add support for SkipSslValidation

Open Plork opened this issue 8 years ago • 1 comments

By default Infoblox has a self signed certificate. There is no way to use the powershell cmdlets with this untrusted certificate.

Test-IBGridmaster : Unable to connect to Infoblox device gm.local.  Error code:  System.Net.WebException: The underlying connection was close d: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote ce rtificate is invalid according to the validation procedure.
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
At line:1 char:1
+ Test-IBGridmaster -Gridmaster gm.local
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-IBGridmaster

Maybe this is an option? https://www.briantist.com/errors/could-not-establish-trust-relationship-for-the-ssltls-secure-channel/

or this

add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Plork avatar May 12 '17 08:05 Plork

yeah I actually use that bottom snippet in the pester tests. First thought, I could possibly add a "-IgnoreCerts" parameter to both test-ibgridmaster and new-ibwebsession. I think that should carry over to all the other functions. I'll do some testing and see how that works.

murrahjm avatar May 16 '17 12:05 murrahjm