diff --git a/docs/INSTALL.ubuntu2004.md b/docs/INSTALL.ubuntu2004.md index edc553498..d5f99ef0d 100644 --- a/docs/INSTALL.ubuntu2004.md +++ b/docs/INSTALL.ubuntu2004.md @@ -264,7 +264,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" @@ -272,10 +272,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):" diff --git a/docs/generic/supportFunctions.md b/docs/generic/supportFunctions.md index 96dab9ab0..6dbb51a0d 100644 --- a/docs/generic/supportFunctions.md +++ b/docs/generic/supportFunctions.md @@ -373,10 +373,11 @@ checkID () { clean > /dev/null 2>&1 exit 1 elif [[ $(id $MISP_USER >/dev/null; echo $?) -ne 0 ]]; then - if [[ "$UNATTENDED" != "1" ]]; then + if [[ "$UNATTENDED" != "1" ]]; then echo "There is NO user called '$MISP_USER' create a user '$MISP_USER' (y) or continue as $USER (n)? (y/n) " read ANSWER ANSWER=$(echo $ANSWER |tr '[:upper:]' '[:lower:]') + INSTALL_USER=${USER} else ANSWER="y" fi