diff --git a/build_vbox.sh b/build_vbox.sh index 01fa9a0..c0725d7 100755 --- a/build_vbox.sh +++ b/build_vbox.sh @@ -13,22 +13,58 @@ fi SHA_SUMS="1 256 384 512" checkInstaller () { - for sum in $(echo ${SHA_SUMS}); do - /usr/bin/wget -q -O scripts/INSTALL.sh.sha${sum} https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh.sha${sum} - INSTsum=$(shasum -a ${sum} scripts/INSTALL.sh | cut -f1 -d\ ) - chsum=$(cat scripts/INSTALL.sh.sha${sum} | cut -f1 -d\ ) - - if [[ "$chsum" == "$INSTsum" ]]; then - echo "sha${sum} matches" - else - echo "sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}" - echo "Deleting installer, please run again." - rm scripts/INSTALL.sh - exit 1 +if [[ "${FLAVOUR}" == "rhel" ]] || [[ "${FLAVOUR}" == "centos" ]] || [[ "${FLAVOUR}" == "fedora" ]]; then + INSTsum=$(sha512sum ${0} | cut -f1 -d\ ) + /usr/bin/wget --no-cache -q -O /tmp/INSTALL.sh.sha512 https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh.sha512 + chsum=$(cat /tmp/INSTALL.sh.sha512) + if [[ "${chsum}" == "${INSTsum}" ]]; then + echo "SHA512 matches" + else + echo "SHA512: ${chsum} does not match the installer sum of: ${INSTsum}" + # exit 1 # uncomment when/if PR is merged + fi + else + # TODO: Implement $FLAVOUR checks and install depending on the platform we are on + if [[ $(which shasum > /dev/null 2>&1 ; echo $?) -ne 0 ]]; then + checkAptLock + sudo apt install libdigest-sha-perl -qyy fi - done + # SHAsums to be computed, not the -- notatiation is for ease of use with rhash + SHA_SUMS="--sha1 --sha256 --sha384 --sha512" + for sum in $(echo ${SHA_SUMS} |sed 's/--sha//g'); do + /usr/bin/wget --no-cache -q -O /tmp/INSTALL.sh.sha${sum} https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh.sha${sum} + INSTsum=$(shasum -a ${sum} ${0} | cut -f1 -d\ ) + chsum=$(cat /tmp/INSTALL.sh.sha${sum} | cut -f1 -d\ ) + + if [[ "${chsum}" == "${INSTsum}" ]]; then + echo "sha${sum} matches" + else + echo "sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}" + echo "Delete installer, re-download and please run again." + exit 1 + fi + done +fi } + +#checkInstaller () { +# for sum in $(echo ${SHA_SUMS}); do +# /usr/bin/wget -q -O scripts/INSTALL.sh.sha${sum} https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh.sha${sum} +# INSTsum=$(shasum -a ${sum} scripts/INSTALL.sh | cut -f1 -d\ ) +# chsum=$(cat scripts/INSTALL.sh.sha${sum} | cut -f1 -d\ ) + +# if [[ "$chsum" == "$INSTsum" ]]; then +# echo "sha${sum} matches" +# else +# echo "sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}" +# echo "Deleting installer, please run again." +# rm scripts/INSTALL.sh +# exit 1 +# fi +# done +#} + # Fetch and check installer if [[ -f "scripts/INSTALL.sh" ]]; then echo "Checking checksums" diff --git a/misp.json b/misp.json index 14cf4fa..197fc82 100644 --- a/misp.json +++ b/misp.json @@ -258,7 +258,7 @@ "ssh_pass": "Password1234", "update": "true", "vm_description": "MISP, is an open source software solution for collecting, storing, distributing and sharing cyber security indicators and threat about cyber security incidents analysis and malware analysis. MISP is designed by and for incident analysts, security and ICT professionals or malware reverser to support their day-to-day operations to share structured informations efficiently.", - "vm_name": "MISP_rawane_demo", + "vm_name": "1", "vm_version": "2.4" } } diff --git a/preseeds/preseed.cfg b/preseeds/preseed.cfg index 7641a81..047c32c 100644 --- a/preseeds/preseed.cfg +++ b/preseeds/preseed.cfg @@ -1,5 +1,5 @@ ### Base system install -d-i base-installer/kernel/override-image string linux-generic-lts-hwe-20.04 +d-i base-installer/kernel/override-image string linux-server # Account setup d-i passwd/user-fullname string misp @@ -60,8 +60,7 @@ d-i partman-lvm/confirm_nooverwrite boolean true d-i partman-auto-lvm/guided_size string max # No proxy, plx -#d-i mirror/http/proxy string -d-i mirror/http/mirror select archive.ubuntu.com +d-i mirror/http/proxy string # Whether to upgrade packages after debootstrap. # Allowed values: none, safe-upgrade, full-upgrade