Enhanced Security Measures in Place:   To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.

Script to create multiple nodes on PANOS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Script to create multiple nodes on PANOS

L1 Bithead

Hi all,

 

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

 

Cheers.

D

5 REPLIES 5

Cyber Elite
Cyber Elite

@alo_palto,

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

Exactly yes!

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,

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. 

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?

 

  • 3394 Views
  • 5 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!