From 4f1d381e202fa12094dd317d0f8c2331d42f6f6b Mon Sep 17 00:00:00 2001 From: Chris Long Date: Sun, 11 Jul 2021 09:45:08 -0700 Subject: [PATCH] Update Vagrant + Packer in CI builds --- ci/build_machine_bootstrap.sh | 4 ++-- ci/manual_machine_bootstrap.sh | 8 ++++---- ci/manual_machine_bootstrap_vmware.sh | 28 ++++++++------------------- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/ci/build_machine_bootstrap.sh b/ci/build_machine_bootstrap.sh index b6c4a27..e42d64e 100755 --- a/ci/build_machine_bootstrap.sh +++ b/ci/build_machine_bootstrap.sh @@ -79,8 +79,8 @@ ufw --force enable echo "[$(date +%H:%M:%S)]: Installing Vagrant..." mkdir /opt/vagrant cd /opt/vagrant || exit 1 -wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb -dpkg -i vagrant_2.2.16_x86_64.deb +wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb +dpkg -i vagrant_2.2.17_x86_64.deb echo "[$(date +%H:%M:%S)]: Installing vagrant-reload plugin..." vagrant plugin install vagrant-reload diff --git a/ci/manual_machine_bootstrap.sh b/ci/manual_machine_bootstrap.sh index 70acb36..32ff649 100644 --- a/ci/manual_machine_bootstrap.sh +++ b/ci/manual_machine_bootstrap.sh @@ -25,8 +25,8 @@ git clone https://github.com/clong/DetectionLab.git /opt/DetectionLab # Install Vagrant mkdir /opt/vagrant cd /opt/vagrant || exit 1 -wget https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb -dpkg -i vagrant_2.2.16_x86_64.deb +wget https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb +dpkg -i vagrant_2.2.17_x86_64.deb # Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063 echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf @@ -43,8 +43,8 @@ cd /opt/DetectionLab/Vagrant || exit 1 # Install Packer mkdir /opt/packer cd /opt/packer || exit 1 -wget --progress=bar:force https://releases.hashicorp.com/packer/1.6.6/packer_1.6.6_linux_amd64.zip -unzip packer_1.6.6_linux_amd64.zip +wget --progress=bar:force https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip +unzip packer_1.7.3_linux_amd64.zip cp packer /usr/local/bin/packer # Make the Packer images headless diff --git a/ci/manual_machine_bootstrap_vmware.sh b/ci/manual_machine_bootstrap_vmware.sh index f87ac59..b8433dc 100644 --- a/ci/manual_machine_bootstrap_vmware.sh +++ b/ci/manual_machine_bootstrap_vmware.sh @@ -4,7 +4,6 @@ export DEBIAN_FRONTEND=noninteractive export SERIALNUMBER="SECRET" -export LICENSEFILE="SECRET" sed -i 's#http://archive.ubuntu.com#http://us.archive.ubuntu.com#g' /etc/apt/sources.list @@ -14,9 +13,9 @@ apt-get install -y linux-headers-"$(uname -r)" build-essential unzip git ufw apa pip install awscli --upgrade --user cp /root/.local/bin/aws /usr/local/bin/aws && chmod +x /usr/local/bin/aws -wget -O VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle" -chmod +x VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle -sudo sh VMware-Workstation-Full-16.1.1-17801498.x86_64.bundle --console --required --eulas-agreed --set-setting vmware-workstation serialNumber $SERIALNUMBER +wget -O VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle" +chmod +x VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle +sudo sh VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle --console --required --eulas-agreed --set-setting vmware-workstation serialNumber $SERIALNUMBER # Set up firewall ufw allow ssh @@ -28,15 +27,13 @@ git clone https://github.com/clong/DetectionLab.git /opt/DetectionLab # Install Vagrant mkdir /opt/vagrant cd /opt/vagrant || exit 1 -wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.deb -dpkg -i vagrant_2.2.16_x86_64.deb +wget --progress=bar:force https://releases.hashicorp.com/vagrant/2.2.17/vagrant_2.2.17_x86_64.deb +dpkg -i vagrant_2.2.17_x86_64.deb # Disable IPv6 - may help with the vagrant-reload plugin: https://github.com/hashicorp/vagrant/issues/8795#issuecomment-468945063 echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf sysctl -p /etc/sysctl.conf > /dev/null vagrant plugin install vagrant-reload vagrant plugin install vagrant-vmware-desktop -echo $LICENSEFILE | base64 -d > /tmp/license.lic -vagrant plugin license vagrant-vmware-desktop /tmp/license.lic wget --progress=bar:force "https://releases.hashicorp.com/vagrant-vmware-utility/1.0.20/vagrant-vmware-utility_1.0.20_x86_64.deb" dpkg -i vagrant-vmware-utility_1.0.20_x86_64.deb @@ -50,21 +47,12 @@ cd /opt/DetectionLab/Vagrant || exit 1 # Install Packer mkdir /opt/packer cd /opt/packer || exit 1 -wget --progress=bar:force https://releases.hashicorp.com/packer/1.6.6/packer_1.6.6_linux_amd64.zip -unzip packer_1.6.6_linux_amd64.zip +wget --progress=bar:force https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip +unzip packer_1.7.3_linux_amd64.zip cp packer /usr/local/bin/packer # Make the Packer images headless cd /opt/DetectionLab/Packer || exit 1 for file in *.json; do sed -i 's/"headless": false,/"headless": true,/g' "$file"; -done - -echo '# This file is automatically generated. -# Hand-editing this file is not recommended. -network0.name = "Bridged" -network0.device = "vmnet0" -network1.name = "HostOnly" -network1.device = "vmnet1" -network2.name = "NAT" -network2.device = "vmnet8"' > /etc/vmware/netmap.conf \ No newline at end of file +done \ No newline at end of file