cancel
Showing results for 
Search instead for 
Did you mean: 
Post a Question
Employee
Employee

Script to Automate GAIA Configuration backup

Hi,

i wrote below script for my customer to automate gaia configuration backup of gateway . Script runs on management and it can fetch the "show configuration"  of all the gateway and create a file for individual gateway .

Steps :

Perform below on management server .

 

  1. Create a Directory called gaiagwbkp under /var/log
  2.  Create a file called gateway_ip_list.txt under /opt/CPsuite-R80/fw1/scripts and add ip address of the gateway which is being managed by same management server
  3. [Expert@PROD-MGMT-R80:0]# cat gateway_ip_list.txt
    10.1.1.254
    [Expert@PROD-MGMT-R80:0]#
  4. Create a file called gaiafwbkp.sh under /opt/CPsuite-R80/fw1/scripts and copy the script content and change file permission

*****************************************

[Expert@PROD-MGMT-R80:0]# cat gaiafwbkp.sh
#!/bin/sh
source /opt/CPshrd-R80/tmp/.CPprofile.sh
for dest in $(<gateway_ip_list.txt); do
hostname=`cprid_util -server $dest -verbose rexec -rcmd /bin/bash -c "hostname"`
now=$(date +"%m_%d_%Y")
cprid_util -server $dest -verbose rexec -rcmd /bin/clish -c "show configuration" > /var/log/gaiagwbkp/$hostname$now
done

************************************

4. run script gaiafwbkp.sh

5. Schedule job from GAIA portal using job scheduler 

6. if needed you can run another job to ftp this backup files to ftp server as well

Labels (1)
Tags (1)
9 Replies
ED
Silver

Re: Script to Automate GAIA Configuration backup

Thanks for sharing, very useful. 

Re: Script to Automate GAIA Configuration backup

Nice!

0 Kudos

Re: Script to Automate GAIA Configuration backup

CDT is better way to do that. 

0 Kudos
Admin
Admin

Re: Script to Automate GAIA Configuration backup

CDT only works on R77.30 and later.

I could see this script being useful on older systems, potentially. 

That said, I must provide a word of caution with this approach. 

Especially in some earlier versions of Gaia, the order that "show configuration" outputs the commands in won't necessarily work when you import that same configuration.

Employee
Employee

Re: Script to Automate GAIA Configuration backup

Does CDT work for SMB appliances (1100's, 1400's) that are centrally managed?? One of the requirements is that the gateways are on Gaia R77.30 however the "Gaia Embedded" software line is only at R77.20.85 to date.
0 Kudos
Admin
Admin

Re: Script to Automate GAIA Configuration backup

CDT is not supported for SMB appliances.
Vladimir
Pearl

Re: Script to Automate GAIA Configuration backup

@PhoneBoy , yep: the add and set sequence gets out of whack. Still seeing it happening when attempting to replicate old Gaia configs on the newly deployed gateways using output of "show configuration".

Theoretically, pasting this file twice should solve these issues, as the prerequisites will take effect in the first pass and dependent settings in second.

0 Kudos

Re: Script to Automate GAIA Configuration backup

What is CDT?
0 Kudos

Re: Script to Automate GAIA Configuration backup

sk111158: Central Deployment Tool (CDT)

"IPS Immersion Training" Self-paced Video Class
Now Available at http://www.maxpowerfirewalls.com