chg: [kali] Changed the way expect gets data

pull/3483/head
Steve Clement 2018-07-13 20:25:33 +02:00
parent f00ff7f315
commit 31469a6f33
1 changed files with 18 additions and 19 deletions

View File

@ -161,27 +161,26 @@ function installMISPonKali() {
chmod -R g+ws $PATH_TO_MISP/app/files/scripts/tmp
if [ ! -e /var/lib/mysql/misp/users.ibd ]; then
expect -f - << EOF
echo "
set timeout 10
spawn mysql_secure_installation
expect "Enter current password for root (enter for none):"
send -- "\r"
expect "Set root password?"
send -- "y\r"
expect "New password:"
send -- "${DBPASSWORD_ADMIN}\r"
expect "Re-enter new password:"
send -- "${DBPASSWORD_ADMIN}\r"
expect "Remove anonymous users?"
send -- "y\r"
expect "Disallow root login remotely?"
send -- "y\r"
expect "Remove test database and access to it?"
send -- "y\r"
expect "Reload privilege tables now?"
send -- "y\r"
expect eof
EOF
expect 'Enter current password for root (enter for none):'
send -- '\r'
expect 'Set root password?'
send -- 'y\r'
expect 'New password:'
send -- '${DBPASSWORD_ADMIN}\r'
expect 'Re-enter new password:'
send -- '${DBPASSWORD_ADMIN}\r'
expect 'Remove anonymous users?'
send -- 'y\r'
expect 'Disallow root login remotely?'
send -- 'y\r'
expect 'Remove test database and access to it?'
send -- 'y\r'
expect 'Reload privilege tables now?'
send -- 'y\r'
expect eof" | expect -f -
mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "create database $DBNAME;"
mysql -u $DBUSER_ADMIN -p$DBPASSWORD_ADMIN -e "grant usage on *.* to $DBNAME@localhost identified by '$DBPASSWORD_MISP';"