packer-community / packer-windows-plugins

A suite of Packer plugins for provisioning Windows machines
112 stars 20 forks source link

WAMP download fails #69

Open ricobandy opened 6 years ago

ricobandy commented 6 years ago

packer unable to download wamp server and following errors are thrown. Hence installation is not able to complete

==> vmware-iso: Provisioning with shell script: scripts/installs/install_wamp.bat vmware-iso: vmware-iso: C:\Users\vagrant>powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://sourceforge.net/projects/wampserver/files/WampServer 2/WampServer 2.2/wampserver2.2d-x64.exe', 'C:\Windows\Temp\wampserver2.2.d-x64.exe')" 0<NUL vmware-iso: Exception calling "DownloadFile" with "2" argument(s): "The request was vmware-iso: aborted: Could not create SSL/TLS secure channel." vmware-iso: At line:1 char:1 vmware-iso: + (New-Object System.Net.WebClient).DownloadFile('https://sourceforge.n ... vmware-iso: + ~~~~~~~~~~~~~~~~~ vmware-iso: + CategoryInfo : NotSpecified: (:) [], MethodInvocationException vmware-iso: + FullyQualifiedErrorId : WebException vmware-iso: vmware-iso: vmware-iso: C:\Users\vagrant>C:\Windows\Temp\wampserver2.2.d-x64.exe /verysilent vmware-iso: 'C:\Windows\Temp\wampserver2.2.d-x64.exe' is not recognized as an internal or external command, vmware-iso: operable program or batch file. vmware-iso: vmware-iso: The system cannot find the path specified. vmware-iso: The system cannot find the path specified. vmware-iso: C:\Users\vagrant>copy /Y "C:\vagrant\resources\wamp\httpd.conf" "C:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf" vmware-iso: 0 file(s) copied. vmware-iso: vmware-iso: C:\Users\vagrant>copy /Y "C:\vagrant\resources\wamp\phpmyadmin.conf" "C:\wamp\alias\phpmyadmin.conf" vmware-iso: 0 file(s) copied. vmware-iso: vmware-iso: C:\Users\vagrant>sc config wampapache start= auto vmware-iso: [SC] OpenService FAILED 1060: vmware-iso: vmware-iso: The specified service does not exist as an installed service. vmware-iso: vmware-iso: vmware-iso: C:\Users\vagrant>sc config wampmysqld start= auto vmware-iso: [SC] OpenService FAILED 1060: vmware-iso: vmware-iso: The specified service does not exist as an installed service. vmware-iso: vmware-iso: vmware-iso: C:\Users\vagrant>icacls "C:\wamp" /grant "NT Authority\LOCAL SERVICE:(OI)(CI)F" /T vmware-iso: Successfully processed 0 files; Failed processing 1 files vmware-iso: vmware-iso: C:\Users\vagrant>sc config wampapache obj= "NT Authority\LOCAL SERVICE" vmware-iso: [SC] OpenService FAILED 1060: vmware-iso: C:\Documents and Settings\All Users\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data*: The system cannot find the path specified. vmware-iso: vmware-iso: The specified service does not exist as an installed service. vmware-iso: ==> vmware-iso: Stopping virtual machine... ==> vmware-iso: Deleting output directory... Build 'vmware-iso' errored: Script exited with non-zero exit status: 36

==> Some builds didn't complete successfully and had errors: --> vmware-iso: Script exited with non-zero exit status: 36

==> Builds finished but no artifacts were created.

StefanScherer commented 6 years ago

Hi @ricobandy this is because PowerShell still doesn't use TLS 1.2 by default, sad but true. I encountered this from time to time during some of my Dockerfiles when I want to download something with PowerShell and the web site only allows TLS 1.2. ( https://github.com/StefanScherer/dockerfiles-windows/blob/master/PowerShellTricks.md#tls-12 )

You have to enable it with:

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

Put this into the PowerShell command, this should do it.