Skip to content

Commit 3c053ec

Browse files
authored
Merge pull request #495 from Icinga:feature/check_icinga_agent_certificate_sign_status
Feature: Check Icinga Agent certificate sign status Adds feature to check the sign status for the local Icinga Agent certificate and notifying the user, in case the certificate is not yet signed by the Icinga CA.
2 parents e6d8207 + a901514 commit 3c053ec

File tree

6 files changed

+37
-2
lines changed

6 files changed

+37
-2
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2222
### Enhancements
2323

2424
* [#469](https://github.com/Icinga/icinga-powershell-framework/pull/469) Improves plugin doc generator to allow multi-lines in code examples and updates plugin overview as table, adding a short description on what the plugin is for
25+
* [#495](https://github.com/Icinga/icinga-powershell-framework/pull/495) Adds feature to check the sign status for the local Icinga Agent certificate and notifying the user, in case the certificate is not yet signed by the Icinga CA
2526

2627
## 1.8.0 (2022-02-08)
2728

doc/300-Knowledge-Base.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ For this reason you will find a list of Icinga knowledge base entries below. Ent
2020
| [IWKB000010](knowledgebase/IWKB000010.md) | The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details Error: The term 'Use-Icinga' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. |
2121
| [IWKB000011](knowledgebase/IWKB000011.md) | The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details Error: The term 'Use-Icinga' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. |
2222
| [IWKB000012](knowledgebase/IWKB000012.md) | Icinga for Windows cannot be used with Microsoft Defender: `Windows Defender Antivirus has detected malware or other potentially unwanted software` |
23+
| [IWKB000013](knowledgebase/IWKB000013.md) | The local Icinga Agent certificate seems not to be signed by our Icinga CA yet. Using this certificate for the REST-Api as example might not work yet. Please check the state of the certificate and complete the signing process if required |
25 KB
Loading

doc/knowledgebase/IWKB000013.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Icinga Knowledge Base - IWKB000013
2+
3+
## Short Message
4+
5+
The local Icinga Agent certificate seems not to be signed by our Icinga CA yet. Using this certificate for the REST-Api as example might not work yet. Please check the state of the certificate and complete the signing process if required
6+
7+
## Example Exception
8+
9+
![EventLog Defender](../images/04_knowledgebase/IWKB000013/01_Cert_Not_Signed.png)
10+
11+
## Reason
12+
13+
This warning will occur, whenever Icinga for Windows is fetching the Icinga Agents local certificate, for compiling the `IcingaForWindows.pfx` certificate or by accessing the certificate for dynamically creating the REST-Api TLS certificate.
14+
15+
## Solution
16+
17+
To resolve this issue, you will have to make sure the certificate is signed by the `Icinga CA` by either manually signing the certificate on the `CA master` with `icinga2 ca sign <Fingerprint>` or by using a ticket during the setup process for signing the certificate right away.

lib/core/icingaagent/getters/Get-IcingaAgentHostCertificate.psm1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ function Get-IcingaAgentHostCertificate()
2727

2828
$Certificate = New-Object Security.Cryptography.X509Certificates.X509Certificate2 $CertPath;
2929

30+
if ($null -ne $Certificate) {
31+
if ($Certificate.Issuer.ToLower() -eq ([string]::Format('cn={0}', $Hostname).ToLower())) {
32+
Write-IcingaConsoleWarning `
33+
-Message 'The Icinga Agent certificate "{0}" seems not to be signed by our Icinga CA yet. Using this certificate for the REST-Api as example might not work. Please check the state of the certificate and complete the signing process if required. [IWKB000013]' `
34+
-Objects $CertPath;
35+
36+
Write-IcingaEventMessage -EventId 1506 -Namespace 'Framework' -Objects $CertPath;
37+
}
38+
}
39+
3040
return @{
3141
'CertFile' = $CertPath;
3242
'Subject' = $Certificate.Subject;

lib/core/logging/Icinga_EventLog_Enums.psm1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ if ($null -eq $IcingaEventLogEnums -Or $IcingaEventLogEnums.ContainsKey('Framewo
101101
1505 = @{
102102
'EntryType' = 'Warning';
103103
'Message' = 'Icinga for Windows JEA context not available';
104-
'Details' = 'The Icinga for Windows JEA session is no longer available and is attempted to be restarted on the system. This could have either happenend due to a crash or a user action, like restarting the WinRM service.';
104+
'Details' = 'The Icinga for Windows JEA session is no longer available and is attempted to be restarted on the system. This could have either happened due to a crash or a user action, like restarting the WinRM service.';
105105
'EventId' = 1505;
106106
};
107+
1506 = @{
108+
'EntryType' = 'Error';
109+
'Message' = 'Icinga Agent certificate not signed by Icinga CA';
110+
'Details' = 'The local Icinga Agent certificate seems not to be signed by our Icinga CA yet. Using this certificate for the REST-Api as example might not work yet. Please check the state of the certificate and complete the signing process if required [IWKB000013]';
111+
'EventId' = 1506;
112+
};
107113
1550 = @{
108114
'EntryType' = 'Error';
109115
'Message' = 'Unsupported web authentication used';
@@ -113,7 +119,7 @@ if ($null -eq $IcingaEventLogEnums -Or $IcingaEventLogEnums.ContainsKey('Framewo
113119
1551 = @{
114120
'EntryType' = 'Warning';
115121
'Message' = 'Invalid authentication credentials provided';
116-
'Details' = 'A web request for a client was rejected because of invalid formated base64 encoded credentials.';
122+
'Details' = 'A web request for a client was rejected because of invalid formatted base64 encoded credentials.';
117123
'EventId' = 1551;
118124
};
119125
1552 = @{

0 commit comments

Comments
 (0)