<?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: Intermittent error for /web_api/set-threat-protection in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80516#M4665</link>
    <description>&lt;P&gt;You may indeed be running the api server out of memory with that call, check out&amp;nbsp;&lt;A class="cp_link sc_ellipsis" href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk119553&amp;amp;partition=Advanced&amp;amp;product=Security" target="_blank"&gt;sk119553: Security Management&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;API&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;server&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;crashes under heavy load&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2020 18:10:07 GMT</pubDate>
    <dc:creator>Timothy_Hall</dc:creator>
    <dc:date>2020-04-01T18:10:07Z</dc:date>
    <item>
      <title>Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80495#M4662</link>
      <description>&lt;P&gt;I'm hitting&amp;nbsp;&lt;/P&gt;&lt;P&gt;/web_api/set-threat-protection&lt;BR /&gt;&lt;BR /&gt;with&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; "uid": "3ca88a50-bc75-a844-9bcb-fede11222822",&lt;BR /&gt;&amp;nbsp; "overrides": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "profile": "Optimized",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "action": "Prevent"&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;And getting this on and off.&amp;nbsp;&lt;/P&gt;&lt;P&gt;500 Server Error: Server Error for url: &lt;A href="https://x.x.x.x:443/web_api/set-threat-protection" target="_blank"&gt;https://x.x.x.x:443/web_api/set-threat-protection&lt;/A&gt;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;"code" : "generic_server_error",&lt;BR /&gt;&amp;nbsp; &amp;nbsp;"message" : "Failure occurred when handling overrides"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Any ideas what would cause that? I'm on R80.30 if that helps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 16:03:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80495#M4662</guid>
      <dc:creator>jmcadams</dc:creator>
      <dc:date>2020-04-01T16:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80498#M4663</link>
      <description>Need to understand the entire flow of how you are using the API and where these commands fit in.&lt;BR /&gt;More specifically, how many add/set type commands are done prior to a publish action.&lt;BR /&gt;In general, you should periodically publish your session (every few hundred add/set actions) for performance reasons.&lt;BR /&gt;Depending on your API usage, the server might require tuning, which I believe the TAC can assist with.</description>
      <pubDate>Wed, 01 Apr 2020 16:25:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80498#M4663</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-04-01T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80502#M4664</link>
      <description>&lt;P&gt;The flow is this:&amp;nbsp;&lt;BR /&gt;Get a CVE (CVE-2009-1234)&amp;nbsp;&lt;BR /&gt;Search for the CVE in all Threat Protections*&lt;BR /&gt;Find the relevant Threat Protection&lt;BR /&gt;Discard All Sessions (Optional, depends on if the server is being odd)&lt;BR /&gt;Logout&lt;BR /&gt;Get new SID&lt;BR /&gt;Make the above call&lt;BR /&gt;&lt;BR /&gt;* I think this is likely murdering the server. I'm calling in and pulling all the Threat Protections in bunches of 100 to get their Industry Reference field. I'm on 80.30 and filter isn't available yet, and I didn't see a way to just pull the Name, UID, and industry reference in 80.30. I tried doing this with the max limit of 500 and the server straight up crashed on me.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I thought logging out and logging in might solve that problem, but it doesn't seem like it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm not sure what else I could do to make this more stable. I guess I could pull the Threat Protections in smaller batches and maybe add delays to help with some of the load on the server.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 16:37:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80502#M4664</guid>
      <dc:creator>jmcadams</dc:creator>
      <dc:date>2020-04-01T16:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80516#M4665</link>
      <description>&lt;P&gt;You may indeed be running the api server out of memory with that call, check out&amp;nbsp;&lt;A class="cp_link sc_ellipsis" href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk119553&amp;amp;partition=Advanced&amp;amp;product=Security" target="_blank"&gt;sk119553: Security Management&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;API&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;server&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;crashes under heavy load&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 18:10:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80516#M4665</guid>
      <dc:creator>Timothy_Hall</dc:creator>
      <dc:date>2020-04-01T18:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80526#M4666</link>
      <description>Yea, I pretty sure that's the answer. Thanks for the help!!!</description>
      <pubDate>Wed, 01 Apr 2020 19:14:50 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80526#M4666</guid>
      <dc:creator>jmcadams</dc:creator>
      <dc:date>2020-04-01T19:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Intermittent error for /web_api/set-threat-protection</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80528#M4667</link>
      <description>&lt;P&gt;What I recommend you do instead is work with the results of show-threat-protections offline so you're not hitting the API server so hard.&lt;BR /&gt;You can then use scripting and jq to parse the results from the files, which will most likely be significantly faster.&lt;/P&gt;
&lt;P&gt;In the below examples, I am logged into the management server in expert mode.&lt;BR /&gt;To create a reusable API session for my successive API calls, I did:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;mgmt_cli -r true login &amp;gt; sid.txt&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can find out the default number of results returned by the API call and the total number you have to parse through using&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;mgmt_cli -s sid.txt show threat-protections --format json | jq '{limit: .to, total: .total}'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can then generate successive calls like the following to get all the results into a single file (advancing the offset for each call):&lt;/P&gt;
&lt;P class="p1 lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;mgmt_cli -s sid.txt show threat-protections details-level full offset 50 --format json | jq '.protections[] | {uid: .uid, name: .name, "industry-reference": ."industry-reference"}' &amp;gt;&amp;gt; ips.json&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;Once you've got all the results in a single file, log out:&lt;/P&gt;
&lt;P class="p1 lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;mgmt_cli -s sid logout&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="p1"&gt;Once you've got all the results in a single file, you can use jq to query against those results and get only the uid of the protection you need to modify:&lt;/P&gt;
&lt;P class="p1 lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;SPAN class="s1"&gt;cat ips.json | jq -r 'select (."industry-reference"[]? == "CVE-2020-3807") | .uid'&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Obviously, all of this can be scripted.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 19:45:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Intermittent-error-for-web-api-set-threat-protection/m-p/80528#M4667</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-04-01T19:45:45Z</dc:date>
    </item>
  </channel>
</rss>

