aboutsummaryrefslogtreecommitdiff
path: root/kolla/docker/mariadb-server/security_reset.expect
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2026-07-08 16:33:45 +0000
committerGerrit Code Review <review@openstack.org>2026-07-08 16:33:45 +0000
commit44b4d81399792f539716618953f2cafa64086a5c (patch)
tree4699d7e068e6dd842a9f1f247ca2f150d60d5e27 /kolla/docker/mariadb-server/security_reset.expect
parentb3803eb9f951acd63018ab8ba69bcbd1a2de5c93 (diff)
parentdb35ac8d793506bc43b62e7e39d27a75de1043ed (diff)
downloadkolla-44b4d81399792f539716618953f2cafa64086a5c.tar.gz
kolla-44b4d81399792f539716618953f2cafa64086a5c.zip
Merge "Migrate to pyproject.toml"
Diffstat (limited to 'kolla/docker/mariadb-server/security_reset.expect')
-rw-r--r--kolla/docker/mariadb-server/security_reset.expect67
1 files changed, 67 insertions, 0 deletions
diff --git a/kolla/docker/mariadb-server/security_reset.expect b/kolla/docker/mariadb-server/security_reset.expect
new file mode 100644
index 000000000..06f1d5c8e
--- /dev/null
+++ b/kolla/docker/mariadb-server/security_reset.expect
@@ -0,0 +1,67 @@
+#!/usr/bin/expect -f
+
+if [catch {set timeout $env(DB_MAX_TIMEOUT)}] {set timeout 10}
+spawn mariadb-secure-installation
+expect {
+ timeout { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 }
+ "Enter current password for root (enter for none):"
+}
+send "\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Switch to unix_socket authentication [Y/n] ' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Switch to unix_socket authentication [Y/n]' prompt\n"; exit 1 }
+ "Switch to unix_socket authentication \\\[Y/n\\\] "
+}
+send "n\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Change the root password? [Y/n]' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Change the root password? [Y/n]' prompt\n"; exit 1 }
+ "Change the root password? \\\[Y/n\\\] "
+}
+send "y\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 }
+ "New password:"
+}
+send "$env(DB_ROOT_PASSWORD)\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 }
+ "Re-enter new password:"
+}
+send "$env(DB_ROOT_PASSWORD)\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 }
+ "Remove anonymous users?"
+}
+send "y\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 }
+ "Disallow root login remotely?"
+}
+send "n\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 }
+ "Remove test database and access to it?"
+}
+send "y\r"
+
+expect {
+ timeout { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 }
+ eof { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 }
+ "Reload privilege tables now?"
+}
+send "y\r"
+expect eof