Remote Backup pfSense with "curl"?
-
Hello,
I would like to do some periodical backups of my pfSense configuration. So I had a look in the Packages but there was only a package AutoConfigBackup which requires a subscription …
So my idea was to keep it it simple and do a direct backup from an external (backup) system which emulates a "Download configuration" in Diagnostics->Backup/Restore.
The modules is http://pfsense-url/diag_backup.php and I tried to do a multipart/form-data request with curl and set all request parameters to emulate this:
curl -F backuparea=ALL -F Submit='Download configuration' -F restoreare= -F conffile= -u 'username:password' -e http://xxx.xxx.xxx.xxx/diag_backup.php -v http://xxx.xxx.xxx.xxx/diag_backup.php
The result is an:
html ... 417 - Expectation Failed ...html
I also tried just a call to diag_backup.php without post … that's no problem!
curl -u 'username:password' -v http://xxx.xxx.xxx.xxx/diag_backup.php
I have already seen this Topic with rsync http://forum.pfsense.org/index.php/topic,11356.0.html
Any ideas?
Thanks for your help!
-
Hello,
I solved it with:
scp (secure copy), cronStep 0: repare non-password RSA key ==> for automatic proccessing
(see http://forum.pfsense.org/index.php/topic,11356.0.html)
I have generated the key on the backupsystem for a user "username" and not for root…Step 1: a script executed form the backupserver which copies the config from pfSense to the backupserver
backup_firewall_config.shBACKUPDEST=/backup_path/config_backup/ REMOTECONFIG="root@pfsense:/cf/conf/config.xml" scp $REMOTECONFIG $BACKUPDEST
Step 3: Cron entry in root's crontab to get the config hourly …
# pfSense backup */60 * * * * su - username -c "/home/username/backup_firewall_config.sh"
The difference to the other solution is, that this is only a backup of the config
file "/cf/conf/config.xml" and NOT a backup of the whole pfsense filesystem… -
There is an article about using wget to pull the config:
http://doc.pfsense.org/index.php/Remote_Config_Backup
It is also discussed in the book (see the link in my sig).
-
Thanks for your hint!