Here's my simple backup script function. Just stick it into a /bin/sh script (should work in bash too) and call it once per pfSense instance. I've been using this for years to backup my production firewalls.
pfsense_config() { local FWNAME FWURL FWPASS CSRF CSRF2 COOKIEFILE PFDATE FWNAME="$1" FWPASS="$2" FWURL="https://${FWNAME}" COOKIEFILE=`mktemp -t cookies` PFDATE=`date +%Y%m%d%H%M%S` printf "Downloading Firewall Config for $FWNAME\n" CSRF=`curl -k -L -c ${COOKIEFILE} ${FWURL}/diag_backup.php | grep "name='__csrf_magic'" | head -1 | sed 's/.*value="\(.*\)".*/\1/'` CSRF2=`curl -k -L -c ${COOKIEFILE} -b ${COOKIEFILE} -d "login=Login&usernamefld=admin&passwordfld=$FWPASS&__csrf_magic=${CSRF}" ${FWURL}/diag_backup.php | grep "name='__csrf_magic'" | head -1 | sed 's/.*value="\(.*\)".*/\1/'` curl -k -b ${COOKIEFILE} -d "Submit=download&donotbackuprrd=checked&__csrf_magic=${CSRF2}" -o config-$FWNAME-$PFDATE.xml ${FWURL}/diag_backup.php rm -f ${COOKIEFILE} } You call it like this: pfsense_config firewall.example.com mySecr3tPassword and it stores the backup XML in a file based on the date and firewall name. _______________________________________________ pfSense mailing list https://lists.pfsense.org/mailman/listinfo/list Support the project with Gold! https://pfsense.org/gold