Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 

SmartConsole Extension - Easy deletion of unused rules

HeikoAnkenbrand
MVP Platinum
MVP Platinum

 

EDelete_45345.png
Since deleting unused rules always annoyed me, I created a SmarteConsole plugin.
It does the following:

- Shows all rules in SmartConsole that have not been used (hit counter = 0).
- Lets you select any of the unused rules you want to delete.
- Generates the CLI commands for the Management Server to delete those rules.
   You only need to copy and paste the output into an SSH session on the SMS.
   

I deliberately did not automate the deletion directly in SmartConsole, to avoid

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free

Disclaimer: Check Point does not provide maintenance services or technical or customer support for third party content provided on this Site, including in CheckMates Toolbox. See also our Third Party Software Disclaimer.




(1)
58 Replies

the_rock
MVP Platinum
MVP Platinum

I should have clarified...I meant does not work on INLINE layers, but does on ordered ones.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Vincent_Bacher
Advisor
Advisor

I was afraid of that. 😞

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Im sure it will come in new version.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

HeikoAnkenbrand
MVP Platinum
MVP Platinum

The challenge with inline layers is that they are not integrated into the regular rule framework but are instead referenced within the internal database. As a result, a parser would be required to index the database for inline layers. This is particularly difficult when developing SmartConsole plugins, because every interaction with the API triggers a confirmation prompt—a security feature of Check Point—which would lead to an excessive number of confirmations. From my perspective, this a

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


Vincent_Bacher
Advisor
Advisor

Yes i get it. We had a script long ago (done by Val? Not sure anymore) which did same on cli and printed out list of api commands to deactivate or delete the unused policies.

If only this would work with inline layers, I could finally show a few people quite clearly how much useless stuff has accumulated in the database that should finally be gotten rid of.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

I still feel what I mentioned yesterday to  @Matlu is at least good workaround, as it would give all the rules with 0 hits.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

Hello,  @HeikoAnkenbrand 

I have tested the tool in a production environment, and I have the following comments.

- In MDS, what  @the_rock  mentions is true; the URL is uploaded for each CMA that interests us.

- The tool works well, but with one important detail: when you have very large “policy packages” with more than 100 rules, the tool no longer works.

- I have tested it on four policy packages belonging to the same CMA, and the result is that when the policy packages have f

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

PhoneBoy
Admin
Admin

This sounds like the tool is not properly parsing large rulebases, which requires multiple API calls using limit/offset parameters to get all the results.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Its odd, cause I gave it to a customer with about 250 rules and worked just fine...not MDS mind you, but I dont believe it should matter.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

PhoneBoy
Admin
Admin

It might make more sense for the CLI commands to be ones you can copy/paste to the Command Line available in SmartConsole.
Or maybe it can be an option, just a thought.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

majkel
Contributor

Would be nice to maybe add column "last change date" in show rules section ?

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Maja_B
Explorer
Explorer

That's a good suggestion. I would add the "creation date", as well, as most of the times we don't want to remove the rules that are created or modified recently (probably in order to facilitate for some traffic that is expected in the future).

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Gave this to few clients, they all LOVED it, really useful.

Andy

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

satish_Puri
Explorer

Hi HeikoAnkenbrand, 

Sorry to bother you, But would be better if you can pass the instructions "How to inject this plugin" in Smart Console.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Ingard
Participant

SMart_console.png

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Just follow what  @_Val_ and  @Ingard provided.

Andy

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Keep these extensions coming, Heiko...BRILLIANT!

Andy

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

HeikoAnkenbrand
MVP Platinum
MVP Platinum
Demo video

 

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

In “Heavy Policy Packages,” the tool does not display results.  😭

DR1.jpg

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Just to make sure, you did press "show rules"?

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

I've tried it several times, but it doesn't show anything.
When there are “few” policies, it shows you the results, but in packages that have more than 100 rules, it doesn't show anything.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Odd bro...I gave it to a customer that has almost 200 rules and worked fine for them.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

It's strange.
I have several policy packages, and it works well for me only on those with few policies, but on those where it doesn't work, most have more than 100, 500, or 1000, and it's on these packages that nothing is observed.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

So if you export those rules in csv format, how many do you see with zero hits?

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

For example, this is another policy package, with more than 500 rules, and nothing appears.

DR2.jpg

I exported the policy package to CSV.
The package has 700 rules, but 507 rules have 0 hits.

And as you can see, at least in my case, the tool does not show me those 507 rules in SmartConsole  😭

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

Okay...and clicking show rules, still nothing?

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Matlu
MVP Silver
MVP Silver

I tried again, and it still doesn't work.
That's strange.

One question:

Is the policy package “export” file 100% reliable?
Could it be a temporary solution to rely on the 0 hits shown in the CSV?
Unfortunately, the tool is not working well in my scenario with a large number of rules.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

the_rock
MVP Platinum
MVP Platinum

I believe it would be reliable, yes. Not sure what to tell you brother, works for me 100%.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos