Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce usage of TLS 1.2 when building Chocolatey package #5422

Merged
merged 1 commit into from
Feb 27, 2018

Conversation

Daniel15
Copy link
Member

Summary
Currently, the Chocolatey build is failing: #5416

Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At C:\Jenkins\workspace\yarn-chocolatey\scripts\build-chocolatey.ps1:44 char:1
+ Invoke-WebRequest -Uri $url -OutFile $installer_file

Github appears to have started enforcing TLS 1.2 at some point: https://www.ssllabs.com/ssltest/analyze.html?d=github.com

However, PowerShell uses TLS 1.0 by default. This causes an error when loading from GitHub via Invoke-WebRequest:

PS C:\Users\danlo> Invoke-WebRequest -Uri https://github.com/
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At line:1 char:1
+ Invoke-WebRequest -Uri https://github.com/
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We need to enforce TLS 1.2 to make it work:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

Test plan
Downloading Yarn installer via Invoke-WebRequest was failing:

Invoke-WebRequest -Uri "https://github.com/yarnpkg/yarn/releases/download/v1.5.1/yarn-1.5.1.msi" -OutFile "c:\temp\yarn.msi"
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At line:1 char:1
+ Invoke-WebRequest -Uri "https://github.com/yarnpkg/yarn/releases/down ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExcept
   ion
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Now it works!

@Daniel15 Daniel15 merged commit 03f942c into master Feb 27, 2018
@Daniel15 Daniel15 deleted the Daniel15-patch-2 branch February 27, 2018 21:55
@Daniel15
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant