diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index f23eaa4..9ebd455 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -13,6 +13,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes +* [#814](https://github.com/Icinga/icinga-powershell-framework/pull/814) Fixes random chars function to truly generate unpredictable character sequences and to replace `Get-Random` which is not entirely secure +* [#815](https://github.com/Icinga/icinga-powershell-framework/pull/815) Fixes a possible crash for `Test-IcingaAddTypeExist`, causing the Icinga for Windows installation to fail when third party components are checked which are malfunctioning +* [#816](https://github.com/Icinga/icinga-powershell-framework/issues/816) Fixes plugin execution error while using any `%IfNotMatch`/`%IfNotLike`/`%IfMatch`/`%IfLike` check function for strings containing special characters like `:` +* [#829](https://github.com/Icinga/icinga-powershell-framework/pull/829) Fixes `Set-IcingaCacheData` to properly remove cache files in case `$null` is passed as value * [#833](https://github.com/Icinga/icinga-powershell-framework/issues/833) Fixes registry lookup for Icinga Agent installation to check if the required `DisplayName` attribute is defined before checking * [#834](https://github.com/Icinga/icinga-powershell-framework/issues/834) Fixes security catalog compilation error on non-english Windows versions, while properly skipping checks on system SID's and improves security by always adding the `SeDenyNetworkLogonRight` and `SeDenyInteractiveLogonRight` privilege section for the JEA user SID * [#835](https://github.com/Icinga/icinga-powershell-framework/pull/835) Fixes JEA compiler to always enforce a rebuild of the Framework to ensure integrity of JEA profiles @@ -25,16 +29,6 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic * [#838](https://github.com/Icinga/icinga-powershell-framework/pull/838) Enhances Icinga for Windows to never load and user PowerShell profiles * [#841](https://github.com/Icinga/icinga-powershell-framework/pull/841) Adds new [INFO] state for notice and un-checked monitoring objects -## 1.13.4 (tbd) - -[Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/42) - -### Bugfixes - -* [#814](https://github.com/Icinga/icinga-powershell-framework/pull/814) Fixes random chars function to truly generate unpredictable character sequences and to replace `Get-Random` which is not entirely secure -* [#815](https://github.com/Icinga/icinga-powershell-framework/pull/815) Fixes a possible crash for `Test-IcingaAddTypeExist`, causing the Icinga for Windows installation to fail when third party components are checked which are malfunctioning -* [#829](https://github.com/Icinga/icinga-powershell-framework/pull/829) Fixes `Set-IcingaCacheData` to properly remove cache files in case `$null` is passed as value - ## 1.13.3 (2025-05-08) [Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/39) diff --git a/lib/core/tools/Convert-IcingaPluginThresholds.psm1 b/lib/core/tools/Convert-IcingaPluginThresholds.psm1 index 76fc755..d781611 100644 --- a/lib/core/tools/Convert-IcingaPluginThresholds.psm1 +++ b/lib/core/tools/Convert-IcingaPluginThresholds.psm1 @@ -28,6 +28,12 @@ .FUNCTIONALITY Converts values with units to the lowest unit of this category. Accepts Icinga Thresholds. +.PARAMETER Threshold + The threshold value to convert. Supports Icinga plugin threshold + syntax. +.PARAMETER RawValue + If set, the function will return the raw value without any conversion. + This is required for match/not match checks as example .EXAMPLE PS>Convert-IcingaPluginThresholds -Threshold '20d'; @@ -128,7 +134,8 @@ function Convert-IcingaPluginThresholds() { param ( - [string]$Threshold = $null + [string]$Threshold = $null, + [switch]$RawValue = $false ); [hashtable]$RetValue = @{ @@ -142,7 +149,10 @@ function Convert-IcingaPluginThresholds() 'IsDateTime' = $FALSE; }; - if ([string]::IsNullOrEmpty($Threshold)) { + # Always ensure Value is set, because we just want the raw value + if ([string]::IsNullOrEmpty($Threshold) -or $RawValue) { + $RetValue.Value = $Threshold; + return $RetValue; } diff --git a/lib/core/windows/Get-IcingaRandomChars.psm1 b/lib/core/windows/Get-IcingaRandomChars.psm1 index 1bc97b1..a495751 100644 --- a/lib/core/windows/Get-IcingaRandomChars.psm1 +++ b/lib/core/windows/Get-IcingaRandomChars.psm1 @@ -21,7 +21,7 @@ function Get-IcingaRandomChars() # Generate random bytes $CryptoProvider.GetBytes($ByteValue); $RandomNumber = [BitConverter]::ToUInt32($ByteValue, 0); - # Ensure the random number is within the valid range to avoid maximum security + # Ensure the random number is within the valid range to ensure maximum security } while ($RandomNumber -ge $maxValid); # Calculate the index for the symbol array diff --git a/lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1 b/lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1 index 998d289..af2a32f 100644 --- a/lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1 +++ b/lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1 @@ -103,13 +103,20 @@ function Compare-IcingaPluginThresholds() try { # Fix possible numeric value comparison issues - $TestInput = Test-IcingaDecimal $InputValue; - $BaseInput = Test-IcingaDecimal $BaseValue; - $MoTData = @{ + [bool]$RawValue = $false; + $TestInput = Test-IcingaDecimal $InputValue; + $BaseInput = Test-IcingaDecimal $BaseValue; + $MoTData = @{ 'Label' = $PerfDataLabel; 'Interval' = $TimeInterval; }; + # Ensure we never do threshold conversions for match/not match checks + # This ensures that string values are properly compared to each other + if ($Matches -or $NotMatches) { + $RawValue = $true; + } + # Ensure we do not include our checks for which we do not write any performance data # Metrics over time will not work for those, as the metrics are not stored. # There just set the variable to null which means they won't be processed @@ -130,9 +137,9 @@ function Compare-IcingaPluginThresholds() $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Message' -Value ''; $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'IsOK' -Value $FALSE; $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'HasError' -Value $FALSE; - $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Threshold' -Value (Convert-IcingaPluginThresholds -Threshold $Threshold); - $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Minimum' -Value (Convert-IcingaPluginThresholds -Threshold $Minium); - $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Maximum' -Value (Convert-IcingaPluginThresholds -Threshold $Maximum); + $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Threshold' -Value (Convert-IcingaPluginThresholds -Threshold $Threshold -RawValue:$RawValue); + $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Minimum' -Value (Convert-IcingaPluginThresholds -Threshold $Minium -RawValue:$RawValue); + $IcingaThresholds | Add-Member -MemberType NoteProperty -Name 'Maximum' -Value (Convert-IcingaPluginThresholds -Threshold $Maximum -RawValue:$RawValue); if ($TestInput.Decimal) { $ConvertedValue = Convert-IcingaPluginThresholds -Threshold ([string]::Format('{0}{1}', $InputValue, $Unit));