diff --git a/daemon/core/configservices/frrservices/services.py b/daemon/core/configservices/frrservices/services.py index 72050077..fa6f599a 100644 --- a/daemon/core/configservices/frrservices/services.py +++ b/daemon/core/configservices/frrservices/services.py @@ -65,7 +65,7 @@ class FRRZebra(ConfigService): ] executables: List[str] = ["zebra"] dependencies: List[str] = [] - startup: List[str] = ["sh frrboot.sh zebra"] + startup: List[str] = ["bash frrboot.sh zebra"] validate: List[str] = ["pidof zebra"] shutdown: List[str] = ["killall zebra"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING diff --git a/daemon/core/configservices/nrlservices/services.py b/daemon/core/configservices/nrlservices/services.py index cf9b4c88..3f911aef 100644 --- a/daemon/core/configservices/nrlservices/services.py +++ b/daemon/core/configservices/nrlservices/services.py @@ -14,7 +14,7 @@ class MgenSinkService(ConfigService): files: List[str] = ["mgensink.sh", "sink.mgen"] executables: List[str] = ["mgen"] dependencies: List[str] = [] - startup: List[str] = ["sh mgensink.sh"] + startup: List[str] = ["bash mgensink.sh"] validate: List[str] = ["pidof mgen"] shutdown: List[str] = ["killall mgen"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -36,7 +36,7 @@ class NrlNhdp(ConfigService): files: List[str] = ["nrlnhdp.sh"] executables: List[str] = ["nrlnhdp"] dependencies: List[str] = [] - startup: List[str] = ["sh nrlnhdp.sh"] + startup: List[str] = ["bash nrlnhdp.sh"] validate: List[str] = ["pidof nrlnhdp"] shutdown: List[str] = ["killall nrlnhdp"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -58,7 +58,7 @@ class NrlSmf(ConfigService): files: List[str] = ["startsmf.sh"] executables: List[str] = ["nrlsmf", "killall"] dependencies: List[str] = [] - startup: List[str] = ["sh startsmf.sh"] + startup: List[str] = ["bash startsmf.sh"] validate: List[str] = ["pidof nrlsmf"] shutdown: List[str] = ["killall nrlsmf"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -93,7 +93,7 @@ class NrlOlsr(ConfigService): files: List[str] = ["nrlolsrd.sh"] executables: List[str] = ["nrlolsrd"] dependencies: List[str] = [] - startup: List[str] = ["sh nrlolsrd.sh"] + startup: List[str] = ["bash nrlolsrd.sh"] validate: List[str] = ["pidof nrlolsrd"] shutdown: List[str] = ["killall nrlolsrd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -117,7 +117,7 @@ class NrlOlsrv2(ConfigService): files: List[str] = ["nrlolsrv2.sh"] executables: List[str] = ["nrlolsrv2"] dependencies: List[str] = [] - startup: List[str] = ["sh nrlolsrv2.sh"] + startup: List[str] = ["bash nrlolsrv2.sh"] validate: List[str] = ["pidof nrlolsrv2"] shutdown: List[str] = ["killall nrlolsrv2"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -139,7 +139,7 @@ class OlsrOrg(ConfigService): files: List[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"] executables: List[str] = ["olsrd"] dependencies: List[str] = [] - startup: List[str] = ["sh olsrd.sh"] + startup: List[str] = ["bash olsrd.sh"] validate: List[str] = ["pidof olsrd"] shutdown: List[str] = ["killall olsrd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -161,7 +161,7 @@ class MgenActor(ConfigService): files: List[str] = ["start_mgen_actor.sh"] executables: List[str] = ["mgen"] dependencies: List[str] = [] - startup: List[str] = ["sh start_mgen_actor.sh"] + startup: List[str] = ["bash start_mgen_actor.sh"] validate: List[str] = ["pidof mgen"] shutdown: List[str] = ["killall mgen"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -176,7 +176,7 @@ class Arouted(ConfigService): files: List[str] = ["startarouted.sh"] executables: List[str] = ["arouted"] dependencies: List[str] = [] - startup: List[str] = ["sh startarouted.sh"] + startup: List[str] = ["bash startarouted.sh"] validate: List[str] = ["pidof arouted"] shutdown: List[str] = ["pkill arouted"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING diff --git a/daemon/core/configservices/quaggaservices/services.py b/daemon/core/configservices/quaggaservices/services.py index 19430664..bf23e00c 100644 --- a/daemon/core/configservices/quaggaservices/services.py +++ b/daemon/core/configservices/quaggaservices/services.py @@ -65,7 +65,7 @@ class Zebra(ConfigService): ] executables: List[str] = ["zebra"] dependencies: List[str] = [] - startup: List[str] = ["sh quaggaboot.sh zebra"] + startup: List[str] = ["bash quaggaboot.sh zebra"] validate: List[str] = ["pidof zebra"] shutdown: List[str] = ["killall zebra"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING diff --git a/daemon/core/configservices/securityservices/services.py b/daemon/core/configservices/securityservices/services.py index 4a58fd8c..c656f5ca 100644 --- a/daemon/core/configservices/securityservices/services.py +++ b/daemon/core/configservices/securityservices/services.py @@ -14,7 +14,7 @@ class VpnClient(ConfigService): files: List[str] = ["vpnclient.sh"] executables: List[str] = ["openvpn", "ip", "killall"] dependencies: List[str] = [] - startup: List[str] = ["sh vpnclient.sh"] + startup: List[str] = ["bash vpnclient.sh"] validate: List[str] = ["pidof openvpn"] shutdown: List[str] = ["killall openvpn"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -48,7 +48,7 @@ class VpnServer(ConfigService): files: List[str] = ["vpnserver.sh"] executables: List[str] = ["openvpn", "ip", "killall"] dependencies: List[str] = [] - startup: List[str] = ["sh vpnserver.sh"] + startup: List[str] = ["bash vpnserver.sh"] validate: List[str] = ["pidof openvpn"] shutdown: List[str] = ["killall openvpn"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -91,7 +91,7 @@ class IPsec(ConfigService): files: List[str] = ["ipsec.sh"] executables: List[str] = ["racoon", "ip", "setkey", "killall"] dependencies: List[str] = [] - startup: List[str] = ["sh ipsec.sh"] + startup: List[str] = ["bash ipsec.sh"] validate: List[str] = ["pidof racoon"] shutdown: List[str] = ["killall racoon"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -106,7 +106,7 @@ class Firewall(ConfigService): files: List[str] = ["firewall.sh"] executables: List[str] = ["iptables"] dependencies: List[str] = [] - startup: List[str] = ["sh firewall.sh"] + startup: List[str] = ["bash firewall.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -121,7 +121,7 @@ class Nat(ConfigService): files: List[str] = ["nat.sh"] executables: List[str] = ["iptables"] dependencies: List[str] = [] - startup: List[str] = ["sh nat.sh"] + startup: List[str] = ["bash nat.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING diff --git a/daemon/core/configservices/utilservices/services.py b/daemon/core/configservices/utilservices/services.py index b6bc0eb5..9b3369db 100644 --- a/daemon/core/configservices/utilservices/services.py +++ b/daemon/core/configservices/utilservices/services.py @@ -16,7 +16,7 @@ class DefaultRouteService(ConfigService): files: List[str] = ["defaultroute.sh"] executables: List[str] = ["ip"] dependencies: List[str] = [] - startup: List[str] = ["sh defaultroute.sh"] + startup: List[str] = ["bash defaultroute.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -44,7 +44,7 @@ class DefaultMulticastRouteService(ConfigService): files: List[str] = ["defaultmroute.sh"] executables: List[str] = [] dependencies: List[str] = [] - startup: List[str] = ["sh defaultmroute.sh"] + startup: List[str] = ["bash defaultmroute.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -66,7 +66,7 @@ class StaticRouteService(ConfigService): files: List[str] = ["staticroute.sh"] executables: List[str] = [] dependencies: List[str] = [] - startup: List[str] = ["sh staticroute.sh"] + startup: List[str] = ["bash staticroute.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -94,7 +94,7 @@ class IpForwardService(ConfigService): files: List[str] = ["ipforward.sh"] executables: List[str] = ["sysctl"] dependencies: List[str] = [] - startup: List[str] = ["sh ipforward.sh"] + startup: List[str] = ["bash ipforward.sh"] validate: List[str] = [] shutdown: List[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -116,7 +116,7 @@ class SshService(ConfigService): files: List[str] = ["startsshd.sh", "/etc/ssh/sshd_config"] executables: List[str] = ["sshd"] dependencies: List[str] = [] - startup: List[str] = ["sh startsshd.sh"] + startup: List[str] = ["bash startsshd.sh"] validate: List[str] = [] shutdown: List[str] = ["killall sshd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -164,7 +164,7 @@ class DhcpClientService(ConfigService): files: List[str] = ["startdhcpclient.sh"] executables: List[str] = ["dhclient"] dependencies: List[str] = [] - startup: List[str] = ["sh startdhcpclient.sh"] + startup: List[str] = ["bash startdhcpclient.sh"] validate: List[str] = ["pidof dhclient"] shutdown: List[str] = ["killall dhclient"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING @@ -200,9 +200,9 @@ class PcapService(ConfigService): files: List[str] = ["pcap.sh"] executables: List[str] = ["tcpdump"] dependencies: List[str] = [] - startup: List[str] = ["sh pcap.sh start"] + startup: List[str] = ["bash pcap.sh start"] validate: List[str] = ["pidof tcpdump"] - shutdown: List[str] = ["sh pcap.sh stop"] + shutdown: List[str] = ["bash pcap.sh stop"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING default_configs: List[Configuration] = [] modes: Dict[str, Dict[str, str]] = {} @@ -249,7 +249,7 @@ class AtdService(ConfigService): files: List[str] = ["startatd.sh"] executables: List[str] = ["atd"] dependencies: List[str] = [] - startup: List[str] = ["sh startatd.sh"] + startup: List[str] = ["bash startatd.sh"] validate: List[str] = ["pidof atd"] shutdown: List[str] = ["pkill atd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING diff --git a/daemon/core/executables.py b/daemon/core/executables.py index 6eb0214a..7b7f80b7 100644 --- a/daemon/core/executables.py +++ b/daemon/core/executables.py @@ -1,5 +1,6 @@ from typing import List +BASH: str = "bash" VNODED: str = "vnoded" VCMD: str = "vcmd" SYSCTL: str = "sysctl" @@ -11,7 +12,16 @@ MOUNT: str = "mount" UMOUNT: str = "umount" OVS_VSCTL: str = "ovs-vsctl" -COMMON_REQUIREMENTS: List[str] = [SYSCTL, IP, ETHTOOL, TC, EBTABLES, MOUNT, UMOUNT] +COMMON_REQUIREMENTS: List[str] = [ + BASH, + EBTABLES, + ETHTOOL, + IP, + MOUNT, + SYSCTL, + TC, + UMOUNT, +] VCMD_REQUIREMENTS: List[str] = [VNODED, VCMD] OVS_REQUIREMENTS: List[str] = [OVS_VSCTL] diff --git a/daemon/core/location/mobility.py b/daemon/core/location/mobility.py index e982c5c1..0e9b2e32 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -22,6 +22,7 @@ from core.emulator.enumerations import ( RegisterTlvs, ) from core.errors import CoreError +from core.executables import BASH from core.nodes.base import CoreNode from core.nodes.interface import CoreInterface from core.nodes.network import WlanNode @@ -1167,7 +1168,7 @@ class Ns2ScriptedMobility(WayPointMobility): if filename is None or filename == "": return filename = self.findfile(filename) - args = f"/bin/sh {filename} {typestr}" + args = f"{BASH} {filename} {typestr}" utils.cmd( args, cwd=self.session.session_dir, env=self.session.get_environment() ) diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index cea1e81b..4cf6ea8d 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -599,7 +599,7 @@ class CoreNode(CoreNodeBase): if self.server is None: return self.client.check_cmd(args, wait=wait, shell=shell) else: - args = self.client.create_cmd(args) + args = self.client.create_cmd(args, shell) return self.server.remote_cmd(args, wait=wait) def termcmdstring(self, sh: str = "/bin/sh") -> str: diff --git a/daemon/core/nodes/client.py b/daemon/core/nodes/client.py index 93e099cf..710724b1 100644 --- a/daemon/core/nodes/client.py +++ b/daemon/core/nodes/client.py @@ -5,7 +5,7 @@ The control channel can be accessed via calls using the vcmd shell. """ from core import utils -from core.executables import VCMD +from core.executables import BASH, VCMD class VnodeClient: @@ -49,7 +49,9 @@ class VnodeClient: """ pass - def create_cmd(self, args: str) -> str: + def create_cmd(self, args: str, shell: bool = False) -> str: + if shell: + args = f'{BASH} -c "{args}"' return f"{VCMD} -c {self.ctrlchnlname} -- {args}" def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: @@ -63,5 +65,5 @@ class VnodeClient: :raises core.CoreCommandError: when there is a non-zero exit status """ self._verify_connection() - args = self.create_cmd(args) + args = self.create_cmd(args, shell) return utils.cmd(args, wait=wait, shell=shell) diff --git a/daemon/core/nodes/interface.py b/daemon/core/nodes/interface.py index 7f33973e..20dc8fd3 100644 --- a/daemon/core/nodes/interface.py +++ b/daemon/core/nodes/interface.py @@ -383,12 +383,12 @@ class Veth(CoreInterface): try: self.node.node_net_client.device_flush(self.name) except CoreCommandError: - logging.exception("error shutting down interface") + pass if self.localname: try: self.net_client.delete_device(self.localname) except CoreCommandError: - logging.info("link already removed: %s", self.localname) + pass self.up = False diff --git a/daemon/core/nodes/netclient.py b/daemon/core/nodes/netclient.py index 96a1f4be..68fbef98 100644 --- a/daemon/core/nodes/netclient.py +++ b/daemon/core/nodes/netclient.py @@ -121,11 +121,7 @@ class LinuxNetClient: :param device: device to flush :return: nothing """ - self.run( - f"[ -e /sys/class/net/{device} ] && " - f"{IP} address flush dev {device} || true", - shell=True, - ) + self.run(f"{IP} address flush dev {device}") def device_mac(self, device: str, mac: str) -> None: """ diff --git a/daemon/core/services/emaneservices.py b/daemon/core/services/emaneservices.py index d694317a..4fd78ec1 100644 --- a/daemon/core/services/emaneservices.py +++ b/daemon/core/services/emaneservices.py @@ -13,7 +13,7 @@ class EmaneTransportService(CoreService): dependencies: Tuple[str, ...] = () dirs: Tuple[str, ...] = () configs: Tuple[str, ...] = ("emanetransport.sh",) - startup: Tuple[str, ...] = (f"sh {configs[0]}",) + startup: Tuple[str, ...] = (f"bash {configs[0]}",) validate: Tuple[str, ...] = (f"pidof {executables[0]}",) validation_timer: float = 0.5 shutdown: Tuple[str, ...] = (f"killall {executables[0]}",) diff --git a/daemon/core/services/frr.py b/daemon/core/services/frr.py index b130fd8c..cec9d860 100644 --- a/daemon/core/services/frr.py +++ b/daemon/core/services/frr.py @@ -26,7 +26,7 @@ class FRRZebra(CoreService): "/usr/local/etc/frr/vtysh.conf", "/usr/local/etc/frr/daemons", ) - startup: Tuple[str, ...] = ("sh frrboot.sh zebra",) + startup: Tuple[str, ...] = ("bash frrboot.sh zebra",) shutdown: Tuple[str, ...] = ("killall zebra",) validate: Tuple[str, ...] = ("pidof zebra",) diff --git a/daemon/core/services/nrl.py b/daemon/core/services/nrl.py index 697f4eee..91e053b2 100644 --- a/daemon/core/services/nrl.py +++ b/daemon/core/services/nrl.py @@ -97,7 +97,7 @@ class NrlSmf(NrlService): name: str = "SMF" executables: Tuple[str, ...] = ("nrlsmf",) - startup: Tuple[str, ...] = ("sh startsmf.sh",) + startup: Tuple[str, ...] = ("bash startsmf.sh",) shutdown: Tuple[str, ...] = ("killall nrlsmf",) validate: Tuple[str, ...] = ("pidof nrlsmf",) configs: Tuple[str, ...] = ("startsmf.sh",) @@ -566,7 +566,7 @@ class MgenActor(NrlService): group: str = "ProtoSvc" executables: Tuple[str, ...] = ("mgen",) configs: Tuple[str, ...] = ("start_mgen_actor.sh",) - startup: Tuple[str, ...] = ("sh start_mgen_actor.sh",) + startup: Tuple[str, ...] = ("bash start_mgen_actor.sh",) validate: Tuple[str, ...] = ("pidof mgen",) shutdown: Tuple[str, ...] = ("killall mgen",) @@ -596,7 +596,7 @@ class Arouted(NrlService): name: str = "arouted" executables: Tuple[str, ...] = ("arouted",) configs: Tuple[str, ...] = ("startarouted.sh",) - startup: Tuple[str, ...] = ("sh startarouted.sh",) + startup: Tuple[str, ...] = ("bash startarouted.sh",) shutdown: Tuple[str, ...] = ("pkill arouted",) validate: Tuple[str, ...] = ("pidof arouted",) diff --git a/daemon/core/services/quagga.py b/daemon/core/services/quagga.py index 9e2c7cc0..8c474fd8 100644 --- a/daemon/core/services/quagga.py +++ b/daemon/core/services/quagga.py @@ -25,7 +25,7 @@ class Zebra(CoreService): "quaggaboot.sh", "/usr/local/etc/quagga/vtysh.conf", ) - startup: Tuple[str, ...] = ("sh quaggaboot.sh zebra",) + startup: Tuple[str, ...] = ("bash quaggaboot.sh zebra",) shutdown: Tuple[str, ...] = ("killall zebra",) validate: Tuple[str, ...] = ("pidof zebra",) diff --git a/daemon/core/services/sdn.py b/daemon/core/services/sdn.py index ef077662..e72b5138 100644 --- a/daemon/core/services/sdn.py +++ b/daemon/core/services/sdn.py @@ -31,7 +31,7 @@ class OvsService(SdnService): "/var/log/openvswitch", ) configs: Tuple[str, ...] = ("OvsService.sh",) - startup: Tuple[str, ...] = ("sh OvsService.sh",) + startup: Tuple[str, ...] = ("bash OvsService.sh",) shutdown: Tuple[str, ...] = ("killall ovs-vswitchd", "killall ovsdb-server") @classmethod @@ -119,7 +119,7 @@ class RyuService(SdnService): group: str = "SDN" executables: Tuple[str, ...] = ("ryu-manager",) configs: Tuple[str, ...] = ("ryuService.sh",) - startup: Tuple[str, ...] = ("sh ryuService.sh",) + startup: Tuple[str, ...] = ("bash ryuService.sh",) shutdown: Tuple[str, ...] = ("killall ryu-manager",) @classmethod diff --git a/daemon/core/services/security.py b/daemon/core/services/security.py index b813579e..788988c9 100644 --- a/daemon/core/services/security.py +++ b/daemon/core/services/security.py @@ -16,7 +16,7 @@ class VPNClient(CoreService): name: str = "VPNClient" group: str = "Security" configs: Tuple[str, ...] = ("vpnclient.sh",) - startup: Tuple[str, ...] = ("sh vpnclient.sh",) + startup: Tuple[str, ...] = ("bash vpnclient.sh",) shutdown: Tuple[str, ...] = ("killall openvpn",) validate: Tuple[str, ...] = ("pidof openvpn",) custom_needed: bool = True @@ -43,7 +43,7 @@ class VPNServer(CoreService): name: str = "VPNServer" group: str = "Security" configs: Tuple[str, ...] = ("vpnserver.sh",) - startup: Tuple[str, ...] = ("sh vpnserver.sh",) + startup: Tuple[str, ...] = ("bash vpnserver.sh",) shutdown: Tuple[str, ...] = ("killall openvpn",) validate: Tuple[str, ...] = ("pidof openvpn",) custom_needed: bool = True @@ -71,7 +71,7 @@ class IPsec(CoreService): name: str = "IPsec" group: str = "Security" configs: Tuple[str, ...] = ("ipsec.sh",) - startup: Tuple[str, ...] = ("sh ipsec.sh",) + startup: Tuple[str, ...] = ("bash ipsec.sh",) shutdown: Tuple[str, ...] = ("killall racoon",) custom_needed: bool = True @@ -97,7 +97,7 @@ class Firewall(CoreService): name: str = "Firewall" group: str = "Security" configs: Tuple[str, ...] = ("firewall.sh",) - startup: Tuple[str, ...] = ("sh firewall.sh",) + startup: Tuple[str, ...] = ("bash firewall.sh",) custom_needed: bool = True @classmethod @@ -127,7 +127,7 @@ class Nat(CoreService): group: str = "Security" executables: Tuple[str, ...] = ("iptables",) configs: Tuple[str, ...] = ("nat.sh",) - startup: Tuple[str, ...] = ("sh nat.sh",) + startup: Tuple[str, ...] = ("bash nat.sh",) custom_needed: bool = False @classmethod diff --git a/daemon/core/services/ucarp.py b/daemon/core/services/ucarp.py index 8ac92dd3..522eeaf6 100644 --- a/daemon/core/services/ucarp.py +++ b/daemon/core/services/ucarp.py @@ -19,7 +19,7 @@ class Ucarp(CoreService): UCARP_ETC + "/default-down.sh", "ucarpboot.sh", ) - startup: Tuple[str, ...] = ("sh ucarpboot.sh",) + startup: Tuple[str, ...] = ("bash ucarpboot.sh",) shutdown: Tuple[str, ...] = ("killall ucarp",) validate: Tuple[str, ...] = ("pidof ucarp",) diff --git a/daemon/core/services/utility.py b/daemon/core/services/utility.py index 774c4104..a30d1f62 100644 --- a/daemon/core/services/utility.py +++ b/daemon/core/services/utility.py @@ -28,7 +28,7 @@ class UtilService(CoreService): class IPForwardService(UtilService): name: str = "IPForward" configs: Tuple[str, ...] = ("ipforward.sh",) - startup: Tuple[str, ...] = ("sh ipforward.sh",) + startup: Tuple[str, ...] = ("bash ipforward.sh",) @classmethod def generate_config(cls, node: CoreNode, filename: str) -> str: @@ -61,7 +61,7 @@ class IPForwardService(UtilService): class DefaultRouteService(UtilService): name: str = "DefaultRoute" configs: Tuple[str, ...] = ("defaultroute.sh",) - startup: Tuple[str, ...] = ("sh defaultroute.sh",) + startup: Tuple[str, ...] = ("bash defaultroute.sh",) @classmethod def generate_config(cls, node: CoreNode, filename: str) -> str: @@ -84,7 +84,7 @@ class DefaultRouteService(UtilService): class DefaultMulticastRouteService(UtilService): name: str = "DefaultMulticastRoute" configs: Tuple[str, ...] = ("defaultmroute.sh",) - startup: Tuple[str, ...] = ("sh defaultmroute.sh",) + startup: Tuple[str, ...] = ("bash defaultmroute.sh",) @classmethod def generate_config(cls, node: CoreNode, filename: str) -> str: @@ -103,7 +103,7 @@ class DefaultMulticastRouteService(UtilService): class StaticRouteService(UtilService): name: str = "StaticRoute" configs: Tuple[str, ...] = ("staticroute.sh",) - startup: Tuple[str, ...] = ("sh staticroute.sh",) + startup: Tuple[str, ...] = ("bash staticroute.sh",) custom_needed: bool = True @classmethod @@ -135,7 +135,7 @@ class SshService(UtilService): name: str = "SSH" configs: Tuple[str, ...] = ("startsshd.sh", "/etc/ssh/sshd_config") dirs: Tuple[str, ...] = ("/etc/ssh", "/var/run/sshd") - startup: Tuple[str, ...] = ("sh startsshd.sh",) + startup: Tuple[str, ...] = ("bash startsshd.sh",) shutdown: Tuple[str, ...] = ("killall sshd",) validation_mode: ServiceMode = ServiceMode.BLOCKING @@ -278,7 +278,7 @@ class DhcpClientService(UtilService): name: str = "DHCPClient" configs: Tuple[str, ...] = ("startdhcpclient.sh",) - startup: Tuple[str, ...] = ("sh startdhcpclient.sh",) + startup: Tuple[str, ...] = ("bash startdhcpclient.sh",) shutdown: Tuple[str, ...] = ("killall dhclient",) validate: Tuple[str, ...] = ("pidof dhclient",) @@ -561,8 +561,8 @@ class PcapService(UtilService): name: str = "pcap" configs: Tuple[str, ...] = ("pcap.sh",) - startup: Tuple[str, ...] = ("sh pcap.sh start",) - shutdown: Tuple[str, ...] = ("sh pcap.sh stop",) + startup: Tuple[str, ...] = ("bash pcap.sh start",) + shutdown: Tuple[str, ...] = ("bash pcap.sh stop",) validate: Tuple[str, ...] = ("pidof tcpdump",) meta: str = "logs network traffic to pcap packet capture files" @@ -671,7 +671,7 @@ class AtdService(UtilService): name: str = "atd" configs: Tuple[str, ...] = ("startatd.sh",) dirs: Tuple[str, ...] = ("/var/spool/cron/atjobs", "/var/spool/cron/atspool") - startup: Tuple[str, ...] = ("sh startatd.sh",) + startup: Tuple[str, ...] = ("bash startatd.sh",) shutdown: Tuple[str, ...] = ("pkill atd",) @classmethod diff --git a/tasks.py b/tasks.py index 5f52f444..c3e6d2bb 100644 --- a/tasks.py +++ b/tasks.py @@ -120,14 +120,14 @@ def install_system(c: Context, os_info: OsInfo, hide: bool) -> None: if os_info.like == OsLike.DEBIAN: c.run( "sudo apt install -y automake pkg-config gcc libev-dev ebtables " - "iproute2 ethtool tk python3-tk", + "iproute2 ethtool tk python3-tk bash", hide=hide ) elif os_info.like == OsLike.REDHAT: c.run( "sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ " "libev-devel iptables-ebtables iproute python3-devel python3-tkinter " - "tk ethtool make", + "tk ethtool make bash", hide=hide ) # centos 8+ does not support netem by default