<?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: Getting rule numbers where Access roles are used in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193035#M8061</link>
    <description>&lt;P&gt;Thanks for the reply, we will try to use it.&lt;BR /&gt;We are additionally using MDS and different policy packages, is there any way to make the script download the rule numbers from a specific CMA and from a specific policy package?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 09:02:46 GMT</pubDate>
    <dc:creator>Hllrdm</dc:creator>
    <dc:date>2023-09-19T09:02:46Z</dc:date>
    <item>
      <title>Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193023#M8059</link>
      <description>&lt;P&gt;We have a large security policy written that utilizes Access roles. Is there some script or api so we can see the rule numbers where access roles are used so we don't have to manually review 3000+ rules?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 07:58:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193023#M8059</guid>
      <dc:creator>Hllrdm</dc:creator>
      <dc:date>2023-09-19T07:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193033#M8060</link>
      <description>&lt;P&gt;Here's a basic script that lists access-roles UID and iterates a where-used on the UID.&lt;/P&gt;&lt;P&gt;You will need to filter the JSON output further and play with offsets for going over 500 items.&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;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

ar_uid=$(mgmt_cli -r true show-access-roles --format json | jq -r ".objects[] | .uid")

declare -a name_array
while IFS= read -r line; do
    name_array+=("$line")
done &amp;lt;&amp;lt;&amp;lt; "$ar_uid"

for ar_uid in "${name_array[@]}"; do
    echo "Processing: $ar_uid"
    ar_uid_where_used=$(mgmt_cli -r true where-used uid "$ar_uid" --format json)
    echo $ar_uid_where_used
done&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 18:01:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193033#M8060</guid>
      <dc:creator>Alex-</dc:creator>
      <dc:date>2023-09-19T18:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193035#M8061</link>
      <description>&lt;P&gt;Thanks for the reply, we will try to use it.&lt;BR /&gt;We are additionally using MDS and different policy packages, is there any way to make the script download the rule numbers from a specific CMA and from a specific policy package?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 09:02:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193035#M8061</guid>
      <dc:creator>Hllrdm</dc:creator>
      <dc:date>2023-09-19T09:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193039#M8062</link>
      <description>&lt;P&gt;I don't have access to an MDS but it looks like you have to log in to the CMA after logging into the System Domain on the MDS so the code would need to be expanded a bit.&lt;/P&gt;&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/login-to-domain~v1.9%20" target="_blank" rel="noopener"&gt;Check Point - Management API reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Otherwise, you can expand the script to remove the clutter like "Proccessing: " and save everything in a file where you can use further tooling to filter and sort. This script in itself is a basic iteration in an environment with few access roles where a visual check is enough.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 09:30:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193039#M8062</guid>
      <dc:creator>Alex-</dc:creator>
      <dc:date>2023-09-19T09:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193055#M8063</link>
      <description>&lt;P&gt;Are any of the access roles you're interested in defined at the global level, or are they all defined in the CMAs?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 11:55:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193055#M8063</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-09-19T11:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193313#M8065</link>
      <description>&lt;P&gt;All objects are defined in the CMA in one policy package&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 08:43:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193313#M8065</guid>
      <dc:creator>Hllrdm</dc:creator>
      <dc:date>2023-09-22T08:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Getting rule numbers where Access roles are used</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193382#M8066</link>
      <description>&lt;P&gt;In that case, you just need to add a quick '-d "CMA name"' to each mgmt_cli call above. For example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;mgmt_cli -d "CMA name" -r true where-used uid "$ar_uid" --format json&lt;/LI-CODE&gt;
&lt;P&gt;Replacing the literal string 'CMA name' with the name of the CMA you want to check.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 18:44:33 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Getting-rule-numbers-where-Access-roles-are-used/m-p/193382#M8066</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-09-22T18:44:33Z</dc:date>
    </item>
  </channel>
</rss>

