Skip to content

Commit a0f6350

Browse files
authored
Merge pull request CactuseSecurity#2512 from tpurschke/fix/cp-import-groups-missing
hotfix/missing group members in cp importer
2 parents a846a0f + ca1d1fe commit a0f6350

File tree

6 files changed

+37
-12
lines changed

6 files changed

+37
-12
lines changed

documentation/revision-history-main.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,7 @@ Maintenance release
391391
- owner-filtering for new report type
392392
- new setting for email recipients
393393
- owner-import custom script improvements#
394+
395+
# 8.3.1 - 14.08.24 MAIN
396+
Hotfix:
397+
- in CheckPoint importer: fix missing group members

inventory/group_vars/all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### general settings
2-
product_version: "8.3"
2+
product_version: "8.3.1"
33
ansible_user: "{{ lookup('env', 'USER') }}"
44
ansible_become_method: sudo
55
ansible_python_interpreter: /usr/bin/python3
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
details_level = "full" # 'standard'
2-
use_object_dictionary = 'false'
1+
details_level = "standard"
2+
details_level_objects = "standard"
3+
details_level_group_objects = "full"
4+
use_object_dictionary = True
5+
with_hits = True
36

4-
# the following is the static across all installations unique any obj uid
7+
# the following is the static across all installations unique any obj uid
58
# cannot fetch the Any object via API (<=1.7) at the moment
69
# therefore we have a workaround adding the object manually (as svc and nw)
710
any_obj_uid = "97aeb369-9aea-11d5-bd16-0090272ccb30"
@@ -10,26 +13,27 @@
1013
original_obj_uid = "85c0f50f-6d8a-4528-88ab-5fb11d8fe16c"
1114
# used for nat only (both svc and nw obj)
1215

13-
1416
nw_obj_table_names = [
15-
'hosts', 'networks', 'groups', 'address-ranges', 'multicast-address-ranges', 'groups-with-exclusion',
16-
'gateways-and-servers', 'simple-gateways',
17+
'hosts', 'networks', 'groups', 'address-ranges', 'multicast-address-ranges', 'groups-with-exclusion',
18+
'gateways-and-servers', 'simple-gateways',
1719
'dns-domains', 'updatable-objects-repository-content',
18-
'interoperable-devices'
20+
'interoperable-devices', 'security-zones', 'Global', 'access-roles', 'updatable-objects'
1921
]
2022

2123
# simple as in: no groups
22-
simple_svc_obj_types = ['services-tcp', 'services-udp', 'services-dce-rpc', 'services-rpc', 'services-other',
23-
'services-icmp', 'services-icmp6', 'services-sctp', 'services-gtp']
24+
simple_svc_obj_types = ['services-tcp', 'services-udp', 'services-dce-rpc', 'services-rpc', 'services-other',
25+
'services-icmp', 'services-icmp6', 'services-sctp', 'services-gtp', 'Global']
2426
group_svc_obj_types = ['service-groups', 'application-site-categories', 'application-sites']
2527

2628
svc_obj_table_names = group_svc_obj_types + simple_svc_obj_types + [ 'CpmiAnyObject' ]
2729
# usr_obj_table_names : do not exist yet - not fetchable via API
2830

2931
api_obj_types = nw_obj_table_names + svc_obj_table_names # all obj table names to look at during import
3032

33+
obj_types_full_fetch_needed = ['groups', 'groups-with-exclusion', 'updatable-objects'] + group_svc_obj_types
34+
3135
cp_specific_object_types = [ # used for fetching enrichment data via "get object" separately (no specific API call)
3236
'simple-gateway', 'simple-cluster', 'CpmiVsClusterNetobj', 'CpmiVsxClusterNetobj', 'CpmiVsxClusterMember', 'CpmiVsNetobj',
33-
'CpmiAnyObject', 'CpmiClusterMember', 'CpmiGatewayPlain', 'CpmiHostCkp', 'CpmiGatewayCluster', 'checkpoint-host',
34-
'cluster-member'
37+
'CpmiAnyObject', 'CpmiVsxNetobj', 'CpmiClusterMember', 'CpmiGatewayPlain', 'CpmiHostCkp', 'CpmiGatewayCluster', 'checkpoint-host',
38+
'cluster-member', 'CpmiVoipSipDomain'
3539
]

roles/importer/files/importer/checkpointR8x/cp_enrich.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ def enrich_config (config, mgm_details, limit=150, details_level=cp_const.detail
128128
'comments': obj['comments'], 'type': 'network', 'ipv4-address': '0.0.0.0/0',
129129
} ] } ] }
130130
config['object_tables'].append(json_obj)
131+
132+
elif (obj['type'] in ['Internet', 'security-zone']):
133+
json_obj = {"object_type": "hosts", "object_chunks": [ {
134+
"objects": [ {
135+
'uid': obj['uid'], 'name': obj['name'], 'color': obj['color'],
136+
'comments': obj['comments'], 'type': 'network', 'ipv4-address': '0.0.0.0/0',
137+
} ] } ] }
138+
config['object_tables'].append(json_obj)
131139
elif (obj['type'] == 'access-role'):
132140
pass # ignorning user objects
133141
else:

roles/importer/files/importer/checkpointR8x/cp_network.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def collect_nw_objects(object_table, nw_objects, debug_level=0, mgm_id=0):
7171
obj_type = 'group'
7272
# TODO: handle exclusion groups correctly
7373

74+
if obj_type == 'security-zone':
75+
first_ip = '0.0.0.0/32'
76+
last_ip = '255.255.255.255/32'
77+
obj_type = 'network'
78+
7479
if obj_type == 'group':
7580
first_ip = None
7681
last_ip = None

roles/importer/files/importer/checkpointR8x/fwcommon.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ def get_objects(config_json, mgm_details, v_url, sid, force=False, config_filena
181181
show_params_objs = {'limit':limit,'details-level': cp_const.details_level}
182182

183183
for obj_type in cp_const.api_obj_types:
184+
if obj_type in cp_const.obj_types_full_fetch_needed:
185+
show_params_objs.update({'details-level': cp_const.details_level_group_objects})
186+
else:
187+
show_params_objs.update({'details-level': cp_const.details_level_objects})
184188
object_table = { "object_type": obj_type, "object_chunks": [] }
185189
current=0
186190
total=current+1

0 commit comments

Comments
 (0)