diff --git a/.gitignore b/.gitignore index 678c6e7..d9374ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ packer_cache/ output-virtualbox-iso/ +scripts/INSTALL.sh *.checksum diff --git a/build_vbox.sh b/build_vbox.sh index 9681b3b..6bc970d 100755 --- a/build_vbox.sh +++ b/build_vbox.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Fetching latest MISP LICENSE -/usr/bin/wget -q -O /tmp/LICENSE-misp https://raw.githubusercontent.com/MISP/MISP/2.4/LICENSE +[[ ! -f /tmp/LICENSE-misp ]] && wget -q -O /tmp/LICENSE-misp https://raw.githubusercontent.com/MISP/MISP/2.4/LICENSE packer build -only=virtualbox-iso misp.json diff --git a/deploy.sh b/deploy.sh index 7342038..1ea66ed 100755 --- a/deploy.sh +++ b/deploy.sh @@ -3,6 +3,12 @@ # Timing creation TIME_START=$(date +%s) +# Place holder +function checkBin() +{ + echo "NOOP" +} + # Latest version of misp VER=$(curl -s https://api.github.com/repos/MISP/MISP/tags |jq -r '.[0] | .name') # Latest commit hash of misp @@ -98,6 +104,9 @@ removeAll 2> /dev/null # Fetching latest MISP LICENSE /usr/bin/wget -q -O /tmp/LICENSE-${PACKER_NAME} https://raw.githubusercontent.com/MISP/MISP/2.4/LICENSE +# Fetch the latest MISP Installer +/usr/bin/wget -q -O scripts/INSTALL.sh https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh + # Check if latest build is still up to date, if not, roll and deploy new if [ "${LATEST_COMMIT}" != "$(cat /tmp/misp-latest.sha)" ]; then diff --git a/misp.json b/misp.json index 2b6088e..88485de 100644 --- a/misp.json +++ b/misp.json @@ -157,10 +157,18 @@ "execute_command" : "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'", "script": "scripts/interfaces.sh" }, + { + "type": "file", + "source" : "scripts/INSTALL.sh", + "destination": "/tmp/INSTALL.sh" + }, { "type": "shell", - "execute_command" : "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'", - "script": "scripts/bootstrap.sh", + "execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -u {{user `ssh_name`}} -E -S bash '{{ .Path }}'", + "inline": [ + "chmod u+x /tmp/INSTALL.sh", + "/tmp/INSTALL.sh -A" + ], "pause_before": "10s" }, { diff --git a/scripts/interfaces.sh b/scripts/interfaces.sh index 682371c..3f1ddb2 100644 --- a/scripts/interfaces.sh +++ b/scripts/interfaces.sh @@ -1,14 +1,19 @@ #! /usr/bin/env bash +## This file is AUTOGENERATED. +## /!\ Do NOT Change the contents of the file. +## To generate it you need a copy of the main MISP repo. +## As a quick reference, you cat generate with xsnippet: +# $ xsnippet /tmp/ $PATH_TO_MISP/docs/generic/ethX.md +# $ cp /tmp/interfaces.sh . + echo "--- Using old style name (ethX) for interfaces" sed -r 's/^(GRUB_CMDLINE_LINUX=).*/\1\"net\.ifnames=0\ biosdevname=0\"/' /etc/default/grub | sudo tee /etc/default/grub > /dev/null - # install ifupdown since ubuntu 18.04 sudo apt-get update sudo apt-get install -y ifupdown - # enable eth0 echo "--- Configuring eth0" @@ -18,5 +23,4 @@ auto eth0 iface eth0 inet dhcp EOF - update-grub > /dev/null 2>&1