<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Confirm Xpath for rule build (not sure if github code is right for new rule add in VM-Series in the Public Cloud</title>
    <link>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157467#M62</link>
    <description>&lt;P&gt;supposdly the paloalto.py file below should work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def paloalto_rule_add(pa_ip,pa_key,rule_params):&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Add a new rule on Palo Alto gateway&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Input: Palo Alto gateway IP, Palo Alto Access Key, and rule_params&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params are the parameters to be configured for the new rule. It is a dictionary with the following values:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['name']: name of the rule&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['dstZone']: destination zone&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['srcZone']: source zone&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['srcIP']: list of source IP addresses&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['dstIP']: list of destination IP addresses&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['application']: application&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['service']: service&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['action']: rule action (allow, deny)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['spg']: name of security group profile to be set&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Output: returns 'success' or 'fail' depending on the result&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx = ssl.create_default_context()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx.check_hostname = False&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx.verify_mode = ssl.CERT_NONE&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cmd = "/api/?type=config&amp;amp;action=set&amp;amp;"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;parameters = {'xpath':"/config/devices/entry[@name=\'localhost.localdomain\']/vsys/entry[@name=\'vsys1\']/rulebase/security/rules/entry[@name=\'"+rule_params['name']+"\']",'element':"&amp;lt;to&amp;gt;&amp;lt;member&amp;gt;"+rule_params['dstZone']+"&amp;lt;/member&amp;gt;&amp;lt;/to&amp;gt;&amp;lt;from&amp;gt;&amp;lt;member&amp;gt;"+rule_params['srcZone']+"&amp;lt;/member&amp;gt;&amp;lt;/from&amp;gt;&amp;lt;source&amp;gt;"+rule_source_ip+"&amp;lt;/source&amp;gt;&amp;lt;destination&amp;gt;"+rule_destination_ip+"&amp;lt;/destination&amp;gt;&amp;lt;application&amp;gt;&amp;lt;member&amp;gt;"+rule_params['application']+"&amp;lt;/member&amp;gt;&amp;lt;/application&amp;gt;&amp;lt;service&amp;gt;&amp;lt;member&amp;gt;"+rule_params['service']+"&amp;lt;/member&amp;gt;&amp;lt;/service&amp;gt;&amp;lt;action&amp;gt;"+rule_params['action']+"&amp;lt;/action&amp;gt;&amp;lt;profile-setting&amp;gt;&amp;lt;group&amp;gt;&amp;lt;member&amp;gt;"+rule_params['spg']+"&amp;lt;/member&amp;gt;&amp;lt;/group&amp;gt;&amp;lt;/profile-setting&amp;gt;"}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;url = "https://"+pa_ip+cmd+"Key="+pa_key+"&amp;amp;"+urllib.urlencode(parameters)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;response = urllib2.urlopen(url, context=ctx)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;contents= ET.fromstring(response.read())&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;result = 'success'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return result&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2017 17:13:15 GMT</pubDate>
    <dc:creator>clyde.franklin</dc:creator>
    <dc:date>2017-05-19T17:13:15Z</dc:date>
    <item>
      <title>Confirm Xpath for rule build (not sure if github code is right for new rule add</title>
      <link>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157457#M60</link>
      <description>&lt;P&gt;Can someone cofirm if belwow github syntax is correct? When I try it weird is that I see rule hit palo alto in the logs but rule never actual builds and when I try syntax via web it showns :&lt;SPAN&gt;&amp;lt;![CDATA[ clyde -&amp;gt; source has unexpected text. ]]&amp;gt;&lt;/SPAN&gt; but command i show spt on mathch when comparing my script to xpath on git hub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;parameters = {'xpath':"/config/devices/entry[@name=\'localhost.localdomain\']/vsys/entry[@name=\'vsys1\']/rulebase/security/rules/entry[@name=\'"+rule_params['name']+"\']",'element':"&amp;lt;to&amp;gt;&amp;lt;member&amp;gt;"+rule_params['dstZone']+"&amp;lt;/member&amp;gt;&amp;lt;/to&amp;gt;&amp;lt;from&amp;gt;&amp;lt;member&amp;gt;"+rule_params['srcZone']+"&amp;lt;/member&amp;gt;&amp;lt;/from&amp;gt;&amp;lt;source&amp;gt;"+rule_source_ip+"&amp;lt;/source&amp;gt;&amp;lt;destination&amp;gt;"+rule_destination_ip+"&amp;lt;/destination&amp;gt;&amp;lt;application&amp;gt;&amp;lt;member&amp;gt;"+rule_params['application']+"&amp;lt;/member&amp;gt;&amp;lt;/application&amp;gt;&amp;lt;service&amp;gt;&amp;lt;member&amp;gt;"+rule_params['service']+"&amp;lt;/member&amp;gt;&amp;lt;/service&amp;gt;&amp;lt;action&amp;gt;"+rule_params['action']+"&amp;lt;/action&amp;gt;&amp;lt;profile-setting&amp;gt;&amp;lt;group&amp;gt;&amp;lt;member&amp;gt;"+rule_params['spg']+"&amp;lt;/member&amp;gt;&amp;lt;/group&amp;gt;&amp;lt;/profile-setting&amp;gt;"}&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 16:41:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157457#M60</guid>
      <dc:creator>clyde.franklin</dc:creator>
      <dc:date>2017-05-19T16:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Confirm Xpath for rule build (not sure if github code is right for new rule add</title>
      <link>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157464#M61</link>
      <description>&lt;P&gt;What is your source on GitHub?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just visually the xpath looks correct...&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 16:52:47 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157464#M61</guid>
      <dc:creator>niyengar</dc:creator>
      <dc:date>2017-05-19T16:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Confirm Xpath for rule build (not sure if github code is right for new rule add</title>
      <link>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157467#M62</link>
      <description>&lt;P&gt;supposdly the paloalto.py file below should work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def paloalto_rule_add(pa_ip,pa_key,rule_params):&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Add a new rule on Palo Alto gateway&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Input: Palo Alto gateway IP, Palo Alto Access Key, and rule_params&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params are the parameters to be configured for the new rule. It is a dictionary with the following values:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['name']: name of the rule&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['dstZone']: destination zone&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['srcZone']: source zone&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['srcIP']: list of source IP addresses&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['dstIP']: list of destination IP addresses&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['application']: application&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['service']: service&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['action']: rule action (allow, deny)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# rule_params['spg']: name of security group profile to be set&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# Output: returns 'success' or 'fail' depending on the result&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx = ssl.create_default_context()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx.check_hostname = False&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx.verify_mode = ssl.CERT_NONE&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cmd = "/api/?type=config&amp;amp;action=set&amp;amp;"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;parameters = {'xpath':"/config/devices/entry[@name=\'localhost.localdomain\']/vsys/entry[@name=\'vsys1\']/rulebase/security/rules/entry[@name=\'"+rule_params['name']+"\']",'element':"&amp;lt;to&amp;gt;&amp;lt;member&amp;gt;"+rule_params['dstZone']+"&amp;lt;/member&amp;gt;&amp;lt;/to&amp;gt;&amp;lt;from&amp;gt;&amp;lt;member&amp;gt;"+rule_params['srcZone']+"&amp;lt;/member&amp;gt;&amp;lt;/from&amp;gt;&amp;lt;source&amp;gt;"+rule_source_ip+"&amp;lt;/source&amp;gt;&amp;lt;destination&amp;gt;"+rule_destination_ip+"&amp;lt;/destination&amp;gt;&amp;lt;application&amp;gt;&amp;lt;member&amp;gt;"+rule_params['application']+"&amp;lt;/member&amp;gt;&amp;lt;/application&amp;gt;&amp;lt;service&amp;gt;&amp;lt;member&amp;gt;"+rule_params['service']+"&amp;lt;/member&amp;gt;&amp;lt;/service&amp;gt;&amp;lt;action&amp;gt;"+rule_params['action']+"&amp;lt;/action&amp;gt;&amp;lt;profile-setting&amp;gt;&amp;lt;group&amp;gt;&amp;lt;member&amp;gt;"+rule_params['spg']+"&amp;lt;/member&amp;gt;&amp;lt;/group&amp;gt;&amp;lt;/profile-setting&amp;gt;"}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;url = "https://"+pa_ip+cmd+"Key="+pa_key+"&amp;amp;"+urllib.urlencode(parameters)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;response = urllib2.urlopen(url, context=ctx)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;contents= ET.fromstring(response.read())&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;result = 'success'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return result&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:13:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/vm-series-in-the-public-cloud/confirm-xpath-for-rule-build-not-sure-if-github-code-is-right/m-p/157467#M62</guid>
      <dc:creator>clyde.franklin</dc:creator>
      <dc:date>2017-05-19T17:13:15Z</dc:date>
    </item>
  </channel>
</rss>

