pfSense Auto Backup
-
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
-
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
-
@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/pfSenseBackupIt 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 ^^ -
Do you know if this will backup configs for like pfBlockerng, Snort etc?
-
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
-
@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.