Tuesday, October 11, 2011

nosupportlinuxhosting revisited - backups

During the week-end, the server on which I'm hosted at nosupportlinuxhosting has been compromised using a known security issue with Cpanel.  The staff at nosupportlinuxhosting reinstalled all the software from scratch, which is good.  However, all data was deleted in the process, including the backups.  The staff told me that in such an exploit would have compromised the backups anyway.  They told me to have local backups, saying that we should not rely on server-side backups and to take a backup of my site every time it changes using the cpanel interface.  But... when you're hosting a forum, the site changes everytime someone add or edits a post.

So I though that I would give up trying to make them give me a solution to automate the backup process.  It was quite easy because rsync is available in the shell they provide.  And SSH.  So what I did is to create a cronjob in the cpanel' interface that looks like this: /usr/bin/rsync --include=".*/" -ae ssh ~/* backups@remotehost:~/sitename/.  Of course, there is a prerequisite of setting a passphraseless ssh key, but that is quite simple to me.  That is what I did for my friend who has a simple site, as a test.  I'll eventually change that to make the rsync process start from my remotehost (my home server).  For my domain, what I plan to do is to first run an ssh command that will run mysqlbackup to create a mysql backup in my home, then do the rsync.  I think I'll make a daily and a weekly job.  For the config, I think that in the past I could use wget to download a daily backup of forwarders and other cpanel config.   I'll have to test to see if it is still possible.  If not I'll have to back it up once... it doesn't change.

Labels: , , ,