Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Automated backup script

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 3 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hydrianH
      hydrian
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • L
        Lee Sharp
        last edited by

        I get "Access Denied" when trying to get the scripts.

        1 Reply Last reply Reply Quote 0
        • hydrianH
          hydrian
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • hydrianH
            hydrian
            last edited by

            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/

            1 Reply Last reply Reply Quote 0
            • C
              churnd
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • hydrianH
                hydrian
                last edited by

                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/

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.