diff --git a/INSTALL/INSTALL.sh b/INSTALL/INSTALL.sh index 35db38c63..193cda5c2 100755 --- a/INSTALL/INSTALL.sh +++ b/INSTALL/INSTALL.sh @@ -1269,7 +1269,7 @@ prepareDB () { if [[ ! -e /var/lib/mysql/misp/users.ibd ]]; then debug "Setting up database" - # FIXME: If user 'misp' exists, and has a different password, the below WILL fail. + # FIXME: If user 'misp' exists, and has a different password, the below WILL fail. Partially fixed with the Env-Var check in the beginning. (Need to implement pre-flight checks to exit gracefully if not set) # Add your credentials if needed, if sudo has NOPASS, comment out the relevant lines if [[ "${PACKER}" == "1" ]]; then pw="Password1234" @@ -1277,10 +1277,18 @@ prepareDB () { pw=${MISP_PASSWORD} fi + if [[ ! -z ${INSTALL_USER} ]]; then + SUDO_EXPECT="sudo mysql_secure_installation" + echo "Making sure sudo session is buffered" + sudo ls -la /tmp > /dev/null 2> /dev/null + else + SUDO_EXPECT="sudo -k mysql_secure_installation" + fi + expect -f - <<-EOF set timeout 10 - spawn sudo -k mysql_secure_installation + spawn ${SUDO_EXPECT} expect "*?assword*" send -- "${pw}\r" expect "Enter current password for root (enter for none):" @@ -1351,10 +1359,10 @@ installCore () { debug "Installing ${LBLUE}MISP${NC} core" # Download MISP using git in the /var/www/ directory. sudo mkdir ${PATH_TO_MISP} - sudo chown $WWW_USER:$WWW_USER ${PATH_TO_MISP} + sudo chown ${WWW_USER}:${WWW_USER} ${PATH_TO_MISP} cd ${PATH_TO_MISP} - $SUDO_WWW git clone https://github.com/MISP/MISP.git ${PATH_TO_MISP} - $SUDO_WWW git submodule update --init --recursive + ${SUDO_WWW} git clone https://github.com/MISP/MISP.git ${PATH_TO_MISP} + ${SUDO_WWW} git submodule update --progress --init --recursive # Make git ignore filesystem permission differences for submodules $SUDO_WWW git submodule foreach --recursive git config core.filemode false @@ -1452,16 +1460,16 @@ permissions () { sudo chmod -R 750 ${PATH_TO_MISP} sudo chmod -R g+ws ${PATH_TO_MISP}/app/tmp sudo chmod -R g+ws ${PATH_TO_MISP}/app/files - sudo chmod -R g+ws $PATH_TO_MISP/app/files/scripts/tmp + sudo chmod -R g+ws ${PATH_TO_MISP}/app/files/scripts/tmp } configMISP () { debug "Generating ${LBLUE}MISP${NC} config files" # There are 4 sample configuration files in ${PATH_TO_MISP}/app/Config that need to be copied - $SUDO_WWW cp -a ${PATH_TO_MISP}/app/Config/bootstrap.default.php ${PATH_TO_MISP}/app/Config/bootstrap.php - $SUDO_WWW cp -a ${PATH_TO_MISP}/app/Config/database.default.php ${PATH_TO_MISP}/app/Config/database.php - $SUDO_WWW cp -a ${PATH_TO_MISP}/app/Config/core.default.php ${PATH_TO_MISP}/app/Config/core.php - $SUDO_WWW cp -a ${PATH_TO_MISP}/app/Config/config.default.php ${PATH_TO_MISP}/app/Config/config.php + ${SUDO_WWW} cp -a ${PATH_TO_MISP}/app/Config/bootstrap.default.php ${PATH_TO_MISP}/app/Config/bootstrap.php + ${SUDO_WWW} cp -a ${PATH_TO_MISP}/app/Config/database.default.php ${PATH_TO_MISP}/app/Config/database.php + ${SUDO_WWW} cp -a ${PATH_TO_MISP}/app/Config/core.default.php ${PATH_TO_MISP}/app/Config/core.php + ${SUDO_WWW} cp -a ${PATH_TO_MISP}/app/Config/config.default.php ${PATH_TO_MISP}/app/Config/config.php echo " '', 'encoding' => 'utf8', ); - }" | $SUDO_WWW tee $PATH_TO_MISP/app/Config/database.php + }" | ${SUDO_WWW} tee ${PATH_TO_MISP}/app/Config/database.php # Important! Change the salt key in ${PATH_TO_MISP}/app/Config/config.php # The salt key must be a string at least 32 bytes long. @@ -1487,7 +1495,7 @@ configMISP () { # delete the user from mysql and log in again using the default admin credentials (admin@admin.test / admin) # and make sure the file permissions are still OK - sudo chown -R $WWW_USER:$WWW_USER ${PATH_TO_MISP}/app/Config + sudo chown -R ${WWW_USER}:${WWW_USER} ${PATH_TO_MISP}/app/Config sudo chmod -R 750 ${PATH_TO_MISP}/app/Config } @@ -1682,7 +1690,7 @@ logRotation () { backgroundWorkers () { debug "Setting up background workers" # To make the background workers start on boot - sudo chmod +x $PATH_TO_MISP/app/Console/worker/start.sh + sudo chmod +x ${PATH_TO_MISP}/app/Console/worker/start.sh if [ ! -e /etc/rc.local ] then diff --git a/INSTALL/INSTALL.sh.sha1 b/INSTALL/INSTALL.sh.sha1 index 16ef77e96..a02e4f6b2 100644 --- a/INSTALL/INSTALL.sh.sha1 +++ b/INSTALL/INSTALL.sh.sha1 @@ -1 +1 @@ -85f4fd61c9f528d8eee3e9934dab9a5d88b39e5a INSTALL.sh +d1da7c4045eb88f05236acb72df96cf5671c9eb8 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha256 b/INSTALL/INSTALL.sh.sha256 index 59b1722ad..c4065e7e1 100644 --- a/INSTALL/INSTALL.sh.sha256 +++ b/INSTALL/INSTALL.sh.sha256 @@ -1 +1 @@ -3100ff4657beb6ca01e94a978e2a2d342ed2823ab6311e325e0f95690e2bc34a INSTALL.sh +156e96e2aa2f3f4d7ef6342b2355eef445a7020f6e826d8c167b85965847a540 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha384 b/INSTALL/INSTALL.sh.sha384 index f61b53fe9..bf71de3a8 100644 --- a/INSTALL/INSTALL.sh.sha384 +++ b/INSTALL/INSTALL.sh.sha384 @@ -1 +1 @@ -24060c3adf825674292fce80e07e7ec4594f10602ab27730f64cfda6203a7918ed91296fffce9029ff8d0abee6accc1f INSTALL.sh +cea44e962b4162f2388170cb304ff6c37dee5189fa70ae9af6ab9911a8a39eb74cd67a0827f90a72ac1c94ec5a291748 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha512 b/INSTALL/INSTALL.sh.sha512 index 1c576a5c1..f0982a37a 100644 --- a/INSTALL/INSTALL.sh.sha512 +++ b/INSTALL/INSTALL.sh.sha512 @@ -1 +1 @@ -009921bdc5bde273e13d0df31598319f39d6825551f789359fbb119d9d737466e1ee0f27812fe02330d8bfaf6cdda6e33c24f8c37598d905e2f995e6a5ac7c22 INSTALL.sh +0cf6d3ceee4ce78a85c617a8993a49d8966367ef29966b70048c7c172f51684ba1128b9578367ed05b8312e397fceb65dd0395dccb5c1cdbbb5e131f06e42232 INSTALL.sh