Is it possible to restore a backup encrypted with AES without first decrypting it; in other words, can I simply upload the .aes-extension backup file?

Many thanks in advance,

Alex

Comments

ronan’s picture

Status: Active » Fixed

You should be able to just upload it as long as the password is set up the same but ALWAYS test your backups.

alexharries’s picture

Priority: Normal » Major
Status: Fixed » Active

No, the module only allows files with the extensions gz zip sql mysql bz and bz2 to be uploaded :(

I hope you don't mind me re-opening and setting to "major" until a resolution is found?

Many thanks,

Alex

ronan’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Hmm. It works when I test it. Do you have AES installed and configured on your destination site? Can you give me a screenshot of the error you're getting?

ar-jan’s picture

Status: Postponed (maintainer needs more info) » Active

I can confirm this:

The specified file MySite-2013-04-30T18-42-04.mysql.gz.aes could not be uploaded. Only files with the following extensions are allowed: gz zip sql mysql bz bz2.

When I remove the .aes extension and upload, I get a php error:
PDOException: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters in backup_migrate_destination_db_mysql->_restore_db_from_file() (line 198 of sites/all/modules/contrib/backup_migrate/includes/destinations.db.mysql.inc).

This is on a cleanly installed Drupal site, with the AES settings and key (file based, set to path private://aes.txt) exactly as on the site where the backup was made, and B&M's default profile configured to use AES. Version 7.x-2.5.

botris’s picture

Confirming this problem. Solution for both 7.x-2.x-dev & 7.x-3.x-dev (not 7.x-2.7) is to change backup_migrate.module:
$validators = array('file_validate_extensions' => array('gz zip sql mysql bz bz2'));
to
$validators = array('file_validate_extensions' => array('gz zip sql mysql bz bz2 aes'));
It seems to small a change for a real patch, but if you want I'll make one.

ronan’s picture

Issue summary: View changes
Status: Active » Fixed

I guess I've never tested uploading an AES file that isn't also compressed. Fixed now.

Status: Fixed » Closed (fixed)

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

DanielZ123’s picture

Hello ronan,

sorry for asking, but what do you mean with 'fixed now'? In the actual version it is still not fixed. Or do i need to install a patch or something like that?

Many thanks,
Daniel

TryAgain y veras’s picture

Hi DanielZ123, did you check if it´s fixed in the dev version?

DanielZ123’s picture

Oh no, I used the recommended release...
Thank you very much!

jukka792’s picture

Is this only available in dev version? Not able to upload .aes file using 7.x-3.1

alexharries’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Closed (fixed) » Active

Re-opening as this issue is still present in 7.x-3.1.

I also installed a command line AES encryption/decryption app - AESCrypt - which is saying the AES backup files seem to be corrupted.

Could you provide some guidance on how users should decrypt their database dumps, or how they can restore them to their servers please?

mrsdohpaz’s picture

Issue is still present in 7.x-3.x-dev and 7.x-3.1
I've tried allowing the aes extension as a patch but it's still throwing the SQL exception.

PDOException: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters in backup_migrate_source_db_mysql->_restore_db_from_file() (line 199 of [path]/backup_migrate/includes/sources.db.mysql.inc).

Tried manually compressing the file before restore and still get an error:

Unable to restore from file [filename].aes because a aes file can't be restored to this database.

UPDATE::
This may help others who come across this problem. After you configure BAM and AES settings, do a non-encrypted backup and restore to another site. I chose to use file key storage and set my own key. Saved this file key locally. After restoring the first time unencrypted and patching backup_migrate.module with #5, was able to restore using .aes files.

ranelpadon’s picture

For those wanting to decrypt the AES-encrypted backup files via terminal and not using the Drupal Admin UI (which is not possible when site is down), we ended up creating a stand-alone, custom PHP script that could be run in terminal. Our custom script successfully decrypted the files. See details here: http://dropbucket.org/node/9160.