From 7fa59782328485c4b1412d232689c0d90107e46a Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 30 Aug 2021 09:05:38 -0400 Subject: [PATCH] fixed bool composite issue --- CHANGELOG.md | 1 + source/DSCResources/Resources/Vsphere.VmHostService.ps1 | 5 ++++- .../DSCResources/Resources/windows.UserRightsAssignment.ps1 | 5 ++++- source/DSCResources/Resources/windows.WindowsEventLog.ps1 | 5 ++++- source/Module/Rule.Permission/PermissionRule.psm1 | 2 +- source/Module/Rule.UserRight/UserRightRule.psm1 | 2 +- source/Module/Rule.VsphereService/VsphereServiceRule.psm1 | 2 +- source/Module/Rule.WinEventLog/WinEventLogRule.psm1 | 2 +- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8c3b081..86e7dfb31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] * Fixed: Windows Server 2019 V2R1 V-205763 generating an exception [#827](https://github.com/microsoft/PowerStig/issues/827) +* Fixed: PowerSTIG should honor Boolean with all composite resources [#969](https://github.com/microsoft/PowerStig/issues/969) ## [4.10.0] - 2021-08-20 diff --git a/source/DSCResources/Resources/Vsphere.VmHostService.ps1 b/source/DSCResources/Resources/Vsphere.VmHostService.ps1 index dc8530ab4..6c87e78ce 100644 --- a/source/DSCResources/Resources/Vsphere.VmHostService.ps1 +++ b/source/DSCResources/Resources/Vsphere.VmHostService.ps1 @@ -5,12 +5,15 @@ $rules = $stig.RuleList | Select-Rule -Type 'VsphereServiceRule' foreach ($rule in $rules) { + $ruleRunning = $null + [void][bool]::TryParse($rule.Running, [ref] $ruleRunning) + VmHostService (Get-ResourceTitle -Rule $rule) { Name = $HostIP Server = $ServerIP Credential = $Credential - Running = $rule.Running + Running = $ruleRunning Key = $rule.Key Policy = $rule.Policy } diff --git a/source/DSCResources/Resources/windows.UserRightsAssignment.ps1 b/source/DSCResources/Resources/windows.UserRightsAssignment.ps1 index 1c0737ea9..948d861f1 100644 --- a/source/DSCResources/Resources/windows.UserRightsAssignment.ps1 +++ b/source/DSCResources/Resources/windows.UserRightsAssignment.ps1 @@ -64,10 +64,13 @@ foreach ($rule in $rules) } } + $ruleForce = $null + [void][bool]::TryParse($rule.Force, [ref] $ruleForce) + UserRightsAssignment (Get-ResourceTitle -Rule $rule) { Policy = ($rule.DisplayName -replace " ", "_") Identity = $identityList - Force = [bool] $rule.Force + Force = $ruleForce } } diff --git a/source/DSCResources/Resources/windows.WindowsEventLog.ps1 b/source/DSCResources/Resources/windows.WindowsEventLog.ps1 index 7c4446b42..402eb86dd 100644 --- a/source/DSCResources/Resources/windows.WindowsEventLog.ps1 +++ b/source/DSCResources/Resources/windows.WindowsEventLog.ps1 @@ -5,9 +5,12 @@ $rules = $stig.RuleList | Select-Rule -Type WinEventLogRule foreach ( $rule in $rules ) { + $ruleIsEnabled = $null + [void][bool]::TryParse($rule.IsEnabled, [ref] $ruleIsEnabled) + WindowsEventLog (Get-ResourceTitle -Rule $rule) { LogName = $rule.LogName - IsEnabled = [boolean]$($rule.IsEnabled) + IsEnabled = $ruleIsEnabled } } diff --git a/source/Module/Rule.Permission/PermissionRule.psm1 b/source/Module/Rule.Permission/PermissionRule.psm1 index 5d4b74ca1..93f427090 100644 --- a/source/Module/Rule.Permission/PermissionRule.psm1 +++ b/source/Module/Rule.Permission/PermissionRule.psm1 @@ -20,7 +20,7 @@ class PermissionRule : Rule { [string] $Path [object[]] $AccessControlEntry <#(ExceptionValue)#> - [bool] $Force + [string] $Force <# .SYNOPSIS diff --git a/source/Module/Rule.UserRight/UserRightRule.psm1 b/source/Module/Rule.UserRight/UserRightRule.psm1 index 33e468097..cbca0bd23 100644 --- a/source/Module/Rule.UserRight/UserRightRule.psm1 +++ b/source/Module/Rule.UserRight/UserRightRule.psm1 @@ -23,7 +23,7 @@ class UserRightRule : Rule [ValidateNotNullOrEmpty()] [string] $DisplayName [ValidateNotNullOrEmpty()] [string] $Constant [ValidateNotNullOrEmpty()] [string] $Identity <#(ExceptionValue)#> - [bool] $Force = $false + [string] $Force = $false <# .SYNOPSIS diff --git a/source/Module/Rule.VsphereService/VsphereServiceRule.psm1 b/source/Module/Rule.VsphereService/VsphereServiceRule.psm1 index 801dd205b..20c61e204 100644 --- a/source/Module/Rule.VsphereService/VsphereServiceRule.psm1 +++ b/source/Module/Rule.VsphereService/VsphereServiceRule.psm1 @@ -20,7 +20,7 @@ class VsphereServiceRule : Rule { [string] $Key [string] $Policy - [bool] $Running + [sring] $Running <# .SYNOPSIS diff --git a/source/Module/Rule.WinEventLog/WinEventLogRule.psm1 b/source/Module/Rule.WinEventLog/WinEventLogRule.psm1 index 5ae14d320..71f2c2571 100644 --- a/source/Module/Rule.WinEventLog/WinEventLogRule.psm1 +++ b/source/Module/Rule.WinEventLog/WinEventLogRule.psm1 @@ -17,7 +17,7 @@ using module .\..\Rule\Rule.psm1 class WinEventLogRule : Rule { [string] $LogName - [bool] $IsEnabled <#(ExceptionValue)#> + [string] $IsEnabled <#(ExceptionValue)#> <# .SYNOPSIS