From 8017610762d754b49473dbec24c92d53fe5b1163 Mon Sep 17 00:00:00 2001 From: Thibault Date: Mon, 26 Apr 2021 19:49:59 +0200 Subject: [PATCH 1/7] feat: update packer templates --- packer/templates/pro/ubuntu_1404_pro.json | 4 ++-- packer/templates/pro/windows_2008_r2_pro.json | 4 ++-- packer/templates/ubuntu_1404.json | 8 ++++---- packer/templates/windows_2008_r2.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packer/templates/pro/ubuntu_1404_pro.json b/packer/templates/pro/ubuntu_1404_pro.json index e87ab2f..2cd42f4 100644 --- a/packer/templates/pro/ubuntu_1404_pro.json +++ b/packer/templates/pro/ubuntu_1404_pro.json @@ -25,7 +25,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "guest_os_type": "Ubuntu_64", "tools_upload_flavor": "linux", @@ -63,7 +63,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "guest_os_type": "Ubuntu_64", "disk_size": 40000, diff --git a/packer/templates/pro/windows_2008_r2_pro.json b/packer/templates/pro/windows_2008_r2_pro.json index e240214..6f86060 100644 --- a/packer/templates/pro/windows_2008_r2_pro.json +++ b/packer/templates/pro/windows_2008_r2_pro.json @@ -10,7 +10,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "guest_os_type": "winServer2008Standard-64", "tools_upload_flavor": "windows", @@ -54,7 +54,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "guest_os_type": "Windows2008_64", "disk_size": 61440, diff --git a/packer/templates/ubuntu_1404.json b/packer/templates/ubuntu_1404.json index 3234be1..31a56f0 100644 --- a/packer/templates/ubuntu_1404.json +++ b/packer/templates/ubuntu_1404.json @@ -24,7 +24,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "guest_os_type": "ubuntu", "disk_size": 40000, @@ -58,7 +58,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "guest_os_type": "ubuntu-64", "tools_upload_flavor": "linux", @@ -96,7 +96,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "guest_os_type": "Ubuntu_64", "disk_size": 40000, @@ -142,7 +142,7 @@ "accelerator": "kvm", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "disk_size": 40000, "vm_name": "metasploitable3-ub1404", diff --git a/packer/templates/windows_2008_r2.json b/packer/templates/windows_2008_r2.json index 7a49cd4..072795c 100644 --- a/packer/templates/windows_2008_r2.json +++ b/packer/templates/windows_2008_r2.json @@ -9,7 +9,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "guest_os_type": "win-2008", "parallels_tools_flavor": "win", @@ -49,7 +49,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "guest_os_type": "windows7srv-64", "disk_size": 61440, @@ -92,7 +92,7 @@ "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "guest_os_type": "Windows2008_64", "disk_size": 61440, @@ -144,7 +144,7 @@ "accelerator": "kvm", "ssh_username": "vagrant", "ssh_password": "vagrant", - "ssh_wait_timeout": "2h", + "ssh_timeout": "2h", "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", "disk_size": 61440, "format": "qcow2", From 8d5ad5ae9b242abdaefb0dda48ccce14e6b68bb0 Mon Sep 17 00:00:00 2001 From: Jeffrey Martin Date: Tue, 23 Nov 2021 16:28:29 -0600 Subject: [PATCH 2/7] use alternate download location --- scripts/installs/install_manageengine.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installs/install_manageengine.bat b/scripts/installs/install_manageengine.bat index b75fd81..2220e62 100644 --- a/scripts/installs/install_manageengine.bat +++ b/scripts/installs/install_manageengine.bat @@ -1,4 +1,4 @@ -powershell -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://archives.manageengine.com/desktop-central/91084/ManageEngine_DesktopCentral.exe', 'C:\Windows\Temp\ManageEngine_DesktopCentral.exe')" Date: Wed, 24 Nov 2021 10:09:26 -0600 Subject: [PATCH 3/7] only download 7z if missing --- scripts/installs/vm-guest-tools.bat | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/installs/vm-guest-tools.bat b/scripts/installs/vm-guest-tools.bat index ed0c4eb..ac37e2b 100644 --- a/scripts/installs/vm-guest-tools.bat +++ b/scripts/installs/vm-guest-tools.bat @@ -1,7 +1,7 @@ -if not exist "C:\Windows\Temp\7zInstaller-x64.msi" ( - powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z1604-x64.msi', 'C:\Windows\Temp\7zInstaller-x64.msi')" Date: Thu, 6 Jan 2022 10:46:54 -0600 Subject: [PATCH 4/7] suppress cert check from phpmyadmin.net Supress the certificate check and validate a file has the pre-detemined checksum due to root certificate processing issues on EOL Ubuntu 14.04 OS. --- chef/cookbooks/metasploitable/recipes/phpmyadmin.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chef/cookbooks/metasploitable/recipes/phpmyadmin.rb b/chef/cookbooks/metasploitable/recipes/phpmyadmin.rb index f68c67d..35735b6 100644 --- a/chef/cookbooks/metasploitable/recipes/phpmyadmin.rb +++ b/chef/cookbooks/metasploitable/recipes/phpmyadmin.rb @@ -10,7 +10,8 @@ include_recipe 'metasploitable::php_545' bash "download and extract phpmyadmin" do code <<-EOH - wget -c -t 3 -O /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz https://files.phpmyadmin.net/phpMyAdmin/3.5.8/phpMyAdmin-3.5.8-all-languages.tar.gz + wget -c -t 3 --no-check-certificate -O /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz https://files.phpmyadmin.net/phpMyAdmin/3.5.8/phpMyAdmin-3.5.8-all-languages.tar.gz + echo "a129d4f03901c047799f634b122734ab687b48975563c87adbf5dea679676e11 /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz" | shasum -a 256 --check --status tar xvfz /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz -C /var/www/html mv /var/www/html/phpMyAdmin-3.5.8-all-languages /var/www/html/phpmyadmin EOH From 2d20351f92d24c254ff48a0b0d0a28149e9f2943 Mon Sep 17 00:00:00 2001 From: Jeffrey Martin Date: Fri, 7 Jan 2022 10:21:15 -0600 Subject: [PATCH 5/7] remove iso_checksum_type for newer packer --- packer/templates/aws/ubuntu_1404_ctf_2017.json | 1 - packer/templates/pro/ubuntu_1404_pro.json | 3 --- packer/templates/pro/windows_2008_r2_pro.json | 3 --- packer/templates/ubuntu_1404.json | 5 ----- packer/templates/windows_2008_r2.json | 5 ----- 5 files changed, 17 deletions(-) diff --git a/packer/templates/aws/ubuntu_1404_ctf_2017.json b/packer/templates/aws/ubuntu_1404_ctf_2017.json index 8ea3adf..0c464e6 100644 --- a/packer/templates/aws/ubuntu_1404_ctf_2017.json +++ b/packer/templates/aws/ubuntu_1404_ctf_2017.json @@ -50,7 +50,6 @@ ], "variables": { "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", - "iso_checksum_type": "md5", "iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9", "box_version": "0.1.18" } diff --git a/packer/templates/pro/ubuntu_1404_pro.json b/packer/templates/pro/ubuntu_1404_pro.json index 2cd42f4..ec238a3 100644 --- a/packer/templates/pro/ubuntu_1404_pro.json +++ b/packer/templates/pro/ubuntu_1404_pro.json @@ -3,7 +3,6 @@ { "type": "vmware-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "http_directory" : "{{template_dir}}/../../http", @@ -41,7 +40,6 @@ { "type": "virtualbox-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "http_directory" : "{{template_dir}}/../../http", @@ -104,7 +102,6 @@ ], "variables": { "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", - "iso_checksum_type": "md5", "iso_checksum": "ca2531b8cd79ea5b778ede3a524779b9", "box_version": "0.1.0" } diff --git a/packer/templates/pro/windows_2008_r2_pro.json b/packer/templates/pro/windows_2008_r2_pro.json index 6f86060..a440410 100644 --- a/packer/templates/pro/windows_2008_r2_pro.json +++ b/packer/templates/pro/windows_2008_r2_pro.json @@ -3,7 +3,6 @@ { "type": "vmware-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "boot_wait": "10m", @@ -47,7 +46,6 @@ { "type": "virtualbox-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "boot_wait": "10m", @@ -138,7 +136,6 @@ ], "variables": { "iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso", - "iso_checksum_type": "md5", "iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5", "autounattend": "{{template_dir}}/../../answer_files/2008_r2/Autounattend.xml", "scripts_dir": "{{template_dir}}/../../../scripts", diff --git a/packer/templates/ubuntu_1404.json b/packer/templates/ubuntu_1404.json index 31a56f0..b6c995b 100644 --- a/packer/templates/ubuntu_1404.json +++ b/packer/templates/ubuntu_1404.json @@ -3,7 +3,6 @@ { "type": "parallels-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "http_directory" : "{{template_dir}}/../http", "http_port_min" : 9001, @@ -36,7 +35,6 @@ { "type": "vmware-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "http_directory" : "{{template_dir}}/../http", @@ -74,7 +72,6 @@ { "type": "virtualbox-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "http_directory" : "{{template_dir}}/../http", @@ -119,7 +116,6 @@ { "type": "qemu", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "http_directory" : "{{template_dir}}/../http", @@ -194,7 +190,6 @@ ], "variables": { "iso_url": "http://old-releases.ubuntu.com/releases/14.04.0/ubuntu-14.04-server-amd64.iso", - "iso_checksum_type": "sha256", "iso_checksum": "ababb88a492e08759fddcf4f05e5ccc58ec9d47fa37550d63931d0a5fa4f7388", "box_version": "0.1.12" } diff --git a/packer/templates/windows_2008_r2.json b/packer/templates/windows_2008_r2.json index 072795c..f6d6bc2 100644 --- a/packer/templates/windows_2008_r2.json +++ b/packer/templates/windows_2008_r2.json @@ -3,7 +3,6 @@ { "type": "parallels-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "boot_wait": "10m", "communicator": "ssh", @@ -42,7 +41,6 @@ { "type": "vmware-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "boot_wait": "10m", @@ -85,7 +83,6 @@ { "type": "virtualbox-iso", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "boot_wait": "10m", @@ -136,7 +133,6 @@ { "type": "qemu", "iso_url": "{{user `iso_url`}}", - "iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum": "{{user `iso_checksum`}}", "headless": false, "boot_wait": "10m", @@ -347,7 +343,6 @@ ], "variables": { "iso_url": "http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso", - "iso_checksum_type": "md5", "iso_checksum": "4263be2cf3c59177c45085c0a7bc6ca5", "autounattend": "{{template_dir}}/../answer_files/2008_r2/Autounattend.xml", "scripts_dir": "{{template_dir}}/../../scripts", From f133b1b74f9892c0a363b38e7e33a5bb33a1942d Mon Sep 17 00:00:00 2001 From: Jeffrey Martin Date: Fri, 7 Jan 2022 10:23:51 -0600 Subject: [PATCH 6/7] update virualbox and packer requirements --- build.ps1 | 4 ++-- build.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.ps1 b/build.ps1 index f1808b0..8ac7c13 100755 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = "Stop" -$virtualBoxMinVersion = "5.1.10" -$packerMinVersion = "0.10.0" +$virtualBoxMinVersion = "6.1.0" +$packerMinVersion = "1.6.0" $vagrantMinVersion = "1.9.0" $vagrantreloadMinVersion = "0.0.1" $packer = "packer.exe" diff --git a/build.sh b/build.sh index f0e8a7b..03f8974 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,8 @@ #!/bin/bash -min_vbox_ver="5.1.10" +min_vbox_ver="6.1.0" min_vagrant_ver="1.9.0" -min_packer_ver="0.10.0" +min_packer_ver="1.6.0" min_vagrantreload_ver="0.0.1" min_vagrantvmware_ver="0.0.1" min_vagrantparallels_ver="0.0.1" From 52b4da65f56d9bc6a1399162fd659d1c97cbf511 Mon Sep 17 00:00:00 2001 From: Jeffrey Martin Date: Fri, 7 Jan 2022 11:18:22 -0600 Subject: [PATCH 7/7] update manual build docs to match Vagrantfile Address #516 to align box name to match Vagrantfile. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c910a4..0b3e4d1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Requirements: 1. Clone this repo and navigate to the main directory. 2. Build the base VM image by running `packer build --only= ./packer/templates/windows_2008_r2.json` where `` is your preferred virtualization platform. Currently `virtualbox-iso`, `qemu`, and `vmware-iso` providers are supported. This will take a while the first time you run it since it has to download the OS installation ISO. -3. After the base Vagrant box is created you need to add it to your Vagrant environment. This can be done with the command `vagrant box add packer/builds/windows_2008_r2_*_0.1.0.box --name=metasploitable3-win2k8`. +3. After the base Vagrant box is created you need to add it to your Vagrant environment. This can be done with the command `vagrant box add packer/builds/windows_2008_r2_*_0.1.0.box --name=rapid7/metasploitable3-win2k8`. 4. Use `vagrant plugin install vagrant-reload` to install the reload vagrant provisioner if you haven't already. 5. To start the VM, run the command `vagrant up win2k8`. This will start up the VM and run all of the installation and configuration scripts necessary to set everything up. This takes about 10 minutes. 6. Once this process completes, you can open up the VM within VirtualBox and login. The default credentials are: