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

    Remote Backup pfSense with "curl"?

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    4 Posts 2 Posters 5.4k 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.
    • S
      sepp_huber
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • S
        sepp_huber
        last edited by

        Hello,

        I solved it with:
        scp (secure copy), cron

        Step 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.sh

        
        BACKUPDEST=/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…

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          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).

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • S
            sepp_huber
            last edited by

            Thanks for your hint!

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