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

Adding access rule in security management server through web API (R80.10) - Not multi domain server

I am using python management SDK 1.1.0 for automation. and doing api_calls

  1. I logged in successfully  (with username and password only)
  2. added host with ip address

when I try to add access rule it showing me error as "Requested object [Network] not found".

Here is code -

def add_access_rule(self, rule_name, action, host_name):
        payload = {'layer': 'Network', 'position': 'top',
                   'name': rule_name, 'action': action, 'source': host_name}
        add_rule_response = self._api_client.api_call('add-access-rule', payload)
        if add_rule_response.success:
            print("The rule: '{}' has been added successfully".format(rule_name))
            self.publish()
        else:
            print("Failed to add the access-rule: '{}', Error:\n{}".format(rule_name,                                                                    add_rule_response.error_message))

I am providing ip-address as host_name which is added in step 2

What am I missing? Please help!

 

0 Kudos
3 Replies
Sigbjorn
Advisor
Advisor

Network in your example refers to the Policy layer you are trying to create the rule in.

The default layer is called Network, but its usually prefixed by the policy name.

The easiest way to check, is to open "Manage policies and layers (ctrl-o)" in SmartConsole and check the name under the Layers tab. (Uncheck "show only shared layers" if its empty.)

/Sig

0 Kudos
appyens
Participant

Is there any way I can get the layer name through API. I don't have access to the Interface and cannot use CLI. Thanks

0 Kudos
Sigbjorn
Advisor
Advisor

Hi,

You can use 'show-packages' to get the policy package names, then 'show-package name <insert name>' to get details including the access-layer names.

 

https://sc1.checkpoint.com/documents/latest/APIs/index.html#web/show-packages~v1.6%20

https://sc1.checkpoint.com/documents/latest/APIs/index.html#web/show-package~v1.6%20

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events