@@ -61,7 +61,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
61
61
62
62
# To specify a port range instead of a single port, use iptables format:
63
63
# separate start and end ports with a colon, e.g., "1000:2000"
64
- ACL_SERVICES = {
64
+ KNOWN_SYSTEM_SERVICES = {
65
65
"NTP" : {
66
66
"ip_protocols" : ["udp" ],
67
67
"dst_ports" : ["123" ],
@@ -263,12 +263,12 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
263
263
continue
264
264
265
265
# Add iptables rules to allow input packets of all the known services
266
- for acl_service in self .ACL_SERVICES :
266
+ for acl_service in self .KNOWN_SYSTEM_SERVICES :
267
267
# Skip "ANY" record
268
268
if acl_service == "ANY" :
269
269
continue
270
- for ip_protocol in self .ACL_SERVICES [acl_service ]["ip_protocols" ]:
271
- for dst_port in self .ACL_SERVICES [acl_service ]["dst_ports" ]:
270
+ for ip_protocol in self .KNOWN_SYSTEM_SERVICES [acl_service ]["ip_protocols" ]:
271
+ for dst_port in self .KNOWN_SYSTEM_SERVICES [acl_service ]["dst_ports" ]:
272
272
mgmt_intf_cmds .append (self .iptables_cmd_ns_prefix [namespace ] + "{} -A INPUT -p {} -d {}/{} --dport {} -j ACCEPT" .format (table , ip_protocol , ip_addr , mask , dst_port ))
273
273
# Drop the rest of traffic
274
274
mgmt_intf_cmds .append (self .iptables_cmd_ns_prefix [namespace ] + "{} -A INPUT -d {}/{} -j DROP" .format (table , ip_addr , mask ))
@@ -328,14 +328,14 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
328
328
fwd_traffic_from_namespace_to_host_cmds .append (self .iptables_cmd_ns_prefix [namespace ] + "ip6tables -t nat -X" )
329
329
fwd_traffic_from_namespace_to_host_cmds .append (self .iptables_cmd_ns_prefix [namespace ] + "ip6tables -t nat -F" )
330
330
331
- for acl_service in self .ACL_SERVICES :
332
- if self .ACL_SERVICES [acl_service ]["multi_asic_ns_to_host_fwd" ]:
331
+ for acl_service in self .KNOWN_SYSTEM_SERVICES :
332
+ if self .KNOWN_SYSTEM_SERVICES [acl_service ]["multi_asic_ns_to_host_fwd" ]:
333
333
# Get the Source IP Set if exists else use default source ip prefix
334
334
nat_source_ipv4_set = acl_source_ip_map [acl_service ]["ipv4" ] if acl_source_ip_map and acl_source_ip_map [acl_service ]["ipv4" ] else { "0.0.0.0/0" }
335
335
nat_source_ipv6_set = acl_source_ip_map [acl_service ]["ipv6" ] if acl_source_ip_map and acl_source_ip_map [acl_service ]["ipv6" ] else { "::/0" }
336
336
337
- for ip_protocol in self .ACL_SERVICES [acl_service ]["ip_protocols" ]:
338
- for dst_port in self .ACL_SERVICES [acl_service ]["dst_ports" ]:
337
+ for ip_protocol in self .KNOWN_SYSTEM_SERVICES [acl_service ]["ip_protocols" ]:
338
+ for dst_port in self .KNOWN_SYSTEM_SERVICES [acl_service ]["dst_ports" ]:
339
339
for ipv4_src_ip in nat_source_ipv4_set :
340
340
# IPv4 rules
341
341
fwd_traffic_from_namespace_to_host_cmds .append (self .iptables_cmd_ns_prefix [namespace ] +
@@ -546,7 +546,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
546
546
acl_services = table_data ["services" ]
547
547
548
548
for acl_service in acl_services :
549
- if acl_service not in self .ACL_SERVICES :
549
+ if acl_service not in self .KNOWN_SYSTEM_SERVICES :
550
550
self .log_warning ("Ignoring control plane ACL '{}' with unrecognized service '{}'"
551
551
.format (table_name , acl_service ))
552
552
continue
@@ -555,8 +555,8 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
555
555
.format (table_name , acl_service ))
556
556
557
557
# Obtain default IP protocol(s) and destination port(s) for this service
558
- ip_protocols = self .ACL_SERVICES [acl_service ]["ip_protocols" ]
559
- dst_ports = self .ACL_SERVICES [acl_service ]["dst_ports" ]
558
+ ip_protocols = self .KNOWN_SYSTEM_SERVICES [acl_service ]["ip_protocols" ]
559
+ dst_ports = self .KNOWN_SYSTEM_SERVICES [acl_service ]["dst_ports" ]
560
560
561
561
acl_rules = {}
562
562
0 commit comments