Skip to content

Commit cd0f8c1

Browse files
authored
Merge pull request #689 from Icinga:fix/ifw_port_config_icinga_ca
Fix: Icinga CA port handling on installation Fixes Icinga for Windows port handling on installation, which will now use the proper defined port for communicating with the Icinga CA
2 parents 5d7824b + 0f0980d commit cd0f8c1

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1616
* [#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
1717
* [#685](https://github.com/Icinga/icinga-powershell-framework/pull/685) Fixes an issue while trying to stop the JEA process in certain cases, which results in an error during installation but has no other effect on the environment
1818
* [#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
19+
* [#687](https://github.com/Icinga/icinga-powershell-framework/pull/687) Fixes Icinga for Windows port handling on installation, which will now use the proper defined port for communicating with the Icinga CA
1920

2021
### Enhancements
2122

lib/core/icingaagent/installer/Install-IcingaAgentCertificates.psm1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ function Install-IcingaAgentCertificates()
9393
}
9494

9595
if (-Not [string]::IsNullOrEmpty($Endpoint)) {
96+
97+
# In case we use a custom configuration for our CA endpoint server with address and port, ensure we establish
98+
# a connection to this endpoint as well as the port
99+
$ConnectionConfig = Get-IPConfigFromString -IPConfig $Endpoint;
100+
$Endpoint = $ConnectionConfig.address;
101+
if ([string]::IsNullOrEmpty($ConnectionConfig.port) -eq $FALSE) {
102+
$Port = $ConnectionConfig.port;
103+
}
104+
96105
if (-Not (Test-IcingaAgentCertificates -CertDirectory $CertificateDirectory -Hostname $Hostname -TestTrustedParent -Force $Force)) {
97106

98107
Write-IcingaConsoleNotice ([string]::Format('Fetching trusted master certificate from "{0}"', $Endpoint));

lib/core/installer/Start-IcingaForWindowsInstallation.psm1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,18 @@ function Start-IcingaForWindowsInstallation()
199199
Install-IcingaAgentBaseFeatures;
200200
Write-IcingaAgentApiConfig -Port $IcingaPort;
201201

202-
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaPort -CACert $CertificateCAFile -Ticket $CertificateTicket -Force:$ForceCertificateGen) -eq $FALSE) {
202+
# Fixes an issue with the local Icinga for Windows listen port and the defined ports for communicating with the Icinga Parent/CA Nodes
203+
# This will check if we provided a custom port for the endpoints and use this one instead of the configured listen port if Icinga for Windows
204+
$IcingaCAPort = $IcingaPort;
205+
206+
if ($null -ne $IcingaParentAddresses -And $IcingaParentAddresses.Count -ne 0) {
207+
$ConnectionConfig = Get-IPConfigFromString -IPConfig ($IcingaParentAddresses[0]);
208+
if ($null -ne $ConnectionConfig -And $null -ne $ConnectionConfig.Port -And [string]::IsNullOrEmpty($ConnectionConfig.Port) -eq $FALSE) {
209+
$IcingaCAPort = $ConnectionConfig.Port;
210+
}
211+
}
212+
213+
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaCAPort -CACert $CertificateCAFile -Ticket $CertificateTicket -Force:$ForceCertificateGen) -eq $FALSE) {
203214
Disable-IcingaAgentFeature 'api';
204215
Write-IcingaConsoleWarning `
205216
-Message '{0}{1}{2}{3}{4}' `

0 commit comments

Comments
 (0)