Aegir 0.4-alpha5
Drush 6.x-3.0-alpha1
Provision version that comes with Aegir alpha5
Drupal 6.15 (Aegir running under this version)
Apache 2.2.12 (Ubuntu)
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7
MySQL 5.1.37-1ubuntu5.1

After setting up a fresh install of Aegir the backup task kept failing when attempted. I tried the backup task against the imported Aegir site itself and an imported Open Atrium 1.0-beta3.2 site, neither site would successfully backup. When running the same backup task via drush on the command line with the --debug option mysqldump reported "Access denied for user....(using password: YES)".

Next I setup a fresh platform (Drupal 6.15) and created a site under that platform. Once verified and installed, I tried to run the backup task against the site. Low and behold the backup task succeeded!

I eventually determined the backup task was failing because the MySQL password I had used for the Aegir and Atrium 1.0-beta3.2 sites contain special characters. The password appears to be urlencoded in the config/vhost.d/ virtualhost config file, but not in the drushrc.php file. Simply modifying the password to be URL encoded in drushrc.php (at top and bottom) did NOT help. However, when I change the users password in MySQL to not contain special characters and set this new password in virtualhost config and drushrc.php the backup task WORKED!

So I'm not exactly sure where the problem lies (provision, drush or something else), but anyone should be able to reproduce the problem by importing a site that contains a mysql password with special characters.

Below is the output of the failed drush backup command with debugging enabled.

aegir@:~$ /var/aegir/drush/drush.php --root='/var/aegir/platforms/hostmaster-0.4-alpha5' provision-backup 'aegir.example.com' --debug

Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 4.82 MB]                                                                                          [bootstrap]
Loading drushrc "/var/aegir/platforms/hostmaster-0.4-alpha5/drushrc.php" into "drupal" scope. [0.04 sec, 4.82 MB]                                        [bootstrap]
Initialized Drupal 6.15 root directory at /var/aegir/platforms/hostmaster-0.4-alpha5 [0.04 sec, 6.02 MB]                                                       [notice]
Found command: provision-backup (commandfile=provision) [0.05 sec, 6.01 MB]                                                                                       [bootstrap]
Initializing drush commandfile: drush_make [0.05 sec, 6.02 MB]                                                                                                              [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.05 sec, 6.02 MB]                                                                                                       [bootstrap]
Initializing drush commandfile: provision_apache [0.05 sec, 6.03 MB]                                                                                                       [bootstrap]
Undefined index:  base_url [0.05 sec, 6.04 MB]                                                                                                                                   [notice]
Initializing drush commandfile: provision_drupal [0.05 sec, 6.04 MB]                                                                                                        [bootstrap]
Initializing drush commandfile: provision_mysql [0.05 sec, 6.04 MB]                                                                                                         [bootstrap]
Undefined index:  db_url [0.05 sec, 6.04 MB]                                                                                                                                      [notice]
Including /var/aegir/.drush/provision/platform/backup.provision.inc [0.05 sec, 6.05 MB]                                                                              [bootstrap]
Including /var/aegir/.drush/provision/db_server/backup.provision.inc [0.05 sec, 6.08 MB]                                                                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 6.13 MB]                                                                                           [bootstrap]
Initialized Drupal site aegir.example.com at sites/aegir.example.com [0.05 sec, 6.14 MB]                                                                             [notice]
Loading drushrc "/var/aegir/platforms/hostmaster-0.4-alpha5/sites/aegir.example.com/drushrc.php" into "site" scope. [0.05 sec, 6.14 MB]           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.06 sec, 6.53 MB]                                                                               [bootstrap]
Generating mysql dump for aegir.example.com. [0.06 sec, 6.54 MB]                                                                                                         [backup]
mysqldump --defaults-file=/dev/fd/3 -rsites/aegir.example.com/database.sql aegir [0.06 sec, 6.54 MB]                                                         [notice]
Undefined variable: indent [0.06 sec, 6.54 MB]                                                                                                                                    [notice]
Executing: mysqldump --defaults-file=/dev/fd/3 -rsites/aegir.example.com/database.sql aegir
  mysqldump: Got error: 1045: Access denied for user 'aegir'@'localhost' (using password: YES) when trying to connect
Could not generate database backup from mysqldump [0.06 sec, 6.55 MB]                                                                                               [error]
An error occurred at function : drush_provision_mysql_pre_provision_backup [0.06 sec, 6.54 MB]                                                                 [error]
Deleted mysql dump from sites directory [0.06 sec, 6.55 MB]                                                                                                                 [message]
Changes for drush_provision_mysql_pre_provision_backup module have been rolled back. [0.06 sec, 6.55 MB]                                                 [rollback]
Command dispatch complete [0.07 sec, 6.51 MB]                                                                                                                                [notice]
Timer 'page' is  0.01 sec. [0.07 sec, 6.51 MB]                                                                                                                                     [timer]
Peak memory usage was 6.92 MB [0.07 sec, 6.51 MB]                                                                                                                          [memory]
CommentFileSizeAuthor
#10 7ade8a2.patch1.17 KBanarcat
#1 provision_url_decode_db.diff636 bytesadrian
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adrian’s picture

Status: Active » Needs review
FileSize
636 bytes

Try this patch ?

it decodes the user / pass before storing it into the fd/3 device.

adrian’s picture

Status: Needs review » Fixed

fixed in head.

reopen if it's still a problem

timwood’s picture

Looks like the patch did NOT do the trick.

I applied the patch to my aegir users .drush/provision/db_server/backup.provision.inc. A resulting diff of the patched and pre-patched file is below. Next I changed the password for the mysql user for the Aegir site in mysql and flushed the privileges. Then I changed the password in config/vhost.d/aegir.example.com_80 and platforms/hostmaster-0.4-alpha5/sites/aegir.example.com/drushrc.php. In the vhost config I used a URL encoded password, in the drushrc.php I did NOT URL encode the password because this is how Aegir originally set it up when importing the site.

Should the password also be URL encoded in drushrc.php? If so, will that be fixed in the import process for sites as well?

24c24
< ', drush_get_option('db_host'), urldecode(drush_get_option('db_user')), urldecode(drush_get_option('db_passwd')));
---
> ', drush_get_option('db_host'), drush_get_option('db_user'), drush_get_option('db_passwd'));
adrian’s picture

aegir is meant to be storing the DECODED passwords , and only url encoding them when the settings.php (or conversely the apache vhost) is created.

There are 2 occurrences of the password in the drushrc.php

once is when those options are set, which aren't encoded.

The other is when it is set as part of the $_SERVER environment. which should be encoded.

timwood’s picture

Status: Fixed » Needs work

So in drushrc.php the first occurrence of the DB password should not be encoded but the second occurrence ($_SERVER) should be encoded. I've made this change (encoding the second occurrence) to the same site's drushrc.php and tried to run the backup task from Aegir interface again, as well as from the command-line. The backup is still failing with the same mysqldump error: Access denied for user...

Is there anything else I can do to help debug this issue?

adrian’s picture

Version: 6.x-0.4-alpha3 »
Priority: Critical » Normal
Status: Needs work » Postponed (maintainer needs more info)

please test again using HEAD or alpha9 when you get the chance.

it's drastically different and doesnt rely on anything in the drushrc files when doing backups and restores.

adrian’s picture

Status: Postponed (maintainer needs more info) » Fixed

marking fixed.

it's definitely encoding it when needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gmclelland’s picture

Version: » 6.x-1.1
Status: Closed (fixed) » Active

I'm running the latest aegir 1.1.

I'm changing this back to active. I had a mysql user that had a '#' sign in the password and the backups and migrate task failed. When I changed the password and removed the pound sign, everything worked again.

Here's some more context: When this happened I had imported an old outdated aegir managed site into the new aegir hostmaster as a platform. Then aegir picked up the site within the platform and imported the site. Before I did this, I had to manually create the db user, database, and then import the database.

anarcat’s picture

Status: Active » Patch (to be ported)
FileSize
1.17 KB

can you try this patch?

i committed this to 2.x, we can merge it in 1.x if it works.

anarcat’s picture

ping! @gmclelland - can you test the attached patch above?

gmclelland’s picture

@anarcat - checking it

gmclelland’s picture

@anarcat , yes that worked, thank you for fixing this

gmclelland’s picture

@anarcat - actually, I'm not sure that patch worked. Before I applied the patch I couldn't import the platform that had a site in it. After I applied to the patch, the site platform and site was able to be imported.

Later, I tried migrating the imported site to a new platform and Aegir gave me errors saying it couldn't connect to mysql. I changed the password from test# to test and it then migrated correctly.

Sorry to jump the gun. I think this may need more review.

anarcat’s picture

Status: Patch (to be ported) » Needs work

Alright, setting status. I guess I'll need to test this myself...

thsutton’s picture

Version: 6.x-1.1 » 6.x-1.6

I've just installed 1.6 using the Debian packages with a MySQL root password that contains a comma.

The `/var/aegir/.drush/server_localhost.alias.drushrc.php` that was created doubled encoded the database password (the , was replaced by %252C instead of just %2C) and the platform could not be verified. Removing the comma from the MySQL password and updating the platform resolved the issue for me, but I would rather like to be able to use non-alphanumeric characters in my password.

Steven Jones’s picture

Status: Needs work » Closed (cannot reproduce)

Just tested using 6.x-1.9 and this seems to be fixed, certainly I used a comma when installing and it worked fine.

  • Commit b8b350e on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_dns, dev_server_verify, prod-koumbit, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by adrian:
    fix for #724472 - run the db details through urldecode before generating...
  • Commit 7ade8a2 on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by anarcat:
    tentative patch for #724472 regression
    
    

  • adrian committed b8b350e on
    fix for #724472 - run the db details through urldecode before generating...
  • anarcat committed 7ade8a2 on
    tentative patch for #724472 regression
    
    

  • adrian committed b8b350e on 7.x-3.x-1966886-context-to-entity
    fix for #724472 - run the db details through urldecode before generating...
  • anarcat committed 7ade8a2 on 7.x-3.x-1966886-context-to-entity
    tentative patch for #724472 regression
    
    

  • adrian committed b8b350e on 6.x-2.x-1995506-profile-option
    fix for #724472 - run the db details through urldecode before generating...
  • anarcat committed 7ade8a2 on 6.x-2.x-1995506-profile-option
    tentative patch for #724472 regression