Commit ef408bbb authored by ergonlogic's avatar ergonlogic

Issue #2048653: Ensure mysql is secure before proceeding with hostmaster install.

parent ae02d178
......@@ -4,6 +4,29 @@
* @file install the hostmaster system
* Implements drush_COMMAND_pre_validate().
* Ensure the database cannot be accessed by anonymous users, as it will
* otherwise fail later in the install, and thus be harder to recover from.
* @see Provision_Service_db_mysql::grant_host().
function drush_provision_hostmaster_install_pre_validate() {
$command = sprintf('mysql -u intntnllyInvalid -h %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost'));
if (preg_match("/Access denied for user 'intntnllyInvalid'@'([^']*)'/", implode('', drush_shell_exec_output()), $match)) {
elseif (preg_match("/Host '([^']*)' is not allowed to connect to/", implode('', drush_shell_exec_output()), $match)) {
else {
return drush_set_error('PROVISION_DB_CONNECT_FAIL', dt('Dummy connection failed to fail. Either your MySQL permissions are too lax, or the response was not understood. See for more information. %msg', array('%msg' => join("\n", drush_shell_exec_output()))));
function drush_provision_hostmaster_install_validate($site = NULL) {
// set defaults for this whole script
// those are settings that are not prompted to the user but still overridable
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment