Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Add enforcement of TLS1.2 #598

Merged
merged 2 commits into from
Apr 15, 2020
Merged

Add enforcement of TLS1.2 #598

merged 2 commits into from
Apr 15, 2020

Conversation

alerickson
Copy link
Member

@alerickson alerickson commented Apr 15, 2020

Due to the PowerShell Gallery needing to enforce TLS 1.2, we've had a number of complaints from those still using lower versions. Additions in this PR will save the user's current security protocol settings, then change the security protocol to TLS 1.2 in order to send requests via the updated version, then revert the security protocol back to the user's setting before the request was sent.

@@ -90,6 +90,10 @@ function Find-Module {
)

Begin {
# Change security protocol to TLS 1.2
$script:securityProtocol = [Net.ServicePointManager]::SecurityProtocol
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Copy link
Contributor

@bergmeister bergmeister Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a good idea @alerickson to hard-code the usage of just one protocol. If the Gallery wants to enforce Tls13 in the future, then that change would brick all versions of PowerShellGet where the protocol is hard-coded like that and one would not even be able to change it on a higher level. cc @SteveL-MSFT
Rather, I suggest to add the Tls12 security protocol as follows, which is the standard, recommended practice:

 [Net.ServicePointManager]::SecurityProtocol =  [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

@alerickson alerickson deleted the tlsChanges branch August 10, 2021 23:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants