PaloAltoNetworks / PaloAltoNetworks/pan-os-python

Security rule targets are missing the vsys identifier

Open
#199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

The vsys identifier is missing from security rule targets. Only the firewall serial number is returned.

Expected behavior

The target of a security policy should return the virtual system that the rule is targeting in addition to the serial number for multi-vsys firewalls. Example: [ "SERIAL-NO1/vsys2", "SERIAL-NO2/vsys2" ]

Additionally, updating the target of a policy should be able to handle virtual system identifiers in the same format, which is how virtual systems are displayed in the UI.

Current behavior

Only the serial numbers are returned in the target list. Example: ["SERIAL-NO1","SERIAL-NO2"]

Possible solution

Update the parsing of the target parameter to look for the virtual system in the XML. The current VersionedParamPath method does not support looking for children, which is how virtual systems are stored in the target XML of a security policy:

<target>
    <negate>no</negate>
    <devices>
        <entry name="SERIAL-NO1">
            <vsys>
                <entry name="vsys2"/>
            </vsys>
        </entry>
    </devices>
</target>

Steps to reproduce

  1. Create new panorama device (PanDevice.create_from_device)
  2. Create a new DeviceGroup class and add to panorama device.
  3. Create a new PreRulebase class and add to the DeviceGroup.
  4. Execute a refreshall (pandevice.policies.SecurityRule.refreshall) to pull in all security policies and loop through rule target values.

Screenshots

None

Context

Issue prevents correctly pulling current rulebase configuration from Panorama and prevents the modification of Ansible modules to deploy a security rule to a specified virtual system of a firewall.

Your Environment

python 3.6.8
pan-python 0.16.0
pandevice 0.14.0
Windows 10

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

Start with VersionedParamPath and the target handling used by pandevice.policies.SecurityRule.refreshall; reproduce the issue using the documented Panorama and DeviceGroup setup. Inspect the target XML's nested vsys entry and update parsing and serialization so targets use the SERIAL-NO/vsys format for both reads and updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.