Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Steve_Vandegaer
Contributor

scp with cprid_util

Hi all,

I'm looking for an easy way to get the Gaia config from multiple gateways and store in one place. My ideas was to try this with cpdir_util. I tried:

`$CPDIR/bin/cprid_util -server $IP -timeout 5 -verbose rexec -rcmd /bin/clish -s -c 'save configuration $GW'`
Where GW is a variable, this just saved the config with the name $GW in /

Not getting this to work I just used a fixed name

`$CPDIR/bin/cprid_util -server $IP -timeout 5 -verbose rexec -rcmd /bin/clish -s -c 'save configuration test_steve'`
This saves the file in /

So next I wanted to copy it to the management server

`$CPDIR/bin/cprid_util -server $IP -timeout 5 -verbose rexec -rcmd bash -c "scp /test_steve adminNXO@MGMT_IP:/home/admin/CP_migration/@GW"`

Trying to rename it during the scp. This doesn't work and even when just trying a fixed name the copy isn't done.

Anyone has any way to do this?

Thanks

0 Kudos
11 Replies
Maarten_Sjouw
Champion
Champion

The error you are making here is that the $GW variable is inside the brackets, that will just be moved over as text as within Clish you cannot use a normal variable this will not work at all.

The second time you will be able to use a variable but is that a variable available locally on the gateway or is it only on the management server that you are running cprid_util from? For the latter, you should try to move the variable outside the brackets so it will be converted first.

Hope it makes sense.

Regards, Maarten
0 Kudos
Steve_Vandegaer
Contributor

Ok but even this command doesn't do the copy

`$CPDIR/bin/cprid_util -server $IP -timeout 5 -verbose rexec -rcmd bash -c "scp /test_steve adminNXO@MGMT_IP:/home/adminNXO/CP_migration/"`

Here I would expect to see the file test_steve in the folder on the mgmt

0 Kudos
Danny
Champion Champion
Champion

Try this:

for i in `grep 'sic_name\|ipaddr' $FWDIR/conf/objects.C|grep -A1 sic_name|grep 'ipaddr '|tr -d ':ipadr ()\t'`; do cprid_util -server $i -verbose rexec -rcmd /bin/clish -c "show configuration"; done > gaia_backup_all_$(date +%Y%m%d%H%M)
 
Steve_Vandegaer
Contributor

Any way to replace gaia_backup_all with the hostname of the gw it takes a backup from?

0 Kudos
Danny
Champion Champion
Champion

Sure, just split gaia_backup_all into single confguration files like this:

csplit -z gaia_backup_all /\#\ Configuration/ '{*}'; for i in xx*; do mv $i $(head -1 $i|awk 'NF>1{print $NF}'); done
Steve_Vandegaer
Contributor

Thanks a lot, this saves me a lot of work.

0 Kudos
HeikoAnkenbrand
Champion Champion
Champion

Hi @Steve_Vandegaer,

use this script:

Easy Backup Tool - (migrate export + all GAIA configs)

This tool creates a backup of all GAIA gateway configurations with one CLI command "ebackup" and more other functions!

Only one CLI command "ebackup"
- Backup of all Gaia gateway configurations (Check Point appliances, Open Server, SMB appliances 11xx, 14xx)
- Migrate export on SMS
- Migrate-server on MDS
- Backup all files to one TGZ file
- FTP upload support backup file
- CP upload support for backup file via cprid_util

or

Easy execute CLI commands on all gateways simultaneously

 

➜ CCSM Elite, CCME, CCTE ➜ www.checkpoint.tips
Simon_Macpherso
Advisor

Does this script select all gateways, including those that are members of a cluster? 

0 Kudos
daveTaylor
Participant
Participant

Does this only work for R80 versions? I tried it on R81.20 and I get an error [NULL BUF]

0 Kudos
SCSupport
Contributor

yes it seems R81.x will need some mods to the script

0 Kudos
Bob_Zimmerman
Authority
Authority

"(NULL BUF)" means CPRID tried to do something which didn't work. Any number of things can cause this. Do you have any other firewall between the management server and the firewalls it manages?

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events