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

    pfSense Auto Backup

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 4 Posters 446 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.
    • VioletDragonV
      VioletDragon
      last edited by

      Howdy folks,

      Just a quick question, is there a way to schedule auto backups to a local Storage Server ? i.e firewall rules etc?

      Regards

      E GertjanG 2 Replies Last reply Reply Quote 0
      • E
        elvisimprsntr @VioletDragon
        last edited by

        @VioletDragon

        I set up my own home grown cron job

        You will have to set up a SSH private/public key pair and install the pfsense cron package.

        #!/bin/sh
        VERSION=`cat /etc/version`
        DATE=`date +%Y%m%d`
        FILE="config_`hostname -s`_"$DATE"_"$VERSION".xml"
        NAS="nas-1"
        PATH="/mnt/data/Software/pfsense"
        
        # mkdir /media/usb
        
        /sbin/mount_msdosfs /dev/da0s1 /media/usb
        if [ "$?" -eq "0" ]; then
        	echo "USB found"
        	/bin/cp /cf/conf/config.xml /media/usb/$FILE
        	echo "Backup $FILE created"
        	/usr/bin/find /media/usb/ -name "config_*.xml" -mtime +365 -exec rm {} \;
        	/sbin/umount /media/usb	
        else
        	echo "USB not found"
        fi	
        
        /sbin/ping -c 3 $NAS > /dev/null 2>&1
        	if [ $? -eq 0 ]; then
        		echo "$NAS found" 
        		/usr/bin/scp /cf/conf/config.xml root@$NAS:$PATH/$FILE
        		/usr/bin/scp /root/pkg_check.php root@$NAS:$PATH/
        		/usr/bin/scp /root/att_cidr.sh root@$NAS:$PATH/
        		/usr/bin/scp /root/backup.sh root@$NAS:$PATH/
        		echo "Backup $FILE copied to $NAS"
        	else
        		echo "$NAS not found"
        	fi
        	
        # install cron package and add cron job
        # 0 4 * * Sun /bin/sh /root/backup.sh > /dev/null
        
        
        1 Reply Last reply Reply Quote 1
        • GertjanG
          Gertjan @VioletDragon
          last edited by

          @VioletDragon said in pfSense Auto Backup:

          is there a way to schedule auto backups to a local Storage Server ? i.e firewall rules etc?

          What I use : If you have a "Windows PC" that is 'on' one in a while, have a look, at this
          https://github.com/KoenZomers/pfSenseBackup

          It will login to pfSense over SSH at a predetermined hour, I've set up an entry in the Windows Task planner (manager ?) for that : every morning at 08 AM and it will do its job. It well keep the the list with downloaded xml files to a preset length, deleting the oldest ones (set mine to "100").

          I'm not saying the free service from Netgate isn't any good, it is good.
          But a daily local copy, I've nothing against that neither ^^

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 1
          • VioletDragonV
            VioletDragon
            last edited by

            Do you know if this will backup configs for like pfBlockerng, Snort etc?

            GertjanG 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              All of that is in the main config file. The definitions etc are not but they would be downloaded again after restoring the config.

              Also check: https://docs.netgate.com/pfsense/en/latest/backup/remote-backup.html

              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @VioletDragon
                last edited by

                @VioletDragon said in pfSense Auto Backup:

                Do you know if this will backup configs for like pfBlockerng, Snort etc?

                You've missed somehow what pfSense is.
                Ok, its a firewall router. Like many out there, With tonnes of extras.
                The main difference with other firewalls is that is is for 99,9 % Web interface driven, and it has just one (1) config file. This file contains everything.

                Just read it : export it and open it in a text editor. You'll get the picture quickly.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

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