mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 23:29:40 -05:00
Also re-arranges web content by using old content from lib/web into lib/webserver, while new lib/web contains the proxy configuration. Fixes #19
23 lines
956 B
PowerShell
23 lines
956 B
PowerShell
function Enable-IcingaUntrustedCertificateValidation()
|
|
{
|
|
try {
|
|
# There is no other way as to use C# for this specific
|
|
# case to configure the certificate validation check
|
|
Add-Type @"
|
|
using System.Net;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
public class IcingaUntrustedCertificateValidation : ICertificatePolicy {
|
|
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
|
|
return true;
|
|
}
|
|
}
|
|
"@
|
|
|
|
[System.Net.ServicePointManager]::CertificatePolicy = New-Object IcingaUntrustedCertificateValidation;
|
|
|
|
Write-IcingaConsoleNotice 'Successfully enabled untrusted certificate validation for this shell instance';
|
|
} catch {
|
|
Write-IcingaConsoleError -Message 'Failed to enable untrusted certificate policy: {0}' -Objects $_.Exception.Message;
|
|
}
|
|
}
|