Show Local Device Policies

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Show Local Device Policies

L2 Linker

Hi all,

 

I'm searching through the API browser on my PAN-OS 8 instance, and wondering where the syntax exists for exploring/getting the local policies per-physical device.

 

Or for clarity's sake - what API endpoint would return all of the local device's security policies. I am using some from Panorama globally, and cleaning up local security policies.

 

Not asking for someone to write a query for me, just point me to the right place in the API, please.

 

Any help appreciated!

 

 

1 accepted solution

Accepted Solutions

L5 Sessionator

Policies on firewalls are located in `rulebase` under the vsys (for vsys1 below):

 

/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase

 

Policies on panorama are split between `pre-rulebase` and `post-rulebase` (for device group `Some group` below):

 

/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/pre-rulebase

/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/post-rulebase

View solution in original post

4 REPLIES 4

L5 Sessionator

Policies on firewalls are located in `rulebase` under the vsys (for vsys1 below):

 

/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase

 

Policies on panorama are split between `pre-rulebase` and `post-rulebase` (for device group `Some group` below):

 

/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/pre-rulebase

/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Some group']/post-rulebase

Awesome, thanks so much @gfreeman!

@gfreeman, if I enter:

 

/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase

 

into the XPath search in the API browser, I get a 403 response of:

 

panCmsHandleDeviceContextReq: getRemoteContent() got response code 403

 

and same response if I try and submit:

 

/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='nameofmyfirewall']/rulebase

 

I'm a super user on my Panorama instance, and have 1 vsys in it, so not sure why that query when hitting submit isn't working.

 

Halps?

Ended up realizing my own fail - was using the URL for panorama and not the device I wanted to target (d'oh!)

 

For anyone seeing this later, here's a Powershell function I wrote to pull the information I was after:

Function Get-LocalDeviceSecurityPolicies($DeviceIP)
{
$response = Invoke-RestMethod "https://$DeviceIP/api/?key=$apiKey&type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security"
return $response.response.result.security.rules.entry
}

  • 1 accepted solution
  • 3955 Views
  • 4 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!