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

How to add a firewall policy to a specific package via api

Ok, I've got two policy packages on an R80.20 SMS (Standard and TestPackage):

What I want to do is to import a set of firewall rules into the TestPackage via the api with the following command:

mgmt_cli add access-rule --batch fwpolicy-final.csv

The problem though is that the firewall rules are added to the Standard package and NOT the TestPackage one. 

So my question is, is there an argument I could add to the above command to specify the policy package I want to add the firewall rules to? I can't find one in the api reference: Check Point - Management API reference .

Thanks in advance.

4 Replies
Maik
Silver

Re: How to add a firewall policy to a specific package via api

What are the headers of the used csv file "fwpolicy-final.csv"? Or to be precise - which command arguments are you currently using in order to create new rules?

0 Kudos

Re: How to add a firewall policy to a specific package via api

Hi Maik,

The headers of the csv file are the following:

layerpositionnamesourcedestinationvpnservice action

The issue though is that the same problem occurs when trying to add a single rule via the api as well. I've tried the package "TestPackage" argument as well but it doesn't seem to work.

0 Kudos
Maik
Silver

Re: How to add a firewall policy to a specific package via api

Hey Nicholas,

 

I see what you mean. Did you create that policy package before? Because the parameter "layer" is actually referring to a policy package and inline layers as well. That means if you execute the api command "show access-layers" it will provide you with a list of all access layers - including the policy packages (name wise). Each object in the list that the previously mentioned command provides to you can then be used to mention in the "layer" argument of the "add access-rule" command. The strange thing, that I also currently do not understand, is that the names often include a " Network" at the end of their name which is not visible via the SmartConsole. So for example, a package that you see in the SmartConsole which is named "TestPackage" is actually called "TestPackage Network" when accessing it via the API. Some older packages in my environment also include the ending of " Security" instead of " Network". You can verify this - again - with the command show access-layers.

Re: How to add a firewall policy to a specific package via api

Thanks to your comment Maik, I made it work with the following:

mgmt_cli add access-rule layer "TestPackage" position 1 name "Rule 1"

I will now try the batch mode which should work just as well.

Thanks again!