From 8076a373f5088ced416eec753f38364d2ff4a61f Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Thu, 13 Aug 2020 15:45:13 +0200 Subject: [PATCH] Adds support for SecureString handling on plugins Fixes #98 --- doc/31-Changelog.md | 1 + lib/core/tools/Get-IcingaCheckCommandConfig.psm1 | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index ba78d66..2391a2e 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -33,6 +33,7 @@ Check Command configuration generated by Icinga for Windows 1.2.0 require Icinga * [#88](https://github.com/Icinga/icinga-powershell-framework/issues/88) Adds Start/Stop timer functionality for performance analysis * [#94](https://github.com/Icinga/icinga-powershell-framework/issues/94) Adds `Namespace` argument for Get-IcingaWindowsInformation for additional filtering * [#95](https://github.com/Icinga/icinga-powershell-framework/issues/95) Improves error handling for issues by using `Use-Icinga` initialising or by calling plugins which are not installed +* [#98](https://github.com/Icinga/icinga-powershell-framework/issues/98) Adds support for SecureString as password argument on config generation ### Bugfixes diff --git a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 index 76663ab..8b75a4b 100644 --- a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 +++ b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 @@ -175,6 +175,19 @@ function Get-IcingaCheckCommandConfig() 'order' = $Order; } ); + } elseif ($parameter.type.name -eq 'SecureString') { + # Convert out input string as SecureString + $Basket.Command[$Data.Name].arguments.Add( + [string]::Format('-{0}', $parameter.Name), @{ + 'value' = ( + [string]::Format( + "(ConvertTo-IcingaSecureString '{0}')", + $IcingaCustomVariable + ) + ) + 'order' = $Order; + } + ); } else { # Default to Object $Basket.Command[$Data.Name].arguments.Add(