F5 Automated Backups - The Right Way

Hi all,

 

Often I've been scouring the devcentral fora and codeshares to find that one piece of handywork that will drastically simplify my automated backup needs on F5 devices. Based on the works of Jason Rahm in his post "Third Time's the Charm: BIG-IP Backups Simplified with iCall" on the 26th of June 2013, I went ahead and created my own iApp that pretty much provides the answers for all my backup-needs.

Here's a feature list of this iApp:

  • It allows you to choose between both UCS or SCF as backup-types. (whilst providing ample warnings about SCF not being a very good restore-option due to the incompleteness in some cases)
  • It allows you to provide a passphrase for the UCS archives (the standard GUI also does this, so the iApp should too)
  • It allows you to not include the private keys (same thing: standard GUI does it, so the iApp does it too)
  • It allows you to set a Backup Schedule for every X minutes/hours/days/weeks/months or a custom selection of days in the week
  • It allows you to set the exact time, minute of the hour, day of the week or day of the month when the backup should be performed (depending on the usefulness with regards to the schedule type)
  • It allows you to transfer the backup files to external devices using 4 different protocols, next to providing local storage on the device itself
    • SCP (username/private key without password)
    • SFTP (username/private key without password)
    • FTP (username/password)
    • SMB (using smbclient, with username/password)
    • Local Storage (/var/local/ucs or /var/local/scf)
  • It stores all passwords and private keys in a secure fashion: encrypted by the master key of the unit (f5mku), rendering it safe to store the backups, including the credentials off-box
  • It has a configurable automatic pruning function for the Local Storage option, so the disk doesn't fill up (i.e. keep last X backup files)
  • It allows you to configure the filename using the date/time wildcards from the tcl [clock] command, as well as providing a variable to include the hostname
  • It requires only the WebGUI to establish the configuration you desire
  • It allows you to disable the processes for automated backup, without you having to remove the Application Service or losing any previously entered settings
  • For the external shellscripts it automatically generates, the credentials are stored in encrypted form (using the master key)
  • It allows you to no longer be required to make modifications on the linux command line to get your automated backups running after an RMA or restore operation
  • It cleans up after itself, which means there are no extraneous shellscripts or status files lingering around after the scripts execute

I wasn't able to upload the iApp template to this article, so I threw it on pastebin: http://pastebin.com/YbDj3eMN

 

Enjoy!

Thomas Schockaert

Published Mar 13, 2014
Version 1.0
  • Hi,

     

     

    You can find the private key by first generating a public/private keypair for SSH by using the command 'sshkeygen -t rsa'.

     

     

    This will save id_rsa and id_rsa.pub in ~/.ssh.

     

    You will then need to copy the contents of id_rsa.pub to the authorized_keys file on the target server and copy the contents of id_rsa into the iApp as the private key.

     

     

    I hope this helps,

     

     

    Kind regards,

     

     

    Thomas
  • I get the following errog:

     

    Ending iApp /Common/f5.automated_backup.v2.0 03/20/2014 17:37:36

     

    Run time 240 msec

     

     

    Saving active configuration...

     

    /var/local/ucs/bigipA.local_20140320_173737.ucs is saved.

     

    Script (/Common/f5.automated_backup) generated this Tcl error:

     

    script did not successfully complete: (Permission denied, please try again.

     

    Permission denied, please try again.

     

    Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

     

    lost connection

     

    while executing

     

    "exec $scriptfile" line:18)

     

     

     

    Where can I find the SSH Private Key to add in the iApp?

     

    Thanks and kind regards
  • It requires v11.4 because of the iCall feature to do the scheduling. It should be possible to create something that is capable of writing the scheduling information to a crontab entry instead of doing it via iCall too.
  • Thanks Mohamed, I'll have to upgrade to 11.4 first :) Only just finished settling down on 11.3! Keeps me in work I suppose!
  • Yes, it seems to require 11.4 and above. Save the source to a file, import it as a template, then create a new iApp based off of the template.
  • Is this supposed to be saved as a .tmpl file and then imported? Created manually by creating a new iapp template? Tried both and not got anywhere. Bit of a pointer please? :)