Currently it is not possible to use Backup encryption in Schedule.
After installing Defuse PHP library I would expect to see Backup encryption option under Schedule, however at the moment its only supported in Backup => Advanced Backup making it useful only for one time backups.

Backup Schedule:

Schedule

Encrypt checkbox value and password are preserved during subsequent changes:

preserved values encrypt checkbox value and password

Generated backups after running cron:

Generated backups after running cron

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tamerzg created an issue. See original summary.

damienmckenna’s picture

Title: Add encryption option to Schedule » Add encryption option to backup schedule
Version: 5.0.2 » 5.1.x-dev

Yeah, I completely agree that should be an option for scheduled backups.

tamerzg’s picture

Assigned: Unassigned » tamerzg

tamerzg’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new253.16 KB
new255.6 KB
new215.84 KB

Created MR with added support for Encryption in scheduled backups.
Now when creating a schedule there is Backup Encryption fieldset which will be disabled if defuse php encrpytion is not installed and appropriate message is shown:

s

If the library is installed then you can enable/disable Encryption and set password:

enabled

Also in case of update user is asked if he wants to change the password, since pw field doesn't have default value and this will prevent overwritting password each time Schedule form is saved again.

edit

There is also an update hook which makes sure that previous Schedule configs have default value for new encrypt fields.
Since this PR has update hook, it would be good to also merge this PR: https://www.drupal.org/project/backup_migrate/issues/3338192
in order to get correct execution sequence.

damienmckenna’s picture

Assigned: tamerzg » Unassigned

Thanks for working on this, we'll take a look at it soon.

FYI as a reminder the "Assigned" field is for indicating that you're actively working on an issue, once you're finished please set the field to "Unassigned". Thank you.

tamerzg’s picture

Gotya about Assigned field.
I updated PR with new schema number for update hook (50002).

danrod’s picture

StatusFileSize
new29.29 KB
new19.98 KB

Tested this and works as expected, I can see the new "Encrypt" field in the "Schedule" config page, tested it as well, can be moved to RTBC if needed.

damienmckenna’s picture

Did you test that the backup was encrypted?

danrod’s picture

Hi @damienmckenna , I'll revisit this issue today.

danrod’s picture

Assigned: Unassigned » danrod
danrod’s picture

I applied some changes in the file src/Form/ScheduleForm.php because the encrypt values weren't being saved every time I saved the form, I fixed this in the last commit. Reviewing the changes now.

danrod’s picture

Issue summary: View changes
StatusFileSize
new46.39 KB
new37.83 KB
new53.57 KB

I reviewed the functionality and works as expected, I set up a backup schedule every 5 minutes, ran cron and I could see the encrypted backup with I restored and worked with no issues, moving this to RTBC so anyone could have a chance to review this as well.

danrod’s picture

Status: Needs review » Reviewed & tested by the community
danrod’s picture

Assigned: danrod » Unassigned
danrod’s picture

I fixed some extra PHPCS space issues. Tested functionality and still working as expected.

danrod’s picture

I'll merge it to the 5.1.x branch.

  • danrod committed 26cb603c on 5.1.x authored by tamerzg
    Issue #3320760: Add encryption option to backup schedule
    
danrod’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • danrod committed 15538bf8 on 5.0.x
    Issue #3320760 by tamerzg, danrod: Add encryption option to backup...
danrod’s picture

Committed the changes to the 5.0.x branch.

Status: Fixed » Closed (fixed)

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