Fixes certutil error handling and message output in case the icingaforwindows.pfx could not be created

This commit is contained in:
Lord Hepipud 2024-02-28 15:41:05 +01:00
parent 173161cd54
commit 324aea052a
2 changed files with 5 additions and 2 deletions

View file

@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes
* [#683](https://github.com/Icinga/icinga-powershell-framework/pull/683) Fixes JEA installer to exclude domain from user name length check, which can easily exceed the Windows 20 digits username limit
* [#686](https://github.com/Icinga/icinga-powershell-framework/pull/686) Fixes certutil error handling and message output in case the icingaforwindows.pfx could not be created
### Enhancements

View file

@ -44,14 +44,16 @@ function ConvertTo-IcingaX509Certificate()
[string]::Format(
'Certutil merge request has been completed. Certutil message:{0}{0}{1}',
(New-IcingaNewLine),
$CertUtilOutput
($CertUtilOutput | Out-String)
)
);
# If no target file exists afterwards (a valid PFX certificate)
# then throw an exception
if (-Not (Test-Path $TargetFile)) {
throw 'The specified/created certificate file could not be found.';
[string]$ErrMessage = [string]::Format('Unable to create the Icinga for Windows certificate file "icingaforwindows.pfx". Certutil output:{0}{1}', (New-IcingaNewLine), ($CertUtilOutput | Out-String));
Write-IcingaConsoleError $ErrMessage;
throw $ErrMessage;
}
# Now load the actual certificate from the path