From 3f01b97e2d03dc566cf1c813b38c10464b96cb8a Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Thu, 3 Mar 2022 11:51:14 +0100 Subject: [PATCH] fix: [installer] Fixed Kali Linux installer --- INSTALL/INSTALL.tpl.sh | 46 ++++++++++++++------------------ docs/generic/supportFunctions.md | 10 +++++++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/INSTALL/INSTALL.tpl.sh b/INSTALL/INSTALL.tpl.sh index b89c1b46c..9411a2153 100755 --- a/INSTALL/INSTALL.tpl.sh +++ b/INSTALL/INSTALL.tpl.sh @@ -22,7 +22,7 @@ # 20210406: Ubuntu 21.04 tested and working. -- sCl # 20210406: Ubuntu 20.04.2 tested and working. -- sCl # 20210406: Ubuntu 18.04.5 tested and working. -- sCl -# 20210331: Kali Linux 2021.1 tested and working. -- sCl +# 20220303: Kali Linux 2022.1 tested and working. -- sCl # # #-------------------------------------------------------------------------------------------------| @@ -42,7 +42,7 @@ # # To install MISP on Kali copy paste the following to your shell: # # wget --no-cache -O /tmp/misp-kali.sh https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh && bash /tmp/misp-kali.sh -# NO other version then 2020.x supported, kthxbai. +# NO other version then 2022.x supported, kthxbai. # /!\ Please read the installer script before randomly doing the above. # The script is tested on a plain vanilla Kali Linux Boot CD and installs quite a few dependencies. # @@ -421,6 +421,9 @@ installMISPonKali () { # Set Base URL - functionLocation('generic/supportFunctions.md') setBaseURL + # Install PHP 7.4 (only php8.1 is available on latest Kali) - functionLocation('supportFunctions.md') + installDepsKaliPhp74 + # Install PHP 7.4 Dependencies - functionLocation('INSTALL.ubuntu2004.md') installDepsPhp74 @@ -468,17 +471,11 @@ installMISPonKali () { # Make git ignore filesystem permission differences for submodules ${SUDO_WWW} git submodule foreach --recursive git config core.filemode false - cd ${PATH_TO_MISP}/app/files/scripts - false; while [[ $? -ne 0 ]]; do ${SUDO_WWW} git clone https://github.com/CybOXProject/python-cybox.git; done - false; while [[ $? -ne 0 ]]; do ${SUDO_WWW} git clone https://github.com/STIXProject/python-stix.git; done - false; while [[ $? -ne 0 ]]; do ${SUDO_WWW} git clone https://github.com/CybOXProject/mixbox.git; done - false; while [[ $? -ne 0 ]]; do ${SUDO_WWW} git clone https://github.com/MAECProject/python-maec.git; done - sudo mkdir /var/www/.cache/ - MISP_USER_HOME=$(sudo -Hiu $MISP_USER env | grep HOME |cut -f 2 -d=) - sudo mkdir $MISP_USER_HOME/.cache - sudo chown $MISP_USER:$MISP_USER $MISP_USER_HOME/.cache + MISP_USER_HOME=$(sudo -Hiu ${MISP_USER} env | grep HOME |cut -f 2 -d=) + sudo mkdir ${MISP_USER_HOME}/.cache + sudo chown ${MISP_USER}:${MISP_USER} ${MISP_USER_HOME}/.cache sudo chown ${WWW_USER}:${WWW_USER} /var/www/.cache ## Not really needed... @@ -549,27 +546,27 @@ installMISPonKali () { debug "Setting up database" if [[ ! -e /var/lib/mysql/misp/users.ibd ]]; then # Kill the anonymous users - sudo mysql -h $DBHOST -e "DROP USER IF EXISTS ''@'localhost'" + sudo mysql -h ${DBHOST} -e "DROP USER IF EXISTS ''@'localhost'" # Because our hostname varies we'll use some Bash magic here. - sudo mysql -h $DBHOST -e "DROP USER IF EXISTS ''@'$(hostname)'" + sudo mysql -h ${DBHOST} -e "DROP USER IF EXISTS ''@'$(hostname)'" # Kill off the demo database - sudo mysql -h $DBHOST -e "DROP DATABASE IF EXISTS test" + sudo mysql -h ${DBHOST} -e "DROP DATABASE IF EXISTS test" # No root remote logins - sudo mysql -h $DBHOST -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" + sudo mysql -h ${DBHOST} -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" # Make sure that NOBODY can access the server without a password - sudo mysqladmin -h $DBHOST -u "${DBUSER_ADMIN}" password "${DBPASSWORD_ADMIN}" + sudo mysqladmin -h ${DBHOST} -u "${DBUSER_ADMIN}" password "${DBPASSWORD_ADMIN}" # Make our changes take effect - sudo mysql -h $DBHOST -e "FLUSH PRIVILEGES" + sudo mysql -h ${DBHOST} -e "FLUSH PRIVILEGES" - sudo mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "CREATE DATABASE $DBNAME;" - sudo mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "GRANT USAGE ON *.* TO $DBUSER_MISP@localhost IDENTIFIED BY '$DBPASSWORD_MISP';" - sudo mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER_MISP'@'localhost';" - sudo mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;" + sudo mysql -u ${DBUSER_ADMIN} -p${DBPASSWORD_ADMIN} -e "CREATE DATABASE ${DBNAME};" + sudo mysql -u ${DBUSER_ADMIN} -p${DBPASSWORD_ADMIN} -e "GRANT USAGE ON *.* TO ${DBUSER_MISP}@localhost IDENTIFIED BY '${DBPASSWORD_MISP}';" + sudo mysql -u ${DBUSER_ADMIN} -p${DBPASSWORD_ADMIN} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER_MISP}'@'localhost';" + sudo mysql -u ${DBUSER_ADMIN} -p${DBPASSWORD_ADMIN} -e "FLUSH PRIVILEGES;" enableServices debug "Populating database" - ${SUDO_WWW} cat ${PATH_TO_MISP}/INSTALL/MYSQL.sql | mysql -u $DBUSER_MISP -p$DBPASSWORD_MISP $DBNAME + ${SUDO_WWW} cat ${PATH_TO_MISP}/INSTALL/MYSQL.sql | mysql -u ${DBUSER_MISP} -p${DBPASSWORD_MISP} ${DBNAME} echo " /dev/tty