<?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: mgmt_cli &amp;quot;set application-site&amp;quot; in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216856#M65129</link>
    <description>&lt;P&gt;Can you send command you did? I can try it on my lab mgmt&lt;/P&gt;
&lt;P&gt;Andy&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 16:38:08 GMT</pubDate>
    <dc:creator>the_rock</dc:creator>
    <dc:date>2024-06-07T16:38:08Z</dc:date>
    <item>
      <title>mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216855#M65128</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;FYI I've just raised an SR for the management API (R81.20 T65).&lt;/P&gt;&lt;P&gt;When using the above command, if you had previously included the value "urls-defined-as-regular-expression true" then the SET command will reset it to false, unless you include this argument again.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:31:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216855#M65128</guid>
      <dc:creator>stallwoodj</dc:creator>
      <dc:date>2024-06-07T16:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216856#M65129</link>
      <description>&lt;P&gt;Can you send command you did? I can try it on my lab mgmt&lt;/P&gt;
&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:38:08 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216856#M65129</guid>
      <dc:creator>the_rock</dc:creator>
      <dc:date>2024-06-07T16:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216857#M65130</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Andy,&lt;/P&gt;&lt;P&gt;Using the BASH script below to send the commands (argument 1 being a filename):&lt;/P&gt;&lt;PRE&gt;#!/bin/bash&lt;BR /&gt;#&lt;BR /&gt;session=`mgmt_cli -r true login --format json| jq -r '.sid'`&lt;BR /&gt;COUNT=0&lt;BR /&gt;FILE=`mktemp`&lt;BR /&gt;F=`mktemp`&lt;BR /&gt;&lt;BR /&gt;grep ^[^#] &amp;lt;$1 &amp;gt;$F&lt;BR /&gt;&lt;BR /&gt;while IFS= read -r line&lt;BR /&gt;do&lt;BR /&gt;echo "echo $line" &amp;gt;&amp;gt;$FILE&lt;BR /&gt;echo "usleep 100" &amp;gt;&amp;gt;$FILE&lt;BR /&gt;echo "mgmt_cli $line ignore-warnings true --ignore-errors true --session-id \"$session\" 2&amp;gt;&amp;amp;1" &amp;gt;&amp;gt;$FILE&lt;BR /&gt;COUNT=$((COUNT+1))&lt;BR /&gt;if [ `expr $COUNT \% 2000` = "0" ]; then&lt;BR /&gt;echo "mgmt_cli publish --session-id \"$session\" 2&amp;gt;&amp;amp;1" &amp;gt;&amp;gt;$FILE&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt;$F&lt;BR /&gt;&lt;BR /&gt;source $FILE&lt;BR /&gt;mgmt_cli publish --session-id $session 2&amp;gt;&amp;amp;1&lt;BR /&gt;mgmt_cli logout --session-id $session 2&amp;gt;&amp;amp;1&lt;BR /&gt;rm $FILE $F&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The command set in question:&lt;/P&gt;&lt;PRE&gt;set session description "Create Blacklist Object" new-name "APCL-API"&lt;BR /&gt;add application-site name "Sample-Blocklist" primary-category "High Risk" urls-defined-as-regular-expression true url-list.1 "dummy"&lt;BR /&gt;set application-site name "Sample-Blocklist" url-list.add "\\/site\\.com"&lt;BR /&gt;set application-site name "Sample-Blocklist" url-list.add "\\.site\\.com"&lt;BR /&gt;set application-site name "Sample-Blocklist" url-list.remove "dummy"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:42:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216857#M65130</guid>
      <dc:creator>stallwoodj</dc:creator>
      <dc:date>2024-06-07T16:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216858#M65131</link>
      <description>&lt;P&gt;Just rebooting it, will try soon.&lt;/P&gt;
&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 16:42:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216858#M65131</guid>
      <dc:creator>the_rock</dc:creator>
      <dc:date>2024-06-07T16:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216863#M65132</link>
      <description>&lt;P&gt;Just tried, yes, I see your point.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 17:18:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216863#M65132</guid>
      <dc:creator>the_rock</dc:creator>
      <dc:date>2024-06-07T17:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216890#M65133</link>
      <description>&lt;P&gt;There are a few API calls like that (particularly with Gateway objects).&lt;BR /&gt;Please send me the SR in a PM.&lt;BR /&gt;Also tagging&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/37502"&gt;@Omer_Kleinstern&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 21:17:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216890#M65133</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2024-06-07T21:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216893#M65134</link>
      <description>&lt;P&gt;Have you considered Ansible by chance? &amp;nbsp;Check Point has modules for the set/show/delete application-site APIs:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/cp_mgmt_application_site_module.html#ansible-collections-check-point-mgmt-cp-mgmt-application-site-module" target="_blank"&gt;https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/cp_mgmt_application_site_module.html#ansible-collections-check-point-mgmt-cp-mgmt-application-site-module&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;With this, you can specify that attribute as part of the request. &amp;nbsp;Ansible will handle your login session and you get a consistent interface.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;---
- name: Manage application sites
  hosts: mgmt_server
  connection: httpapi
  gather_facts: false
  become: false

  vars:
    ansible_api_key: MGMT_API_KEY
    ansible_network_os: check_point.mgmt.checkpoint
    block_list:
      name: Sample_Blocklist
      primary_category: High Risk
      url_list:
        add:
          - '\/site.com'
          - '\.site\.com'
        remove:
          - dummy


  tasks:
    - name: Get application site info
      check_point.mgmt.cp_mgmt_application_site:
        name: app_site_facts

    - name: Update application sites
      check_point.mgmt.cp_mgmt_application_site:
        name: "{{ block_list.name }}"
        primary_category: "{{ block_list.primary_category }}"
        url_list: "{{ (app_site_facts['ansible_facts']['application_site']['url_list'] |list) + block_list.url_list.add | difference(block_list.url_list.remove) }}"
        urls_defined_as_regular_expression: true

...
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Untested, but should be close)&lt;/P&gt;
&lt;P&gt;The idea is to "model" the object you want then work with the model. &amp;nbsp;It pays enormous dividends, tho.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 21:25:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/216893#M65134</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2024-06-07T21:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/219453#M65135</link>
      <description>&lt;P&gt;Some clarification: it seems to be only the REMOVE verb affecting it.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:52:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/219453#M65135</guid>
      <dc:creator>stallwoodj</dc:creator>
      <dc:date>2024-07-02T14:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/226143#M65136</link>
      <description>&lt;P&gt;Interestingly, it wasn't the remove command alone that was resetting the flag, but only if the PREVIOUS command failed to explicitly specify the flag (the commands were not completely atomic). I've had a private hotfix built and tested successfully (for application-site only), so hopefully&amp;nbsp; this will be rolled into a hotfix take soon.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 12:49:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/226143#M65136</guid>
      <dc:creator>stallwoodj</dc:creator>
      <dc:date>2024-09-10T12:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: mgmt_cli "set application-site"</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/226173#M65137</link>
      <description>&lt;P&gt;Yes, that's the exact behavior I was talking about.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 17:10:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/mgmt-cli-quot-set-application-site-quot/m-p/226173#M65137</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2024-09-10T17:10:02Z</dc:date>
    </item>
  </channel>
</rss>

