daemon: changes usage of running scripts using /bin/sh to bash to help provide consistency in what could be ran, added bash as a dependency in installation scripts, added bash as an executable check during startup

This commit is contained in:
Blake Harnden 2020-07-28 16:13:37 -07:00
parent eb70386238
commit 0d2dd70727
20 changed files with 71 additions and 62 deletions

View file

@ -65,7 +65,7 @@ class FRRZebra(ConfigService):
] ]
executables: List[str] = ["zebra"] executables: List[str] = ["zebra"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh frrboot.sh zebra"] startup: List[str] = ["bash frrboot.sh zebra"]
validate: List[str] = ["pidof zebra"] validate: List[str] = ["pidof zebra"]
shutdown: List[str] = ["killall zebra"] shutdown: List[str] = ["killall zebra"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING

View file

@ -14,7 +14,7 @@ class MgenSinkService(ConfigService):
files: List[str] = ["mgensink.sh", "sink.mgen"] files: List[str] = ["mgensink.sh", "sink.mgen"]
executables: List[str] = ["mgen"] executables: List[str] = ["mgen"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh mgensink.sh"] startup: List[str] = ["bash mgensink.sh"]
validate: List[str] = ["pidof mgen"] validate: List[str] = ["pidof mgen"]
shutdown: List[str] = ["killall mgen"] shutdown: List[str] = ["killall mgen"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -36,7 +36,7 @@ class NrlNhdp(ConfigService):
files: List[str] = ["nrlnhdp.sh"] files: List[str] = ["nrlnhdp.sh"]
executables: List[str] = ["nrlnhdp"] executables: List[str] = ["nrlnhdp"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh nrlnhdp.sh"] startup: List[str] = ["bash nrlnhdp.sh"]
validate: List[str] = ["pidof nrlnhdp"] validate: List[str] = ["pidof nrlnhdp"]
shutdown: List[str] = ["killall nrlnhdp"] shutdown: List[str] = ["killall nrlnhdp"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -58,7 +58,7 @@ class NrlSmf(ConfigService):
files: List[str] = ["startsmf.sh"] files: List[str] = ["startsmf.sh"]
executables: List[str] = ["nrlsmf", "killall"] executables: List[str] = ["nrlsmf", "killall"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh startsmf.sh"] startup: List[str] = ["bash startsmf.sh"]
validate: List[str] = ["pidof nrlsmf"] validate: List[str] = ["pidof nrlsmf"]
shutdown: List[str] = ["killall nrlsmf"] shutdown: List[str] = ["killall nrlsmf"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -93,7 +93,7 @@ class NrlOlsr(ConfigService):
files: List[str] = ["nrlolsrd.sh"] files: List[str] = ["nrlolsrd.sh"]
executables: List[str] = ["nrlolsrd"] executables: List[str] = ["nrlolsrd"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh nrlolsrd.sh"] startup: List[str] = ["bash nrlolsrd.sh"]
validate: List[str] = ["pidof nrlolsrd"] validate: List[str] = ["pidof nrlolsrd"]
shutdown: List[str] = ["killall nrlolsrd"] shutdown: List[str] = ["killall nrlolsrd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -117,7 +117,7 @@ class NrlOlsrv2(ConfigService):
files: List[str] = ["nrlolsrv2.sh"] files: List[str] = ["nrlolsrv2.sh"]
executables: List[str] = ["nrlolsrv2"] executables: List[str] = ["nrlolsrv2"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh nrlolsrv2.sh"] startup: List[str] = ["bash nrlolsrv2.sh"]
validate: List[str] = ["pidof nrlolsrv2"] validate: List[str] = ["pidof nrlolsrv2"]
shutdown: List[str] = ["killall nrlolsrv2"] shutdown: List[str] = ["killall nrlolsrv2"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -139,7 +139,7 @@ class OlsrOrg(ConfigService):
files: List[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"] files: List[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"]
executables: List[str] = ["olsrd"] executables: List[str] = ["olsrd"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh olsrd.sh"] startup: List[str] = ["bash olsrd.sh"]
validate: List[str] = ["pidof olsrd"] validate: List[str] = ["pidof olsrd"]
shutdown: List[str] = ["killall olsrd"] shutdown: List[str] = ["killall olsrd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -161,7 +161,7 @@ class MgenActor(ConfigService):
files: List[str] = ["start_mgen_actor.sh"] files: List[str] = ["start_mgen_actor.sh"]
executables: List[str] = ["mgen"] executables: List[str] = ["mgen"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh start_mgen_actor.sh"] startup: List[str] = ["bash start_mgen_actor.sh"]
validate: List[str] = ["pidof mgen"] validate: List[str] = ["pidof mgen"]
shutdown: List[str] = ["killall mgen"] shutdown: List[str] = ["killall mgen"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -176,7 +176,7 @@ class Arouted(ConfigService):
files: List[str] = ["startarouted.sh"] files: List[str] = ["startarouted.sh"]
executables: List[str] = ["arouted"] executables: List[str] = ["arouted"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh startarouted.sh"] startup: List[str] = ["bash startarouted.sh"]
validate: List[str] = ["pidof arouted"] validate: List[str] = ["pidof arouted"]
shutdown: List[str] = ["pkill arouted"] shutdown: List[str] = ["pkill arouted"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING

View file

@ -65,7 +65,7 @@ class Zebra(ConfigService):
] ]
executables: List[str] = ["zebra"] executables: List[str] = ["zebra"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh quaggaboot.sh zebra"] startup: List[str] = ["bash quaggaboot.sh zebra"]
validate: List[str] = ["pidof zebra"] validate: List[str] = ["pidof zebra"]
shutdown: List[str] = ["killall zebra"] shutdown: List[str] = ["killall zebra"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING

View file

@ -14,7 +14,7 @@ class VpnClient(ConfigService):
files: List[str] = ["vpnclient.sh"] files: List[str] = ["vpnclient.sh"]
executables: List[str] = ["openvpn", "ip", "killall"] executables: List[str] = ["openvpn", "ip", "killall"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh vpnclient.sh"] startup: List[str] = ["bash vpnclient.sh"]
validate: List[str] = ["pidof openvpn"] validate: List[str] = ["pidof openvpn"]
shutdown: List[str] = ["killall openvpn"] shutdown: List[str] = ["killall openvpn"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -48,7 +48,7 @@ class VpnServer(ConfigService):
files: List[str] = ["vpnserver.sh"] files: List[str] = ["vpnserver.sh"]
executables: List[str] = ["openvpn", "ip", "killall"] executables: List[str] = ["openvpn", "ip", "killall"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh vpnserver.sh"] startup: List[str] = ["bash vpnserver.sh"]
validate: List[str] = ["pidof openvpn"] validate: List[str] = ["pidof openvpn"]
shutdown: List[str] = ["killall openvpn"] shutdown: List[str] = ["killall openvpn"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -91,7 +91,7 @@ class IPsec(ConfigService):
files: List[str] = ["ipsec.sh"] files: List[str] = ["ipsec.sh"]
executables: List[str] = ["racoon", "ip", "setkey", "killall"] executables: List[str] = ["racoon", "ip", "setkey", "killall"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh ipsec.sh"] startup: List[str] = ["bash ipsec.sh"]
validate: List[str] = ["pidof racoon"] validate: List[str] = ["pidof racoon"]
shutdown: List[str] = ["killall racoon"] shutdown: List[str] = ["killall racoon"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -106,7 +106,7 @@ class Firewall(ConfigService):
files: List[str] = ["firewall.sh"] files: List[str] = ["firewall.sh"]
executables: List[str] = ["iptables"] executables: List[str] = ["iptables"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh firewall.sh"] startup: List[str] = ["bash firewall.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -121,7 +121,7 @@ class Nat(ConfigService):
files: List[str] = ["nat.sh"] files: List[str] = ["nat.sh"]
executables: List[str] = ["iptables"] executables: List[str] = ["iptables"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh nat.sh"] startup: List[str] = ["bash nat.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING

View file

@ -16,7 +16,7 @@ class DefaultRouteService(ConfigService):
files: List[str] = ["defaultroute.sh"] files: List[str] = ["defaultroute.sh"]
executables: List[str] = ["ip"] executables: List[str] = ["ip"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh defaultroute.sh"] startup: List[str] = ["bash defaultroute.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -44,7 +44,7 @@ class DefaultMulticastRouteService(ConfigService):
files: List[str] = ["defaultmroute.sh"] files: List[str] = ["defaultmroute.sh"]
executables: List[str] = [] executables: List[str] = []
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh defaultmroute.sh"] startup: List[str] = ["bash defaultmroute.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -66,7 +66,7 @@ class StaticRouteService(ConfigService):
files: List[str] = ["staticroute.sh"] files: List[str] = ["staticroute.sh"]
executables: List[str] = [] executables: List[str] = []
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh staticroute.sh"] startup: List[str] = ["bash staticroute.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -94,7 +94,7 @@ class IpForwardService(ConfigService):
files: List[str] = ["ipforward.sh"] files: List[str] = ["ipforward.sh"]
executables: List[str] = ["sysctl"] executables: List[str] = ["sysctl"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh ipforward.sh"] startup: List[str] = ["bash ipforward.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = [] shutdown: List[str] = []
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -116,7 +116,7 @@ class SshService(ConfigService):
files: List[str] = ["startsshd.sh", "/etc/ssh/sshd_config"] files: List[str] = ["startsshd.sh", "/etc/ssh/sshd_config"]
executables: List[str] = ["sshd"] executables: List[str] = ["sshd"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh startsshd.sh"] startup: List[str] = ["bash startsshd.sh"]
validate: List[str] = [] validate: List[str] = []
shutdown: List[str] = ["killall sshd"] shutdown: List[str] = ["killall sshd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -164,7 +164,7 @@ class DhcpClientService(ConfigService):
files: List[str] = ["startdhcpclient.sh"] files: List[str] = ["startdhcpclient.sh"]
executables: List[str] = ["dhclient"] executables: List[str] = ["dhclient"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh startdhcpclient.sh"] startup: List[str] = ["bash startdhcpclient.sh"]
validate: List[str] = ["pidof dhclient"] validate: List[str] = ["pidof dhclient"]
shutdown: List[str] = ["killall dhclient"] shutdown: List[str] = ["killall dhclient"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
@ -200,9 +200,9 @@ class PcapService(ConfigService):
files: List[str] = ["pcap.sh"] files: List[str] = ["pcap.sh"]
executables: List[str] = ["tcpdump"] executables: List[str] = ["tcpdump"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh pcap.sh start"] startup: List[str] = ["bash pcap.sh start"]
validate: List[str] = ["pidof tcpdump"] validate: List[str] = ["pidof tcpdump"]
shutdown: List[str] = ["sh pcap.sh stop"] shutdown: List[str] = ["bash pcap.sh stop"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING
default_configs: List[Configuration] = [] default_configs: List[Configuration] = []
modes: Dict[str, Dict[str, str]] = {} modes: Dict[str, Dict[str, str]] = {}
@ -249,7 +249,7 @@ class AtdService(ConfigService):
files: List[str] = ["startatd.sh"] files: List[str] = ["startatd.sh"]
executables: List[str] = ["atd"] executables: List[str] = ["atd"]
dependencies: List[str] = [] dependencies: List[str] = []
startup: List[str] = ["sh startatd.sh"] startup: List[str] = ["bash startatd.sh"]
validate: List[str] = ["pidof atd"] validate: List[str] = ["pidof atd"]
shutdown: List[str] = ["pkill atd"] shutdown: List[str] = ["pkill atd"]
validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING

View file

@ -1,5 +1,6 @@
from typing import List from typing import List
BASH: str = "bash"
VNODED: str = "vnoded" VNODED: str = "vnoded"
VCMD: str = "vcmd" VCMD: str = "vcmd"
SYSCTL: str = "sysctl" SYSCTL: str = "sysctl"
@ -11,7 +12,16 @@ MOUNT: str = "mount"
UMOUNT: str = "umount" UMOUNT: str = "umount"
OVS_VSCTL: str = "ovs-vsctl" 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] VCMD_REQUIREMENTS: List[str] = [VNODED, VCMD]
OVS_REQUIREMENTS: List[str] = [OVS_VSCTL] OVS_REQUIREMENTS: List[str] = [OVS_VSCTL]

View file

@ -22,6 +22,7 @@ from core.emulator.enumerations import (
RegisterTlvs, RegisterTlvs,
) )
from core.errors import CoreError from core.errors import CoreError
from core.executables import BASH
from core.nodes.base import CoreNode from core.nodes.base import CoreNode
from core.nodes.interface import CoreInterface from core.nodes.interface import CoreInterface
from core.nodes.network import WlanNode from core.nodes.network import WlanNode
@ -1167,7 +1168,7 @@ class Ns2ScriptedMobility(WayPointMobility):
if filename is None or filename == "": if filename is None or filename == "":
return return
filename = self.findfile(filename) filename = self.findfile(filename)
args = f"/bin/sh {filename} {typestr}" args = f"{BASH} {filename} {typestr}"
utils.cmd( utils.cmd(
args, cwd=self.session.session_dir, env=self.session.get_environment() args, cwd=self.session.session_dir, env=self.session.get_environment()
) )

View file

@ -599,7 +599,7 @@ class CoreNode(CoreNodeBase):
if self.server is None: if self.server is None:
return self.client.check_cmd(args, wait=wait, shell=shell) return self.client.check_cmd(args, wait=wait, shell=shell)
else: else:
args = self.client.create_cmd(args) args = self.client.create_cmd(args, shell)
return self.server.remote_cmd(args, wait=wait) return self.server.remote_cmd(args, wait=wait)
def termcmdstring(self, sh: str = "/bin/sh") -> str: def termcmdstring(self, sh: str = "/bin/sh") -> str:

View file

@ -5,7 +5,7 @@ The control channel can be accessed via calls using the vcmd shell.
""" """
from core import utils from core import utils
from core.executables import VCMD from core.executables import BASH, VCMD
class VnodeClient: class VnodeClient:
@ -49,7 +49,9 @@ class VnodeClient:
""" """
pass 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}" return f"{VCMD} -c {self.ctrlchnlname} -- {args}"
def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: 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 :raises core.CoreCommandError: when there is a non-zero exit status
""" """
self._verify_connection() self._verify_connection()
args = self.create_cmd(args) args = self.create_cmd(args, shell)
return utils.cmd(args, wait=wait, shell=shell) return utils.cmd(args, wait=wait, shell=shell)

View file

@ -383,12 +383,12 @@ class Veth(CoreInterface):
try: try:
self.node.node_net_client.device_flush(self.name) self.node.node_net_client.device_flush(self.name)
except CoreCommandError: except CoreCommandError:
logging.exception("error shutting down interface") pass
if self.localname: if self.localname:
try: try:
self.net_client.delete_device(self.localname) self.net_client.delete_device(self.localname)
except CoreCommandError: except CoreCommandError:
logging.info("link already removed: %s", self.localname) pass
self.up = False self.up = False

View file

@ -121,11 +121,7 @@ class LinuxNetClient:
:param device: device to flush :param device: device to flush
:return: nothing :return: nothing
""" """
self.run( self.run(f"{IP} address flush dev {device}")
f"[ -e /sys/class/net/{device} ] && "
f"{IP} address flush dev {device} || true",
shell=True,
)
def device_mac(self, device: str, mac: str) -> None: def device_mac(self, device: str, mac: str) -> None:
""" """

View file

@ -13,7 +13,7 @@ class EmaneTransportService(CoreService):
dependencies: Tuple[str, ...] = () dependencies: Tuple[str, ...] = ()
dirs: Tuple[str, ...] = () dirs: Tuple[str, ...] = ()
configs: Tuple[str, ...] = ("emanetransport.sh",) 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]}",) validate: Tuple[str, ...] = (f"pidof {executables[0]}",)
validation_timer: float = 0.5 validation_timer: float = 0.5
shutdown: Tuple[str, ...] = (f"killall {executables[0]}",) shutdown: Tuple[str, ...] = (f"killall {executables[0]}",)

View file

@ -26,7 +26,7 @@ class FRRZebra(CoreService):
"/usr/local/etc/frr/vtysh.conf", "/usr/local/etc/frr/vtysh.conf",
"/usr/local/etc/frr/daemons", "/usr/local/etc/frr/daemons",
) )
startup: Tuple[str, ...] = ("sh frrboot.sh zebra",) startup: Tuple[str, ...] = ("bash frrboot.sh zebra",)
shutdown: Tuple[str, ...] = ("killall zebra",) shutdown: Tuple[str, ...] = ("killall zebra",)
validate: Tuple[str, ...] = ("pidof zebra",) validate: Tuple[str, ...] = ("pidof zebra",)

View file

@ -97,7 +97,7 @@ class NrlSmf(NrlService):
name: str = "SMF" name: str = "SMF"
executables: Tuple[str, ...] = ("nrlsmf",) executables: Tuple[str, ...] = ("nrlsmf",)
startup: Tuple[str, ...] = ("sh startsmf.sh",) startup: Tuple[str, ...] = ("bash startsmf.sh",)
shutdown: Tuple[str, ...] = ("killall nrlsmf",) shutdown: Tuple[str, ...] = ("killall nrlsmf",)
validate: Tuple[str, ...] = ("pidof nrlsmf",) validate: Tuple[str, ...] = ("pidof nrlsmf",)
configs: Tuple[str, ...] = ("startsmf.sh",) configs: Tuple[str, ...] = ("startsmf.sh",)
@ -566,7 +566,7 @@ class MgenActor(NrlService):
group: str = "ProtoSvc" group: str = "ProtoSvc"
executables: Tuple[str, ...] = ("mgen",) executables: Tuple[str, ...] = ("mgen",)
configs: Tuple[str, ...] = ("start_mgen_actor.sh",) 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",) validate: Tuple[str, ...] = ("pidof mgen",)
shutdown: Tuple[str, ...] = ("killall mgen",) shutdown: Tuple[str, ...] = ("killall mgen",)
@ -596,7 +596,7 @@ class Arouted(NrlService):
name: str = "arouted" name: str = "arouted"
executables: Tuple[str, ...] = ("arouted",) executables: Tuple[str, ...] = ("arouted",)
configs: Tuple[str, ...] = ("startarouted.sh",) configs: Tuple[str, ...] = ("startarouted.sh",)
startup: Tuple[str, ...] = ("sh startarouted.sh",) startup: Tuple[str, ...] = ("bash startarouted.sh",)
shutdown: Tuple[str, ...] = ("pkill arouted",) shutdown: Tuple[str, ...] = ("pkill arouted",)
validate: Tuple[str, ...] = ("pidof arouted",) validate: Tuple[str, ...] = ("pidof arouted",)

View file

@ -25,7 +25,7 @@ class Zebra(CoreService):
"quaggaboot.sh", "quaggaboot.sh",
"/usr/local/etc/quagga/vtysh.conf", "/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",) shutdown: Tuple[str, ...] = ("killall zebra",)
validate: Tuple[str, ...] = ("pidof zebra",) validate: Tuple[str, ...] = ("pidof zebra",)

View file

@ -31,7 +31,7 @@ class OvsService(SdnService):
"/var/log/openvswitch", "/var/log/openvswitch",
) )
configs: Tuple[str, ...] = ("OvsService.sh",) 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") shutdown: Tuple[str, ...] = ("killall ovs-vswitchd", "killall ovsdb-server")
@classmethod @classmethod
@ -119,7 +119,7 @@ class RyuService(SdnService):
group: str = "SDN" group: str = "SDN"
executables: Tuple[str, ...] = ("ryu-manager",) executables: Tuple[str, ...] = ("ryu-manager",)
configs: Tuple[str, ...] = ("ryuService.sh",) configs: Tuple[str, ...] = ("ryuService.sh",)
startup: Tuple[str, ...] = ("sh ryuService.sh",) startup: Tuple[str, ...] = ("bash ryuService.sh",)
shutdown: Tuple[str, ...] = ("killall ryu-manager",) shutdown: Tuple[str, ...] = ("killall ryu-manager",)
@classmethod @classmethod

View file

@ -16,7 +16,7 @@ class VPNClient(CoreService):
name: str = "VPNClient" name: str = "VPNClient"
group: str = "Security" group: str = "Security"
configs: Tuple[str, ...] = ("vpnclient.sh",) configs: Tuple[str, ...] = ("vpnclient.sh",)
startup: Tuple[str, ...] = ("sh vpnclient.sh",) startup: Tuple[str, ...] = ("bash vpnclient.sh",)
shutdown: Tuple[str, ...] = ("killall openvpn",) shutdown: Tuple[str, ...] = ("killall openvpn",)
validate: Tuple[str, ...] = ("pidof openvpn",) validate: Tuple[str, ...] = ("pidof openvpn",)
custom_needed: bool = True custom_needed: bool = True
@ -43,7 +43,7 @@ class VPNServer(CoreService):
name: str = "VPNServer" name: str = "VPNServer"
group: str = "Security" group: str = "Security"
configs: Tuple[str, ...] = ("vpnserver.sh",) configs: Tuple[str, ...] = ("vpnserver.sh",)
startup: Tuple[str, ...] = ("sh vpnserver.sh",) startup: Tuple[str, ...] = ("bash vpnserver.sh",)
shutdown: Tuple[str, ...] = ("killall openvpn",) shutdown: Tuple[str, ...] = ("killall openvpn",)
validate: Tuple[str, ...] = ("pidof openvpn",) validate: Tuple[str, ...] = ("pidof openvpn",)
custom_needed: bool = True custom_needed: bool = True
@ -71,7 +71,7 @@ class IPsec(CoreService):
name: str = "IPsec" name: str = "IPsec"
group: str = "Security" group: str = "Security"
configs: Tuple[str, ...] = ("ipsec.sh",) configs: Tuple[str, ...] = ("ipsec.sh",)
startup: Tuple[str, ...] = ("sh ipsec.sh",) startup: Tuple[str, ...] = ("bash ipsec.sh",)
shutdown: Tuple[str, ...] = ("killall racoon",) shutdown: Tuple[str, ...] = ("killall racoon",)
custom_needed: bool = True custom_needed: bool = True
@ -97,7 +97,7 @@ class Firewall(CoreService):
name: str = "Firewall" name: str = "Firewall"
group: str = "Security" group: str = "Security"
configs: Tuple[str, ...] = ("firewall.sh",) configs: Tuple[str, ...] = ("firewall.sh",)
startup: Tuple[str, ...] = ("sh firewall.sh",) startup: Tuple[str, ...] = ("bash firewall.sh",)
custom_needed: bool = True custom_needed: bool = True
@classmethod @classmethod
@ -127,7 +127,7 @@ class Nat(CoreService):
group: str = "Security" group: str = "Security"
executables: Tuple[str, ...] = ("iptables",) executables: Tuple[str, ...] = ("iptables",)
configs: Tuple[str, ...] = ("nat.sh",) configs: Tuple[str, ...] = ("nat.sh",)
startup: Tuple[str, ...] = ("sh nat.sh",) startup: Tuple[str, ...] = ("bash nat.sh",)
custom_needed: bool = False custom_needed: bool = False
@classmethod @classmethod

View file

@ -19,7 +19,7 @@ class Ucarp(CoreService):
UCARP_ETC + "/default-down.sh", UCARP_ETC + "/default-down.sh",
"ucarpboot.sh", "ucarpboot.sh",
) )
startup: Tuple[str, ...] = ("sh ucarpboot.sh",) startup: Tuple[str, ...] = ("bash ucarpboot.sh",)
shutdown: Tuple[str, ...] = ("killall ucarp",) shutdown: Tuple[str, ...] = ("killall ucarp",)
validate: Tuple[str, ...] = ("pidof ucarp",) validate: Tuple[str, ...] = ("pidof ucarp",)

View file

@ -28,7 +28,7 @@ class UtilService(CoreService):
class IPForwardService(UtilService): class IPForwardService(UtilService):
name: str = "IPForward" name: str = "IPForward"
configs: Tuple[str, ...] = ("ipforward.sh",) configs: Tuple[str, ...] = ("ipforward.sh",)
startup: Tuple[str, ...] = ("sh ipforward.sh",) startup: Tuple[str, ...] = ("bash ipforward.sh",)
@classmethod @classmethod
def generate_config(cls, node: CoreNode, filename: str) -> str: def generate_config(cls, node: CoreNode, filename: str) -> str:
@ -61,7 +61,7 @@ class IPForwardService(UtilService):
class DefaultRouteService(UtilService): class DefaultRouteService(UtilService):
name: str = "DefaultRoute" name: str = "DefaultRoute"
configs: Tuple[str, ...] = ("defaultroute.sh",) configs: Tuple[str, ...] = ("defaultroute.sh",)
startup: Tuple[str, ...] = ("sh defaultroute.sh",) startup: Tuple[str, ...] = ("bash defaultroute.sh",)
@classmethod @classmethod
def generate_config(cls, node: CoreNode, filename: str) -> str: def generate_config(cls, node: CoreNode, filename: str) -> str:
@ -84,7 +84,7 @@ class DefaultRouteService(UtilService):
class DefaultMulticastRouteService(UtilService): class DefaultMulticastRouteService(UtilService):
name: str = "DefaultMulticastRoute" name: str = "DefaultMulticastRoute"
configs: Tuple[str, ...] = ("defaultmroute.sh",) configs: Tuple[str, ...] = ("defaultmroute.sh",)
startup: Tuple[str, ...] = ("sh defaultmroute.sh",) startup: Tuple[str, ...] = ("bash defaultmroute.sh",)
@classmethod @classmethod
def generate_config(cls, node: CoreNode, filename: str) -> str: def generate_config(cls, node: CoreNode, filename: str) -> str:
@ -103,7 +103,7 @@ class DefaultMulticastRouteService(UtilService):
class StaticRouteService(UtilService): class StaticRouteService(UtilService):
name: str = "StaticRoute" name: str = "StaticRoute"
configs: Tuple[str, ...] = ("staticroute.sh",) configs: Tuple[str, ...] = ("staticroute.sh",)
startup: Tuple[str, ...] = ("sh staticroute.sh",) startup: Tuple[str, ...] = ("bash staticroute.sh",)
custom_needed: bool = True custom_needed: bool = True
@classmethod @classmethod
@ -135,7 +135,7 @@ class SshService(UtilService):
name: str = "SSH" name: str = "SSH"
configs: Tuple[str, ...] = ("startsshd.sh", "/etc/ssh/sshd_config") configs: Tuple[str, ...] = ("startsshd.sh", "/etc/ssh/sshd_config")
dirs: Tuple[str, ...] = ("/etc/ssh", "/var/run/sshd") 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",) shutdown: Tuple[str, ...] = ("killall sshd",)
validation_mode: ServiceMode = ServiceMode.BLOCKING validation_mode: ServiceMode = ServiceMode.BLOCKING
@ -278,7 +278,7 @@ class DhcpClientService(UtilService):
name: str = "DHCPClient" name: str = "DHCPClient"
configs: Tuple[str, ...] = ("startdhcpclient.sh",) configs: Tuple[str, ...] = ("startdhcpclient.sh",)
startup: Tuple[str, ...] = ("sh startdhcpclient.sh",) startup: Tuple[str, ...] = ("bash startdhcpclient.sh",)
shutdown: Tuple[str, ...] = ("killall dhclient",) shutdown: Tuple[str, ...] = ("killall dhclient",)
validate: Tuple[str, ...] = ("pidof dhclient",) validate: Tuple[str, ...] = ("pidof dhclient",)
@ -561,8 +561,8 @@ class PcapService(UtilService):
name: str = "pcap" name: str = "pcap"
configs: Tuple[str, ...] = ("pcap.sh",) configs: Tuple[str, ...] = ("pcap.sh",)
startup: Tuple[str, ...] = ("sh pcap.sh start",) startup: Tuple[str, ...] = ("bash pcap.sh start",)
shutdown: Tuple[str, ...] = ("sh pcap.sh stop",) shutdown: Tuple[str, ...] = ("bash pcap.sh stop",)
validate: Tuple[str, ...] = ("pidof tcpdump",) validate: Tuple[str, ...] = ("pidof tcpdump",)
meta: str = "logs network traffic to pcap packet capture files" meta: str = "logs network traffic to pcap packet capture files"
@ -671,7 +671,7 @@ class AtdService(UtilService):
name: str = "atd" name: str = "atd"
configs: Tuple[str, ...] = ("startatd.sh",) configs: Tuple[str, ...] = ("startatd.sh",)
dirs: Tuple[str, ...] = ("/var/spool/cron/atjobs", "/var/spool/cron/atspool") 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",) shutdown: Tuple[str, ...] = ("pkill atd",)
@classmethod @classmethod

View file

@ -120,14 +120,14 @@ def install_system(c: Context, os_info: OsInfo, hide: bool) -> None:
if os_info.like == OsLike.DEBIAN: if os_info.like == OsLike.DEBIAN:
c.run( c.run(
"sudo apt install -y automake pkg-config gcc libev-dev ebtables " "sudo apt install -y automake pkg-config gcc libev-dev ebtables "
"iproute2 ethtool tk python3-tk", "iproute2 ethtool tk python3-tk bash",
hide=hide hide=hide
) )
elif os_info.like == OsLike.REDHAT: elif os_info.like == OsLike.REDHAT:
c.run( c.run(
"sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ " "sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ "
"libev-devel iptables-ebtables iproute python3-devel python3-tkinter " "libev-devel iptables-ebtables iproute python3-devel python3-tkinter "
"tk ethtool make", "tk ethtool make bash",
hide=hide hide=hide
) )
# centos 8+ does not support netem by default # centos 8+ does not support netem by default