chocolatey-community / chocolatey-test-environment

A testing setup related to how the Chocolatey Package Verifier runs testing. Used for manual testing or prior to submission
Apache License 2.0
117 stars 187 forks source link

Chocolatey install - Could not create SSL/TLS secure channel #48

Closed Xav83 closed 4 years ago

Xav83 commented 4 years ago

Hi everybody, I hope you all have a great day πŸ™‚

I submit this issue to you because I have a problem with the installation of Chocolatey on the test environnement. Indeed, when running the command vagrant provision to run test a package, I end up with the following error :

==> default: Running provisioner: shell...
    default: Running: shell/InstallChocolatey.ps1 as c:\tmp\vagrant-shell.ps1
    default: Exception calling "DownloadString" with "1" argument(s): "The request was 
    default: aborted: Could not create SSL/TLS secure channel."
    default: At C:\tmp\vagrant-shell.ps1:70 char:7
    default: +       iex ((new-object 
    default: net.webclient).DownloadString('https://chocolatey.org/ins ...
    default: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    default: ~~~
    default:     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    default:     + FullyQualifiedErrorId : WebException
    default: choco : The term 'choco' is not recognized as the name of a cmdlet, function, 
    default: script file, or operable program. Check the spelling of the name, or if a path 
    default: was included, verify that the path is correct and try again.
    default: At C:\tmp\vagrant-shell.ps1:78 char:1
    default: + choco feature enable -n autouninstaller
    default: + ~~~~~
    default:     + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFou 
    default:    ndException
    default:     + FullyQualifiedErrorId : CommandNotFoundException
    default: choco : The term 'choco' is not recognized as the name of a cmdlet, function, 
    default: script file, or operable program. Check the spelling of the name, or if a path 
    default: was included, verify that the path is correct and try again.
    default: At C:\tmp\vagrant-shell.ps1:79 char:1
    default: + choco feature enable -n allowGlobalConfirmation
    default: + ~~~~~
    default:     + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFou 
    default:    ndException
    default:     + FullyQualifiedErrorId : CommandNotFoundException
    default: choco : The term 'choco' is not recognized as the name of a cmdlet, function, 
    default: script file, or operable program. Check the spelling of the name, or if a path 
    default: was included, verify that the path is correct and try again.
    default: At C:\tmp\vagrant-shell.ps1:80 char:1
    default: + choco feature enable -n logEnvironmentValues
    default: + ~~~~~
    default:     + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFou 
    default:    ndException
    default:     + FullyQualifiedErrorId : CommandNotFoundException

Here are the information of my setup:

This is my first package, so I may have some element not setup correctly triggering this error. For information, I currently try to upgrade the conan package.

Thank you all for your attention, I hope you can help me with this issue so that I can finally finish upgrading conan package πŸ˜„

timothek commented 4 years ago

Hey Xav83, I got the same error while creating a new test environment. I used the following versions of the required software:

After some research I stumbled upon this stackoverflow question which stated, that the security protocol version of powershell may be to old to access the website in the download statement of the installation script. (https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel).

After adding this line to the file shell/InstallChocolatey.ps1 the installation of chocolatey in the test environment worked flawlessly:

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

Is this worth a pull request or are there better ways to change the Security Protocol in the Powershell?

zhoupan163 commented 11 months ago

Hey Xav83, I got the same error while creating a new test environment. I used the following versions of the required software:

  • Vagrant, version 2.2.7
  • VirtualBox, version 6.0.16 r135674
  • Chocolatey, version 0.10.15

After some research I stumbled upon this stackoverflow question which stated, that the security protocol version of powershell may be to old to access the website in the download statement of the installation script. (https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel).

After adding this line to the file shell/InstallChocolatey.ps1 the installation of chocolatey in the test environment worked flawlessly:

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

Is this worth a pull request or are there better ways to change the Security Protocol in the Powershell? Thank you very much!