Hi,
I use a .panrc file containing credentials for several PAN-OS firewalls:
hostname%firewall-a=192.0.2.10
api_key%firewall-a=...
hostname%firewall-b=192.0.2.11
api_key%firewall-b=...
I’m writing a monitoring script that needs to run the same operational command on each configured firewall.
At the moment, PanXapi(tag="firewall-a") works well when the tag is already known, but I couldn’t find a public method to list the tags available in .panrc. The script therefore has to parse the file itself.
Would it make sense to add something like this to PanRc?
from pan.rc import PanRc
tags = PanRc.list_tags()
For example:
from pan.rc import PanRc
from pan.xapi import PanXapi
for tag in PanRc.list_tags():
xapi = PanXapi(tag=tag)
xapi.op(cmd="show system info", cmd_xml=True)
The method could return unique tag names in a stable order, without exposing hostnames, API keys or other values.
A matching read-only CLI option could also be useful:
What do you think? If this would be useful and fits the project, I can put together an implementation and submit a pull request.
Hi,
I use a
.panrcfile containing credentials for several PAN-OS firewalls:I’m writing a monitoring script that needs to run the same operational command on each configured firewall.
At the moment,
PanXapi(tag="firewall-a")works well when the tag is already known, but I couldn’t find a public method to list the tags available in.panrc. The script therefore has to parse the file itself.Would it make sense to add something like this to
PanRc?For example:
The method could return unique tag names in a stable order, without exposing hostnames, API keys or other values.
A matching read-only CLI option could also be useful:
What do you think? If this would be useful and fits the project, I can put together an implementation and submit a pull request.