@@ -117,7 +117,7 @@ def teardown(self) -> typing.List[str]:
117117
118118 if self ._is_secure_vnet_bridge is True :
119119 commands += self .__down_secure_mode_devices ()
120- self .firewall .delete_rule ("$IOCAGE_JID " )
120+ self .firewall .delete_rule ("$IOC_JID " )
121121 commands += self .firewall .read_commands ()
122122
123123 return commands
@@ -128,7 +128,7 @@ def __require_bridge(self) -> None:
128128
129129 def __down_host_interface (self ) -> typing .List [str ]:
130130 nic = libioc .NetworkInterface .QueuingNetworkInterface (
131- name = f"{ self ._escaped_nic_name } :$IOCAGE_JID " ,
131+ name = f"{ self ._escaped_nic_name } :$IOC_JID " ,
132132 extra_settings = ["destroy" ],
133133 logger = self .logger ,
134134 insecure = True
@@ -140,8 +140,8 @@ def __down_secure_mode_devices(self) -> typing.List[str]:
140140 self .logger .verbose ("Downing secure mode devices" )
141141 commands : typing .List [str ] = []
142142 secure_mode_nics = [
143- f"{ self ._escaped_nic_name } :$IOCAGE_JID :a" ,
144- f"{ self ._escaped_nic_name } :$IOCAGE_JID :net"
143+ f"{ self ._escaped_nic_name } :$IOC_JID :a" ,
144+ f"{ self ._escaped_nic_name } :$IOC_JID :net"
145145 ]
146146 for nic in secure_mode_nics :
147147 commands += libioc .NetworkInterface .QueuingNetworkInterface (
@@ -237,7 +237,7 @@ def __create_new_epair_interface(
237237
238238 epair_a = libioc .NetworkInterface .QueuingNetworkInterface (
239239 name = None ,
240- rename = f"{ self ._escaped_nic_name } :$IOCAGE_JID { nic_suffix_a } " ,
240+ rename = f"{ self ._escaped_nic_name } :$IOC_JID { nic_suffix_a } " ,
241241 destroy = True ,
242242 shell_variable_nic_name = variable_name_a ,
243243 logger = self .logger ,
@@ -248,7 +248,7 @@ def __create_new_epair_interface(
248248
249249 epair_b = libioc .NetworkInterface .QueuingNetworkInterface (
250250 name = None ,
251- rename = f"{ self ._escaped_nic_name } :$IOCAGE_JID { nic_suffix_b } " ,
251+ rename = f"{ self ._escaped_nic_name } :$IOC_JID { nic_suffix_b } " ,
252252 destroy = True ,
253253 shell_variable_nic_name = variable_name_b ,
254254 logger = self .logger ,
@@ -274,8 +274,8 @@ def __create_vnet_iface(self) -> typing.Tuple[
274274 self .firewall .ensure_firewall_enabled ()
275275
276276 commands_created += self .__create_new_epair_interface (
277- variable_name_a = f"IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " ,
278- variable_name_b = f"IOCAGE_NIC_EPAIR_B_ { self ._nic_hash } " ,
277+ variable_name_a = f"IOC_NIC_EPAIR_A_ { self ._nic_hash } " ,
278+ variable_name_b = f"IOC_NIC_EPAIR_B_ { self ._nic_hash } " ,
279279 nic_suffix_a = "" ,
280280 nic_suffix_b = ":j"
281281 )
@@ -294,7 +294,7 @@ def __create_vnet_iface(self) -> typing.Tuple[
294294
295295 host_if = libioc .NetworkInterface .QueuingNetworkInterface (
296296 name = None ,
297- shell_variable_nic_name = f"IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " ,
297+ shell_variable_nic_name = f"IOC_NIC_EPAIR_A_ { self ._nic_hash } " ,
298298 mac = mac_address_pair .a ,
299299 mtu = self .mtu ,
300300 description = self .nic_local_description ,
@@ -305,15 +305,15 @@ def __create_vnet_iface(self) -> typing.Tuple[
305305 if self ._is_secure_vnet_bridge is False :
306306 jail_bridge = libioc .NetworkInterface .QueuingNetworkInterface (
307307 name = self .bridge .name ,
308- addm = f"$IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " ,
308+ addm = f"$IOC_NIC_EPAIR_A_ { self ._nic_hash } " ,
309309 logger = self .logger ,
310310 insecure = True
311311 )
312312 commands_created += jail_bridge .read_commands ()
313313 else :
314314 commands_created += self .__create_new_epair_interface (
315- variable_name_a = f"IOCAGE_NIC_EPAIR_C_ { self ._nic_hash } " ,
316- variable_name_b = f"IOCAGE_NIC_EPAIR_D_ { self ._nic_hash } " ,
315+ variable_name_a = f"IOC_NIC_EPAIR_C_ { self ._nic_hash } " ,
316+ variable_name_b = f"IOC_NIC_EPAIR_D_ { self ._nic_hash } " ,
317317 nic_suffix_a = ":a" ,
318318 nic_suffix_b = ":b" ,
319319 mtu = self .mtu
@@ -328,19 +328,19 @@ def __create_vnet_iface(self) -> typing.Tuple[
328328 name = "bridge" ,
329329 create = True ,
330330 destroy = True ,
331- rename = f"{ self ._escaped_nic_name } :$IOCAGE_JID :net" ,
331+ rename = f"{ self ._escaped_nic_name } :$IOC_JID :net" ,
332332 insecure = True ,
333- shell_variable_nic_name = f"IOCAGE_NIC_BRIDGE_ { self ._nic_hash } " ,
333+ shell_variable_nic_name = f"IOC_NIC_BRIDGE_ { self ._nic_hash } " ,
334334 )
335335 commands_created += sec_bridge .read_commands ()
336336
337337 # add nic to secure bridge
338338 sec_bridge = libioc .NetworkInterface .QueuingNetworkInterface (
339339 name = None ,
340- shell_variable_nic_name = f"IOCAGE_NIC_BRIDGE_ { self ._nic_hash } " ,
340+ shell_variable_nic_name = f"IOC_NIC_BRIDGE_ { self ._nic_hash } " ,
341341 addm = [
342- f"$IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " ,
343- f"$IOCAGE_NIC_EPAIR_D_ { self ._nic_hash } "
342+ f"$IOC_NIC_EPAIR_A_ { self ._nic_hash } " ,
343+ f"$IOC_NIC_EPAIR_D_ { self ._nic_hash } "
344344 ],
345345 logger = self .logger ,
346346 insecure = True
@@ -350,7 +350,7 @@ def __create_vnet_iface(self) -> typing.Tuple[
350350 # add nic to jail bridge
351351 jail_bridge = libioc .NetworkInterface .QueuingNetworkInterface (
352352 name = self .bridge .name ,
353- addm = f"$IOCAGE_NIC_EPAIR_C_ { self ._nic_hash } " ,
353+ addm = f"$IOC_NIC_EPAIR_C_ { self ._nic_hash } " ,
354354 logger = self .logger ,
355355 insecure = True
356356 )
@@ -360,7 +360,7 @@ def __create_vnet_iface(self) -> typing.Tuple[
360360
361361 # assign epair_b to jail
362362 assigned_if = libioc .NetworkInterface .QueuingNetworkInterface (
363- shell_variable_nic_name = f"IOCAGE_NIC_EPAIR_B_ { self ._nic_hash } " ,
363+ shell_variable_nic_name = f"IOC_NIC_EPAIR_B_ { self ._nic_hash } " ,
364364 vnet = self .jail .identifier ,
365365 extra_settings = [],
366366 logger = self .logger
@@ -369,7 +369,7 @@ def __create_vnet_iface(self) -> typing.Tuple[
369369
370370 # configure network inside the jail
371371 jail_if = libioc .NetworkInterface .QueuingNetworkInterface (
372- name = f"{ self ._escaped_nic_name } :$IOCAGE_JID :j" ,
372+ name = f"{ self ._escaped_nic_name } :$IOC_JID :j" ,
373373 mac = str (mac_address_pair .b ),
374374 mtu = self .mtu ,
375375 rename = self ._escaped_nic_name ,
@@ -388,7 +388,7 @@ def __configure_firewall(self, mac_address: str) -> typing.List[str]:
388388 self .logger .verbose (
389389 f"Configuring Secure VNET Firewall for { self ._escaped_nic_name } "
390390 )
391- firewall_rule_number = f"$IOCAGE_JID "
391+ firewall_rule_number = f"$IOC_JID "
392392
393393 for protocol in ["ipv4" , "ipv6" ]:
394394 addresses = self .__getattribute__ (f"{ protocol } _addresses" )
@@ -405,34 +405,34 @@ def __configure_firewall(self, mac_address: str) -> typing.List[str]:
405405 "from" , _address , "to" , "any" ,
406406 "layer2" ,
407407 "MAC" , "any" , mac_address ,
408- "via" , f"{ self ._escaped_nic_name } :$IOCAGE_JID :b" ,
408+ "via" , f"{ self ._escaped_nic_name } :$IOC_JID :b" ,
409409 "out"
410410 ], insecure = True )
411411 self .firewall .add_rule (firewall_rule_number , [
412412 "allow" , protocol ,
413413 "from" , "any" , "to" , _address ,
414414 "layer2" ,
415415 "MAC" , mac_address , "any" ,
416- "via" , f"{ self ._escaped_nic_name } :$IOCAGE_JID " ,
416+ "via" , f"{ self ._escaped_nic_name } :$IOC_JID " ,
417417 "out"
418418 ], insecure = True )
419419 self .firewall .add_rule (firewall_rule_number , [
420420 "allow" , protocol ,
421421 "from" , "any" , "to" , _address ,
422- "via" , f"{ self ._escaped_nic_name } :$IOCAGE_JID " ,
422+ "via" , f"{ self ._escaped_nic_name } :$IOC_JID " ,
423423 "out"
424424 ], insecure = True )
425425 self .firewall .add_rule (firewall_rule_number , [
426426 "deny" , "log" , protocol ,
427427 "from" , "any" , "to" , "any" ,
428428 "layer2" ,
429- "via" , f"{ self ._escaped_nic_name } :$IOCAGE_JID :b" ,
429+ "via" , f"{ self ._escaped_nic_name } :$IOC_JID :b" ,
430430 "out"
431431 ], insecure = True )
432432 self .firewall .add_rule (firewall_rule_number , [
433433 "deny" , "log" , protocol ,
434434 "from" , "any" , "to" , "any" ,
435- "via" , f"{ self ._escaped_nic_name } :$IOCAGE_JID " ,
435+ "via" , f"{ self ._escaped_nic_name } :$IOC_JID " ,
436436 "out"
437437 ], insecure = True )
438438 self .logger .debug ("Firewall rules added" )
@@ -442,7 +442,7 @@ def __configure_firewall(self, mac_address: str) -> typing.List[str]:
442442 def __up_host_if (self ) -> typing .List [str ]:
443443 host_if = libioc .NetworkInterface .QueuingNetworkInterface (
444444 name = None ,
445- shell_variable_nic_name = f"IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " ,
445+ shell_variable_nic_name = f"IOC_NIC_EPAIR_A_ { self ._nic_hash } " ,
446446 logger = self .logger
447447 )
448448 commands : typing .List [str ] = host_if .read_commands ()
@@ -453,12 +453,12 @@ def env(self) -> typing.Dict[str, typing.Union[str, int]]:
453453 """Return a dict of env variables used by the network."""
454454 name = self ._escaped_nic_name
455455 script_env : typing .Dict [str , typing .Union [str , int ]] = {
456- f"IOCAGE_NIC_EPAIR_A_ { self ._nic_hash } " : f"{ name } :$IOCAGE_JID " ,
457- f"IOCAGE_NIC_EPAIR_B_ { self ._nic_hash } " : name ,
458- f"IOCAGE_NIC_EPAIR_C_ { self ._nic_hash } " : f"{ name } :$IOCAGE_JID :a" ,
459- f"IOCAGE_NIC_EPAIR_D_ { self ._nic_hash } " : f"{ name } :$IOCAGE_JID :b" ,
460- f"IOCAGE_NIC_BRIDGE_ { self ._nic_hash } " : f"{ name } :$IOCAGE_JID :net" ,
461- f"IOCAGE_NIC_ID_ { self ._nic_hash } " : self .epair_id
456+ f"IOC_NIC_EPAIR_A_ { self ._nic_hash } " : f"{ name } :$IOC_JID " ,
457+ f"IOC_NIC_EPAIR_B_ { self ._nic_hash } " : name ,
458+ f"IOC_NIC_EPAIR_C_ { self ._nic_hash } " : f"{ name } :$IOC_JID :a" ,
459+ f"IOC_NIC_EPAIR_D_ { self ._nic_hash } " : f"{ name } :$IOC_JID :b" ,
460+ f"IOC_NIC_BRIDGE_ { self ._nic_hash } " : f"{ name } :$IOC_JID :net" ,
461+ f"IOC_NIC_ID_ { self ._nic_hash } " : self .epair_id
462462 }
463463 return script_env
464464
0 commit comments