Merge pull request #245 from haxtibal/bugfix/find_pfx_cert

Fix loading certificate from .pfx file
This commit is contained in:
Lord Hepipud 2021-05-25 13:08:55 +02:00 committed by GitHub
commit 221973a964
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,8 +10,7 @@ function Get-IcingaSSLCertForSocket()
# to get a proper certificate # to get a proper certificate
if ([string]::IsNullOrEmpty($CertFile) -eq $FALSE) { if ([string]::IsNullOrEmpty($CertFile) -eq $FALSE) {
if ((Test-Path $CertFile)) { if ((Test-Path $CertFile)) {
$FileType = Get-Item -Path $CertFile; if ([IO.Path]::GetExtension($CertFile) -eq '.pfx') {
if ($FileType -eq '.pfx') {
return (New-Object Security.Cryptography.X509Certificates.X509Certificate2 $CertFile); return (New-Object Security.Cryptography.X509Certificates.X509Certificate2 $CertFile);
} else { } else {
return ConvertTo-IcingaX509Certificate -CertFile $CertFile; return ConvertTo-IcingaX509Certificate -CertFile $CertFile;