Aegir has a separation is user privileges. The backups are made by provision running as the aegir user.
Ant to the best of my knowledge the default file permissions do not allow the apache user to access these backup files directly.

My first test to retrieve a backup resulted in the following error:

warning: fopen(/var/aegir/backups/d7minimal-20110922.094045.tar.gz)
[function.fopen]: failed to open stream: Permission denied in
/data/aegir/hostmaster-6.x-1.6/sites/aegirtest.local.initfour.nl/modules/hosting_site_backup_manager/hosting_site_backup_manager.module
on line 262.

Loosening the permission is one option but not preferable to me. I would not want a regular site hosted on my Aegir platform to be able to access these backups.
There must be some creative way to pass the backup over without compromising security too mush.

Comments

miechiel’s picture

Assigned: Unassigned » miechiel
Status: Active » Postponed (maintainer needs more info)

Could you provide some more info about your servers specs, users and groups?

We have tested this module using 2 ubuntu machine (one online hostmaster and one virtual machine) with the automatic installation found on the community Aegir website (http://community.aegirproject.org/content/installing/automatic-installat...)

All the files at the backup location have 644 permissions with user and group both on the Aegir user. And because the files are not in the apache directories the files can only be accessed through the Aegir interface.

Accessing a url to a download file without being logged in to Aegir will give you an Acces denied.

helmo’s picture

The backup files indeed get 644 as permission, but my ~aegir/backups/ folder has a permission of 700

On two Debian machines, one using the install script the other using the Debian packages.

miechiel’s picture

Status: Postponed (maintainer needs more info) » Active

Thanks for your fast reply!

Working on it

miechiel’s picture

Status: Active » Fixed

Updated the code. Works on our test Aegir environments.

Could you also test the latest version of the 6.x.1.x branch?

helmo’s picture

Status: Fixed » Active

The directory sites/aegirtest.local/files/site-backups has been created.

warning: fopen(sites/aegirtest.local/files/site-backups/d7minimal2-20110922.094926.tar.gz) [function.fopen]: failed to open stream: Permission denied in /data/aegir/hostmaster-6.x-1.6/sites/aegirtest.local/modules/hosting_site_backup_manager/hosting_site_backup_manager.module on line 285.

Creating a symlink is not helping here. As apache just does not have access to the backup file.

What if we created a mini task in drush/provision to provide access to the backup?

This task could either:

  • hardlink the file to files/site-backups/ (depends on backups being on the same filesystem)
  • copy the file to files/site-backups/ (might be slow for large backups)
  • Some other way to grant apache granular temporary access. ACL maybe?
miechiel’s picture

Damn! you got me there.
Seems that our backups folder has 701 permission. Then it works (of course).

  • Hardlinking doesn't work in php because of folder permissions
  • We are not going too copy files because it can grow excessively.
  • ACL is complicated and you probably need to install dependencies.

What about this...

  1. We write a provision task (new button)
  2. This task crates a new folder with the appropriate permissions in the aegir root dir called 'backup-exports'
  3. The task then creates a subfolder based on client / site information.
  4. Here we place a hardlink to the actual backup file.
  5. In the Aegir front end we check for the existence of the hardlink if available the download button becomes active.
helmo’s picture

Too bad we need a separate task but I also don't really see any other way the this two-step process.

I see in Git that Gerben already started to work on this, nice.

We should think of some automatic process to let these files expire after a short amount of time.

helmo’s picture

The recent progress from on an export and remove task look really good.

I think we can almost close this issue.

I've opens a new issue about cleaning up in case the download does not happen: #1579800: Auto expire exported backups

helmo’s picture

Status: Active » Fixed

Closing this issue as I've finally found some time to address #1579800: Auto expire exported backups

Status: Fixed » Closed (fixed)

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