Script to create multiple nodes on PANOS

Reply
Highlighted
L1 Bithead

Script to create multiple nodes on PANOS

Hi all,

 

Is there a quick way to script / create 50+ nodes on a PA Firewall (azure based)?

 

Cheers.

D

Highlighted
Cyber Elite

@alo_palto,

Are you just talking about creating large numbers of address objects? 

Highlighted
L1 Bithead

Exactly yes!

Highlighted
Cyber Elite

Hello,

You could export the config, modify/add the objects, and then import it. I dont see a way to do it with the API, but I could be wrong. Also can be done with Panorama.

 

Regards,

Highlighted
Cyber Elite

Couple ways you can do it, as @OtakarKlier has already mentioned:

CLI:

set address "My Server" ip-netmask 192.168.1.1/32 

You could set all of your set statements how you want and paste them in, which would work fine. 

 

Configuration File:

 

# FQDN #
            <entry name="updates.cuasvc.com">
              <fqdn>updates.cuasvc.com</fqdn>
              <tag>
                <member>Barracuda-Updates</member>
              </tag>
            </entry>
# Netmask #
            <entry name="Test-GlobalProtect">
              <ip-netmask>172.16.253.128/25</ip-netmask>
              <tag>
                <member>GlobalProtect</member>
              </tag>
            </entry>

You can locate where these go in your configuration file easier if you search for <address-group> since <address> is referenced a bit in the configuration file. 

 

API:

https://192.168.1.1/api/?key=MYAPIKEY&type=config&action=set&xpath=/config/shared/address/entry[@name='Google-DNS']&element=<ip-netmask>8.8.8.8/32</ip-netmask> 

 

You can use any of these methods to build out your address object base quickly. Personally; I'm a big fan of modifying the configuration file itself and feeding it back into the firewall, because you can put the configuration file into Git, but I also find XML easy to work with. 

Highlighted
L1 Bithead

Thanks guys, i went ahead and done it manually.

 

Sorry for slow reply here. Ill rereview next time i have a batch to add.

 

Out of curiousity, how does one go about exporting and reimporting the config file?

 

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!