Skip to content

Commit

Permalink
Merge pull request #2593 from robmoss2k/chocolatey-packages-security-…
Browse files Browse the repository at this point in the history
…protocol-handling

(chocolatey-packages) Update security protocol handling in test_all.ps1 for PowerShell 6+
  • Loading branch information
TheCakeIsNaOH authored Feb 7, 2025
2 parents cff742c + 3e0839c commit 2c6f97a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test_all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ $options = [ordered]@{
}
}

[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor
768 -bor
[System.Net.SecurityProtocolType]::Tls -bor
[System.Net.SecurityProtocolType]::Ssl3
# https://github.com/majkinetor/au/issues/142

if ($PSVersionTable.PSVersion.major -ge 6) {
$AvailableTls = [enum]::GetValues('Net.SecurityProtocolType') | Where-Object { $_ -ge 'Tls' } # PowerShell 6+ does not support SSL3, so use TLS minimum
$AvailableTls.ForEach({[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $_})
} else {
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor [System.Net.SecurityProtocolType]::Tls -bor [System.Net.SecurityProtocolType]::Ssl3
}

$global:info = updateall -Name $Name -Options $Options

Expand Down

0 comments on commit 2c6f97a

Please sign in to comment.