<?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: Generate list of OPSEC object which configured in the firewall mgmt domain in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76512#M4456</link>
    <description>There isn’t API support for OPSEC objects, as I recall correctly.&lt;BR /&gt;Which means you’ll have to reverse engineer the generic-object type for these objects.&lt;BR /&gt;</description>
    <pubDate>Thu, 27 Feb 2020 04:31:26 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2020-02-27T04:31:26Z</dc:date>
    <item>
      <title>Generate list of OPSEC object which configured in the firewall mgmt domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76510#M4454</link>
      <description>&lt;P&gt;I'm using MDS which have about 40 domains for customers.&lt;/P&gt;&lt;P&gt;Each domain have OPSEC configured for different purpose. I will like to generate a list of OPSEC configured for each domain. Instead of login to the domain one by one, is there a way to do so?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 03:59:55 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76510#M4454</guid>
      <dc:creator>LowJ</dc:creator>
      <dc:date>2020-02-27T03:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Generate list of OPSEC object which configured in the firewall mgmt domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76512#M4456</link>
      <description>There isn’t API support for OPSEC objects, as I recall correctly.&lt;BR /&gt;Which means you’ll have to reverse engineer the generic-object type for these objects.&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2020 04:31:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76512#M4456</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-02-27T04:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Generate list of OPSEC object which configured in the firewall mgmt domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76513#M4457</link>
      <description>Is this mean the best we can do are generate out the object list and from there filter out which one for OPSEC?</description>
      <pubDate>Thu, 27 Feb 2020 05:06:55 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76513#M4457</guid>
      <dc:creator>LowJ</dc:creator>
      <dc:date>2020-02-27T05:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Generate list of OPSEC object which configured in the firewall mgmt domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76537#M4460</link>
      <description>&lt;P&gt;You can use show-opsec-applications to get the uid's and then show-opsec-application to get the details you want.&lt;/P&gt;&lt;P&gt;I tweaked a script I use for crawling our domains for various other purposes to fit your requirement.&lt;/P&gt;&lt;P&gt;(The API User needs access to all domains.)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This is a read only script, but please never run any scripts without understanding their purpose and what they do.&lt;/EM&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Param(
  #  [PSCredential]$CheckpointCredential,
    [string]$BaseUri = "https://10.10.10.10/web_api",   # Set your MDS IP
    [string]$domain = "MDS",                            # Set you main Multidomain Name
    [string]$user = "s_apiuser",
    [string]$password = "apipassword",
    [string]$debug = "off"
)

# Ignore SSL:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

# Login and save headers #
$loginData = @{
    "user" = $user
    "password" = $password
    "domain" = $domain
} | ConvertTo-Json

Write-Output "Invoking Login"
$login = Invoke-RestMethod -Method Post -Uri "$BaseUri/login" -Body $loginData -Headers @{ "content-type" = "application/json" }

$headers = @{
    "content-type" = "application/json"
    "x-chkp-sid" = $login.sid
}

$domains = Invoke-RestMethod -Method Post -Uri "$BaseUri/show-domains" -Body "{}" -Headers $headers


  foreach ($d in $domains.objects.name) {
      $loginData = @{
      "user" = $user
      "password" = $password
      "domain" = $d
      } | ConvertTo-Json

      if ($debug -eq "on") { Write-Output "Login to $($d) domain" }
      $login = Invoke-RestMethod -Method Post -Uri "$BaseUri/login" -Body $loginData -Headers @{ "content-type" = "application/json" }
      $headers = @{
      "content-type" = "application/json"
      "x-chkp-sid" = $login.sid
      } 
      if ($debug -eq "on") { Write-Output "Login complete" }

      $opsecobj = Invoke-RestMethod -Method Post -Uri "$BaseUri/show-opsec-applications" -Body "{}" -Headers $headers
      if ($opsecobj.objects.count -gt 1) {
      foreach ($o in $opsecobj.objects) {
        $name = $o.name
        write-output "$($d): Found OPSec Object: $($name)"
        $opsecuid = $o.uid
        $body = @{
            "uid" = $opsecuid
            } | ConvertTo-Json
        
        ## Get the OPSEC Values you want by tweaking this section. 
        $opsec = Invoke-RestMethod -Method Post -Uri "$BaseUri/show-opsec-application" -Body $body -Headers $headers
        Write-Output "Random opsec value for $($opsec.name) (Lea enabled): $($opsec.lea.enabled)"
        ## 
        
        }
       }
      else { 
        Write-Output "Didnt find any opsec objects in domain $($d)" 
        }

      $null = Invoke-RestMethod -Method Post -Uri "$BaseUri/logout" -Body "{}" -Headers $headers 
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 09:41:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76537#M4460</guid>
      <dc:creator>Sigbjorn</dc:creator>
      <dc:date>2020-02-27T09:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Generate list of OPSEC object which configured in the firewall mgmt domain</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76634#M4480</link>
      <description>Thanks. Let me try it in test environment.</description>
      <pubDate>Fri, 28 Feb 2020 01:53:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Generate-list-of-OPSEC-object-which-configured-in-the-firewall/m-p/76634#M4480</guid>
      <dc:creator>LowJ</dc:creator>
      <dc:date>2020-02-28T01:53:36Z</dc:date>
    </item>
  </channel>
</rss>

