Automated backup script
-
I have seen a few requests for backup scripts on the forums and around the net. Most of the replies only refer to the code snippet example on http://doc.pfsense.org/index.php/Remote_Config_Backup. While that code example is usable, it is not most secure.
Since I use pfSense on both my home network and at work, I thought I would share the script I use to backup pfSense 2.x. I have developed a script using bash/perl that should run on most *nix machines. You can find it on my blog at this link (http://tygerclan.net/?q=node/53). If you have any problems or reasonable enhancement requests, just update this topic and I will address them.
-
I get "Access Denied" when trying to get the scripts.
-
Sorry about that. I have something wrong with my blog.
I have moved the script/code to Google Code. You can pull the files from SVN Truck. No compilation required.
-
Actually, I just tagged a version for release. You can get it at at http://pfsense-backups.googlecode.com/svn/tags/pfsense2-backup-0.1.0/
-
Thanks for this. I'm using it. Works great!
Also, if you want to backup the RRD graphs, modify this line of pfsense2-backup.sh:
## Getting backup file over HTTPS wget --quiet --keep-session-cookies --load-cookies ${COOKIEFILE} \ --post-data 'Submit=download&donotbackuprrd=yes' "https://${PFSHOSTNAME}/diag_backup.php" \ --no-check-certificate -O "${BACKUPDIR}/${BACKUPFILE}" BACKUPRES=$?
& just remove "&donotbackuprrd=yes", so it's
## Getting backup file over HTTPS wget --quiet --keep-session-cookies --load-cookies ${COOKIEFILE} \ --post-data 'Submit=download' "https://${PFSHOSTNAME}/diag_backup.php" \ --no-check-certificate -O "${BACKUPDIR}/${BACKUPFILE}" BACKUPRES=$?
I suppose it could be made into an option, as in give –post-data a variable that's specified in the conf file.
-
For those that are interested, I have updated the script to support the download of the RRD data. It now supports pfSense encryption too. To get the most recent version of the code, you can download it from: http://code.google.com/p/pfsense-backups/