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

Who rated this post

[API]PYTHON PANDEVICE - SET SECURITY PROFILE

L1 Bithead

Hi all,

 

I'm using PaloAlto's API for the first time.

My idea is the following:

 

 - for each rule, I would like to apply a security profile based on the service setted.

 

Reading some docs online i wrote this pseudocode.

 

 

HOSTNAME = '192.168.55.10'
API_KEY = 'My_Api_Key'

fw = pandevice.firewall.Firewall(hostname=HOSTNAME, api_key=API_KEY)
rulebase = pandevice.policies.Rulebase()
fw.add(rulebase)
rules = pandevice.policies.SecurityRule.refreshall(rulebase)

for rule in rules:

       if (rule.service is ugual to any):

                 //set security_profile (like av,URL Filtering Profiles,Vulnerability Protection Profiles,etc...)

       rule.apply()

fw.commit(sync=True)

 

 

Do you have any ideas ? Could you help me?

Thanks in advice!

 

 

CHANGÒ
Who rated this post