Tuesday, April 18, 2023

HOWTO Backup Panorama with a API call

 One of my colleagues was discussing a way to backup panorama cfg vrs with the "schedule backup export" option that Palo has.




The problem with Scheduled Config Export the save file does not have the time stamps in the name

By using the API you can set the timestamp  by using the date cmd

https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-panorama-api/pan-os-xml-api-use-cases/query-a-firewall-from-panorama-api


e.g 

create the API key

curl -k -X GET 'https:///panorama.socpuppets.com/api/?type=keygen&user=kfelix&password=ChangeME2023%21%40%23'


run the API call every hour and download the file

curl -o panorama.`date +%F-%H-%M-%S`.xml -k  'https://panorama.socpuppets.com/api/?type=op&cmd=<show><config><running><%2Frunning><%2Fconfig><%2Fshow>&key=LUFRPT1lL0I0YkFhMFNIOUs1RDRiUFFBVDAvOXdxNjQ9WmNaa1JrblVuMEVubFBBNlVJT3loWk9VT0F5VThiK0s1UmFjTVhwa0oyVJJyV21YREFSeFFnZmFXVzUrb0luZw=='

No comments:

Post a Comment