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

Get-ChocolateyWebFile - Ensure PSVersionTable is used for PowerShell Version #1623

Closed
MaxBurgert opened this issue Aug 7, 2018 · 2 comments
Assignees
Milestone

Comments

@MaxBurgert
Copy link
Contributor

MaxBurgert commented Aug 7, 2018

When trying to run chocolatey with PSVersion 6.0.3 setting the security protocol to ssl3 raises the mentioned error here.

SSL3 is deprecated:
https://blogs.technet.microsoft.com/askpfeplat/2018/02/12/retire-those-old-legacy-protocols/
https://tools.ietf.org/html/rfc7568
https://docs.microsoft.com/en-us/security-updates/securityadvisories/2015/3009008

Steps to reproduce

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::ssl3

Expected behavior

C:\Users\user\Documents> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::ssl3
C:\Users\user\Documents>

Actual behavior

Exception setting "SecurityProtocol": "The requested security protocol is not supported."
At line:1 char:1
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.3
PSEdition                      Core
GitCommitId                    v6.0.3
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@ferventcoder
Copy link
Member

Whoops, looks like we were grabbing the wrong version there. Great find, looks good for a fix as well!

ferventcoder pushed a commit that referenced this issue Sep 26, 2018
When determining the PowerShell version, using `$host.Version` is ill-advised -
it is dependent upon the host and may not be an accurate value. In the case of
Visual Studio Code, it was coming up with the version of VS Code and not
PowerShell's version. This leads to unexpected behavior. Instead, to make a
determination of the version of PowerShell, use `$PSVersionTable.PSVersion`.

See this [link](https://blogs.technet.microsoft.com/heyscriptingguy/2014/10/13/powertip-check-version-of-powershell/) for more information.
ferventcoder added a commit that referenced this issue Sep 26, 2018
* pr1624:
  (GH-1623) Use PSVersionTable for Version
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 26, 2018
* stable:
  (chocolateyGH-1623) Use PSVersionTable for Version
  (doc) fix up doc mistakes
  (doc) update licensed changelog
@ferventcoder ferventcoder added this to the 0.10.12 milestone Sep 26, 2018
@ferventcoder
Copy link
Member

This was merged into stable at d43e9fd and will go out in v0.10.12. Thanks again!

@ferventcoder ferventcoder changed the title Setting Security Protocol to ssl3 is not supported with PowerShell 6.0.3 Get-ChocolateyWebFile - Ensure PSVersionTable is used for PowerShell Version Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants