Skip to content

Commit a7768f7

Browse files
committed
Fix TLS 1.3 support detection in Invoke-AnalyzerSecuritySettings
- Wrap Where-Object results in @() for reliable .Count in PS 5.1 - Add support check to TLS 1.3 warning so it only fires on unsupported OS/Exchange - Add Write-Verbose for TLS 1.3 support variable debugging
1 parent ccede46 commit a7768f7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Diagnostics/HealthChecker/Analyzer/Security/Invoke-AnalyzerSecuritySettings.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@ function Invoke-AnalyzerSecuritySettings {
6060
Test-ExchangeBuildGreaterOrEqualThanBuild -CurrentExchangeBuild $HealthServerObject.ExchangeInformation.BuildInformation.VersionInformation -Version "ExchangeSE" -CU "RTM" |
6161
Invoke-RemotePipelineHandler -Result ([ref]$tls13SupportedExSE)
6262
$tls13SupportedExchange = $tls13SupportedEx2019 -or $tls13SupportedExSE
63+
Write-Verbose "TLS 1.3 Support - OS MajorVersion: '$($osInformation.BuildInformation.MajorVersion)' tls13SupportedOS: $tls13SupportedOS"
64+
Write-Verbose "TLS 1.3 Support - Exchange MajorVersion: '$($HealthServerObject.ExchangeInformation.BuildInformation.VersionInformation.MajorVersion)' CU: '$($HealthServerObject.ExchangeInformation.BuildInformation.VersionInformation.CU)'"
65+
Write-Verbose "TLS 1.3 Support - tls13SupportedEx2019: $tls13SupportedEx2019 tls13SupportedExSE: $tls13SupportedExSE tls13SupportedExchange: $tls13SupportedExchange"
6366
$currentNetVersion = $osInformation.TLSSettings.Registry.NET["NETv4"]
6467

6568
$tlsSettings = $osInformation.TLSSettings.Registry.TLS
6669
$misconfiguredClientServerSettings = ($tlsSettings.Values | Where-Object { $_.TLSMisconfigured -eq $true }).Count -ne 0
67-
$displayLinkToDocsPage = ($tlsSettings.Values | Where-Object { $_.TLSConfiguration -ne "Enabled" -and $_.TLSConfiguration -ne "Disabled" }).Count -ne 0
68-
$lowerTlsVersionDisabled = ($tlsSettings.Values | Where-Object { $_.TLSVersionDisabled -eq $true -and ($_.TLSVersion -ne "1.2" -and $_.TLSVersion -ne "1.3") }).Count -ne 0
69-
$tls13NotDisabled = ($tlsSettings.Values | Where-Object { $_.TLSConfiguration -ne "Disabled" -and $_.TLSVersion -eq "1.3" }).Count -gt 0
70+
$displayLinkToDocsPage = @($tlsSettings.Values | Where-Object { $_.TLSConfiguration -ne "Enabled" -and $_.TLSConfiguration -ne "Disabled" }).Count -ne 0
71+
$lowerTlsVersionDisabled = @($tlsSettings.Values | Where-Object { $_.TLSVersionDisabled -eq $true -and ($_.TLSVersion -ne "1.2" -and $_.TLSVersion -ne "1.3") }).Count -ne 0
72+
$tls13NotDisabled = @($tlsSettings.Values | Where-Object { $_.TLSConfiguration -ne "Disabled" -and $_.TLSVersion -eq "1.3" }).Count -gt 0
73+
Write-Verbose "TLS 1.3 Support - tls13NotDisabled: $tls13NotDisabled TLS 1.3 TLSConfiguration: '$(($tlsSettings['1.3']).TLSConfiguration)'"
7074

7175
$sbValue = {
7276
param ($o, $p)
@@ -226,7 +230,7 @@ function Invoke-AnalyzerSecuritySettings {
226230
Add-AnalyzedResultInformation @params
227231
}
228232

229-
if ($tls13NotDisabled) {
233+
if ($tls13NotDisabled -and (-not $tls13SupportedOS -or -not $tls13SupportedExchange)) {
230234
$displayLinkToDocsPage = $true
231235
$params = $baseParams + @{
232236
Details = "Error: TLS 1.3 is not disabled and not supported currently on Exchange and is known to cause issues within the cluster."

0 commit comments

Comments
 (0)