dsccommunity / SChannelDsc

MIT License
12 stars 6 forks source link

SChannelSettings: `Test-TargetResource` always fails if current state only defined one `WinHttpDefaultSecureProtocols` #28

Closed johlju closed 2 years ago

johlju commented 2 years ago

Problem description

The Test-TargetResource will always fail if the current state has only defined one WinHttpDefaultSecureProtocols, e.g. 'TLS1.2'. This is because Get-TargetResource does not return a string array for the property WinHttpDefaultSecureProtocols resulting in that Test-TargetResource compares the array @('TLS1.2') against @('T','L','S','1','.','2').

Verbose logs

Not available (debugged but forgot to save the logs)

DSC configuration

SChannelSettings 'ConfigureWinHTTPProtocols'
{
    IsSingleInstance              = 'Yes'
    WinHttpDefaultSecureProtocols = @('TLS1.2')
}

Suggested solution

Convert the value:.

https://github.com/dsccommunity/SChannelDsc/blob/b029a1f4b7e7b96ed0f65dc4ee697a943b55df5b/source/DSCResources/MSFT_SChannelSettings/MSFT_SChannelSettings.psm1#L326

to an array

WinHttpDefaultSecureProtocols   = @($winhttpProtocols)

Operating system the target node is running

Windows Server 2022

PowerShell version and build the target node is running

WMF 5.1

SChannelDsc version

v1.3.0