- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Adding access rule in security management server t...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- I logged in successfully (with username and password only)
- 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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
