From c8233ab57243902ef7a2af7222765e2dd03c2707 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:36:39 +0200 Subject: [PATCH] Add Set-NetboxUnstrustedSSL for disable SSL chain test (for PS 5.0 From PowerAruba/FortiPwoer Module :) --- Functions/Setup/Set-NetboxUnstrustedSSL.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Functions/Setup/Set-NetboxUnstrustedSSL.ps1 diff --git a/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 new file mode 100644 index 0000000..e118d1c --- /dev/null +++ b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 @@ -0,0 +1,19 @@ +Function Set-NetboxUntrustedSSL { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessforStateChangingFunctions", "")] + Param( ) + # Hack for allowing untrusted SSL certs with https connections + Add-Type -TypeDefinition @" + 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 -TypeName TrustAllCertsPolicy + +} \ No newline at end of file