PaloAltoNetworks / PaloAltoNetworks/pan-os-python

Bring Back Date Modified and Date Created to PaloAlto Security Rules

Open
#506 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
400
Forks
199
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem?

There are no timestamps coming from the API pull for when a Security Rule for Post Rule or Pre rules where Modified or Created. For Auditing purposes my company would like to look at all the firewalls in our fleet have last updated their rules.

Describe the solution you'd like

Have the pan-os-python latest update include the date the rule was created and the date when the rule was last modified.

Describe alternatives you've considered

I have looked at old methods that use xpath at it seems like this used to be an option.

from pandevice import firewall

# Create a connection to Panorama
pano = panorama.Panorama(api_username='admin', api_password='password', hostname='panorama')

# Get a list of all the managed firewalls
fw_list = pano.refresh_devices()

# Get a specific firewall by name
fw = firewall.Firewall('firewall1')
pano.add(fw)

# Retrieve the modification timestamp for a specific security rule on the firewall
xpath = "/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='my_rule']"
response = fw.xapi.show(xpath=xpath, cmd_xml=False)

# Extract the modification timestamp from the response
timestamp = response.find('./result/entry/timestamp').text

print(f"The last modified timestamp for the rule is: {timestamp}")

However since the configuration of Palo Alto does not the date the rule was created and the date when the rule was last modified it is not coming through the pan-os-api.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by verifying whether the Palo Alto API exposes creation and modification timestamps for pre- and post-rule security rules, comparing the old XPath example with current pan-os-python behavior. Done means documenting the limitation or exposing both timestamps when the API provides them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.