fix: [installer] Fixed Kali Linux installer

pull/8187/head
Steve Clement 2022-03-03 11:51:14 +01:00
parent 405eb76538
commit 3f01b97e2d
No known key found for this signature in database
GPG Key ID: 69A20F509BE4AEE9
2 changed files with 30 additions and 26 deletions

View File

@ -22,7 +22,7 @@
# 20210406: Ubuntu 21.04 tested and working. -- sCl # 20210406: Ubuntu 21.04 tested and working. -- sCl
# 20210406: Ubuntu 20.04.2 tested and working. -- sCl # 20210406: Ubuntu 20.04.2 tested and working. -- sCl
# 20210406: Ubuntu 18.04.5 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: # 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 # # 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. # /!\ 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. # 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') # Set Base URL - functionLocation('generic/supportFunctions.md')
setBaseURL 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') # Install PHP 7.4 Dependencies - functionLocation('INSTALL.ubuntu2004.md')
installDepsPhp74 installDepsPhp74
@ -468,17 +471,11 @@ installMISPonKali () {
# Make git ignore filesystem permission differences for submodules # Make git ignore filesystem permission differences for submodules
${SUDO_WWW} git submodule foreach --recursive git config core.filemode false ${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/ sudo mkdir /var/www/.cache/
MISP_USER_HOME=$(sudo -Hiu $MISP_USER env | grep HOME |cut -f 2 -d=) MISP_USER_HOME=$(sudo -Hiu ${MISP_USER} env | grep HOME |cut -f 2 -d=)
sudo mkdir $MISP_USER_HOME/.cache sudo mkdir ${MISP_USER_HOME}/.cache
sudo chown $MISP_USER:$MISP_USER $MISP_USER_HOME/.cache sudo chown ${MISP_USER}:${MISP_USER} ${MISP_USER_HOME}/.cache
sudo chown ${WWW_USER}:${WWW_USER} /var/www/.cache sudo chown ${WWW_USER}:${WWW_USER} /var/www/.cache
## Not really needed... ## Not really needed...
@ -549,27 +546,27 @@ installMISPonKali () {
debug "Setting up database" debug "Setting up database"
if [[ ! -e /var/lib/mysql/misp/users.ibd ]]; then if [[ ! -e /var/lib/mysql/misp/users.ibd ]]; then
# Kill the anonymous users # 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. # 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 # 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 # 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 # 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 # 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 "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 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 "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 "FLUSH PRIVILEGES;"
enableServices enableServices
debug "Populating database" 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 "<?php echo "<?php
class DATABASE_CONFIG { class DATABASE_CONFIG {
@ -609,7 +606,7 @@ installMISPonKali () {
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
do do
sudo sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI sudo sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" ${PHP_INI}
done done
debug "Restarting Apache2" debug "Restarting Apache2"
@ -856,9 +853,6 @@ x86_64-debian-buster
x86_64-ubuntu-bionic x86_64-ubuntu-bionic
x86_64-ubuntu-focal x86_64-ubuntu-focal
x86_64-ubuntu-hirsute x86_64-ubuntu-hirsute
x86_64-kali-2021.1
x86_64-kali-2021.2
x86_64-kali-2021.3
x86_64-kali-2021.4 x86_64-kali-2021.4
x86_64-kali-2022.1 x86_64-kali-2022.1
x86_64-kali-2022.2 x86_64-kali-2022.2

View File

@ -618,6 +618,16 @@ kaliUpgrade () {
sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y
} }
# Kali 2022.x has only php81
installDepsKaliPhp74 () {
sudo apt -y install lsb-release apt-transport-https ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ bullseye main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
wget http://ftp.us.debian.org/debian/pool/main/libf/libffi/libffi7_3.3-6_amd64.deb
sudo dpkg -i libffi7_3.3-6_amd64.deb
}
# Disables sleep # Disables sleep
disableSleep () { disableSleep () {
debug "Disabling sleep etc if run from a Laptop as the install might take some time…" > /dev/tty debug "Disabling sleep etc if run from a Laptop as the install might take some time…" > /dev/tty