Automatic backup to FTP server



  • I don't know if this already exists but I found nothing about how to do this.  I am looking at deploying this product in about 20-30 locations.  I would like to be able to have the pfsense device perform a nightly backup of the config to a remote loaction.  This would be so that in the event of a failure, I could take a replacement device, apply the latest config, ship it to them and all they would need to do is plug it in.  I am assuming this could be done VIA FTP or preferably some type of encrypted FTP.  What would be great is on the Backup/Restore page an option to schedule backups to a remote site.

    Thanks,

    Mark



  • Backing up entire config:

    wget -q –post-data 'Submit=download' --http-user=admin --http-passwd= <password>--sslcertfile=./<pfsense>.cert https://<pfsense>/diag_backup.php -O <pfsense>_backup.xml

    Backing up a specifc area:

    wget -qO /tmp/aliases_backup.xml --post-data
    'Submit=Download&backuparea=aliases' --user=admin --password=pfsense
    --no-check-certificate "https://192.168.1.1/diag_backup.php"</pfsense></pfsense></pfsense></password>



  • I am a newbie so please forgive the questions if they seem like they should be understood.  I am looking for a way to do this automatically.  Either initiating from a central MS Windows server or pushing from the clients.  Is there an FTP client which could connect and remotely backup?  Where do I run these scripts from?

    Thanks



  • These are unix/linux/freebsd commands that would retrieve the configuration file.  I know of no out of the box solution that will do what you want.  A little elbow grease is required.



  • I read somewhere on the site about WinSCP.  Is this something I could use?  http://forum.pfsense.org/index.php/topic,785.0.html

    Or should I just post a bounty?



  • Have a look at http://winscp.net/eng/docs/scripting#console how to do scripted events. If you prefer using a Windows server to collect the configs from your pfSense installs you can schedule some tasks to do so.



  • Everytime I try to connect I get the following error:





  • You have to use sftp(fallback scp) as protocol (the middle option). Login as user "root" and password <webguipassword>.</webguipassword>



  • Excellent!!!!!!!!!!…One last question.  If I backup the config.xml...How does that effect any packages that I have added?  Is that information in the config/xml so when I reload a config it will automatically install the packages which were previously installed?

    Thanks



  • You have to manually install the packages but their settings will be stored in the config.xml.



  • Found a great product…http://www.xi-soft.com/  Lets me connect and schedule backups of the configs using the application.  Only $24 if bought.  Tried it out.  Lets me do any schedule.

    Just mapped to the file and it worked perfectly.

    Thanks for the help.



  • If others would like to be able to do this for large installations I will create a tutorial once I feel comfortable with the program.  Let me know.

    Thanks,

    Mark



  • Not sure others want to buy a software if you can simply script it with the free winscp or even with the solution scott pointed out earlier in this thread but fell free to do a tutorial.  ;)



  • No offense, but I don't understand why you are going to pay for something that you can get for free even on Windows.

    Just use the Windows Task Scheduler! It's a native Windows feature. See:

    http://www.iopus.com/guides/winscheduler.htm
    http://support.microsoft.com/kb/308569

    Additionally I was using PuTTY's pscp commandline utility to do the actual download. To do the download you have to execute pscp like this:

    
    "C:\Programme\Simon Tatham\PuTTY\pscp -P 22 -l root -pw pfsense -2 -batch gw-buero.abyssworld.de:\conf\config.xml c:\blah.xml"
    
    

    This downloads the config.xml to c:\blah.xml.

    Cheers
    Daniel S. Haischt



  • No offense taken….the more help the better.  If someone has a better idea or easier way to acheive the same goal I am all for it.  I am a windows guy and because of that I tend to lean towards gui applications to perform what I am trying to do.  My other reason is I wanted to be able to receive an email notification if failure occured when trying to copy the file.  If there is a reliable way to do this for free I am all for it.

    Thanks again for all your help.

    Mark



  • @kapara:

    No offense taken….the more help the better.  If someone has a better idea or easier way to acheive the same goal I am all for it.  I am a windows guy and because of that I tend to lean towards gui applications to perform what I am trying to do.  My other reason is I wanted to be able to receive an email notification if failure occured when trying to copy the file.  If there is a reliable way to do this for free I am all for it.

    Thanks again for all your help.

    Mark

    ReRead Daniels post.  He gave you a free windows solution.



  • I did read it and yes it is a good solution…but as I stated I would like to be able to receive an email notification if failure occurs because I am looking to backup 25+ boxes.  Just to make sure I read about Putty's PSCP and MS Scheduler and found nothing regarding email notification.  If I have over looked something, my apologies.

    Mark



  • There are free tools to send mails from a batchjob as well like http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm
    Discover the power of scripting  ;)



  • Sounds good.  Now I will have to see if there is a way to use this new program with putty's solution to email me only if failure occurs.  I used a site a while back called batchworld for assistance with scripting.  http://groups.yahoo.com/group/batchworld/ They are very helpful with giving answers to this kind of stuff.  Thanks for the tip on the commandline email utility.

    Mark



  • winscp will return an error to the caller if it fails.  Check for a failure code.  This is all possible on windows shell scripting.


Locked