rapid7/metasploitable3

Unable to install metasploitable3 Windows2008 -- 'chocolatey' is not recognized as an internal or external command,

Mxh778872 opened this issue · 6 comments

Issue Description

Followed the instructions to install metasploitable3 Windows2008, got error: 'chocolatey' is not recognized as an internal or external command, I double checked choco -? it works fine. Also, set environment variables path to C:\ProgramData\chocolatey\bin.
Throw an error at final step! appreciate for any idea, thank you!

Host System

  • OS: Windows 10 19044
  • Packer Version: Packer_1.8.4_windows_amd64
  • Vagrant Version: Vagrant_2.3.3_windows_amd64
  • VirtualBox Version: VirtualBox-7.0.2-154219-Win

Command Output

PS D:\metasploitable3-master> choco
Chocolatey v1.2.0
Please run 'choco -?' or 'choco -?' for help menu.

PS D:\metasploitable3-master> .\build.ps1 windows2008

Compatible version of VirtualBox found.
Compatible version of Packer found.
Compatible version of Vagrant found.
Compatible version of vagrant-reload plugin found.
All requirements found. Proceeding...
Building metasploitable3-win2k8 Vagrant box...
virtualbox-iso: output will be in this color.

==> virtualbox-iso: Retrieving Guest additions
..............
==> virtualbox-iso: Provisioning with shell script: D:\metasploitable3-master\packer\templates/../../scripts/installs/install_boxstarter.bat
virtualbox-iso:
virtualbox-iso: C:\Users\vagrant>chocolatey feature enable -n=allowGlobalConfirmation
==> virtualbox-iso: 'chocolatey' is not recognized as an internal or external command,
==> virtualbox-iso: operable program or batch file.
==> virtualbox-iso: 'choco' is not recognized as an internal or external command,
==> virtualbox-iso: operable program or batch file.
virtualbox-iso:
==> virtualbox-iso:
==> virtualbox-iso: operable program or batch file.
virtualbox-iso: C:\Users\vagrant>choco install BoxStarter
virtualbox-iso:
virtualbox-iso: C:\Users\vagrant>chocolatey feature disable -n=allowGlobalConfirmation
==> virtualbox-iso: Provisioning step had errors: Running the cleanup provisioner, if present...
==> virtualbox-iso: Cleaning up floppy disk...
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored after 24 minutes 53 seconds: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Wait completed after 24 minutes 53 seconds

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.
Error building the Vagrant box using Packer. Please check the output above for any error messages.
At D:\metasploitable3-master\build.ps1:157 char:10

  •      throw "Error building the Vagrant box using Packer. Please c ...
    
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Error building ...error messages.:String) [], RuntimeException
    • FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error messages.

Screenshot_20221116-172502_AnyDesk
Screenshot_20221116-172859_AnyDesk
3~2

@Mxh778872
I have the same problem, have you found a solution?

Same, unable to build on qemu as well. Seems to be a problem with choco install :

==> qemu: Provisioning with powershell script: ./scripts/configs/vagrant-ssh.ps1
==> qemu: #< CLIXML
==> qemu: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception setting "SecurityProtocol": "Cannot convert null to type "System.Net._x000D__x000A_</S><S S="Error">SecurityProtocolType" due to invalid enumeration values. Specify one of the fol_x000D__x000A_</S><S S="Error">lowing enumeration values and try again. The possible enumeration values are "S_x000D__x000A_</S><S S="Error">sl3, Tls"."_x000D__x000A_</S><S S="Error">At line:2 char:35_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]:: &lt;&lt;&lt;&lt; SecurityProtocol = [Net.SecurityProto_x000D__x000A_</S><S S="Error">colType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://raw.gi_x000D__x000A_</S><S S="Error">thubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagra_x000D__x000A_</S><S S="Error">nt\.ssh\authorized_keys')_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : PropertyAssignmentException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "DownloadFile" with "2" argument(s): "The underlying connecti_x000D__x000A_</S><S S="Error">on was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:135_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls12; (New-Object System.Net.WebClient).DownloadFile &lt;&lt;&lt;&lt; ('https://raw.gi_x000D__x000A_</S><S S="Error">thubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagra_x000D__x000A_</S><S S="Error">nt\.ssh\authorized_keys')_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>
==> qemu: Provisioning with powershell script: ./scripts/installs/chocolatey.ps1
==> qemu: #< CLIXML
==> qemu: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception setting "SecurityProtocol": "Cannot convert null to type "System.Net._x000D__x000A_</S><S S="Error">SecurityProtocolType" due to invalid enumeration values. Specify one of the fol_x000D__x000A_</S><S S="Error">lowing enumeration values and try again. The possible enumeration values are "S_x000D__x000A_</S><S S="Error">sl3, Tls"."_x000D__x000A_</S><S S="Error">At line:2 char:35_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]:: &lt;&lt;&lt;&lt; SecurityProtocol = [Net.SecurityProto_x000D__x000A_</S><S S="Error">colType]::Tls12; iex ((new-object net.webclient).DownloadString('https://chocol_x000D__x000A_</S><S S="Error">atey.org/install.ps1'))_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : PropertyAssignmentException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "DownloadString" with "1" argument(s): "The underlying connec_x000D__x000A_</S><S S="Error">tion was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:135_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls12; iex ((new-object net.webclient).DownloadString &lt;&lt;&lt;&lt; ('https://chocol_x000D__x000A_</S><S S="Error">atey.org/install.ps1'))_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

as I noticed the enum was only listing "Ssl3, Tls" and the value was set to "Tls12", I tried to move from Tls12 to Tls, with no more success :

==> qemu: Provisioning with powershell script: ./scripts/configs/vagrant-ssh.ps1
==> qemu: #< CLIXML
==> qemu: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception calling "DownloadFile" with "2" argument(s): "The underlying connecti_x000D__x000A_</S><S S="Error">on was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:133_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls; (New-Object System.Net.WebClient).DownloadFile &lt;&lt;&lt;&lt; ('https://raw.gith_x000D__x000A_</S><S S="Error">ubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant_x000D__x000A_</S><S S="Error">\.ssh\authorized_keys')_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

==> qemu: Provisioning with powershell script: ./scripts/installs/chocolatey.ps1
==> qemu: #< CLIXML
==> qemu: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception calling "DownloadString" with "1" argument(s): "The underlying connec_x000D__x000A_</S><S S="Error">tion was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:133_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls; iex ((new-object net.webclient).DownloadString &lt;&lt;&lt;&lt; ('https://chocolat_x000D__x000A_</S><S S="Error">ey.org/install.ps1'))_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

and then the following jobs needing choco all fail. Anyone has a hint on this ?

The problem is not in Tls12, i think is in this string:

image

The command is block to connect to internet, this is the reason that not download Chocolatey and block all the process. Anyone know another way to install the program without connect directly to the webpage?

The problem ist PowerShell Version 2.0, the Windows Management Framework was not installed, becauso of the TLS1.3 problem. So you need to change the install_wmf.ps1 script to a http location or with a preload from packer.exe http location.

This looks to be a duplicate of #575, a fix just landed please update the retest this.

If the issue persists please reopen here.