From 0d2dd70727ab6c8ab5b0055539d9587c146dce21 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:13:37 -0700 Subject: [PATCH 1/4] 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 --- .../configservices/frrservices/services.py | 2 +- .../configservices/nrlservices/services.py | 16 ++++++++-------- .../configservices/quaggaservices/services.py | 2 +- .../securityservices/services.py | 10 +++++----- .../configservices/utilservices/services.py | 18 +++++++++--------- daemon/core/executables.py | 12 +++++++++++- daemon/core/location/mobility.py | 3 ++- daemon/core/nodes/base.py | 2 +- daemon/core/nodes/client.py | 8 +++++--- daemon/core/nodes/interface.py | 4 ++-- daemon/core/nodes/netclient.py | 6 +----- daemon/core/services/emaneservices.py | 2 +- daemon/core/services/frr.py | 2 +- daemon/core/services/nrl.py | 6 +++--- daemon/core/services/quagga.py | 2 +- daemon/core/services/sdn.py | 4 ++-- daemon/core/services/security.py | 10 +++++----- daemon/core/services/ucarp.py | 2 +- daemon/core/services/utility.py | 18 +++++++++--------- tasks.py | 4 ++-- 20 files changed, 71 insertions(+), 62 deletions(-) diff --git a/daemon/core/configservices/frrservices/services.py b/daemon/core/configservices/frrservices/services.py index 720500778..fa6f599a3 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 cf9b4c883..3f911aefb 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 194306640..bf23e00c0 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 4a58fd8c3..c656f5ca5 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 b6bc0eb52..9b3369dbe 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 6eb0214a1..7b7f80b71 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 @@ 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 e982c5c1c..0e9b2e329 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -22,6 +22,7 @@ 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 @@ def statescript(self, typestr: str) -> None: 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 cea1e81bd..4cf6ea8d1 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -599,7 +599,7 @@ def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: 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 93e099cf8..710724b1c 100644 --- a/daemon/core/nodes/client.py +++ b/daemon/core/nodes/client.py @@ -5,7 +5,7 @@ """ from core import utils -from core.executables import VCMD +from core.executables import BASH, VCMD class VnodeClient: @@ -49,7 +49,9 @@ def close(self) -> None: """ 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 @@ def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: :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 7f33973e3..20dc8fd31 100644 --- a/daemon/core/nodes/interface.py +++ b/daemon/core/nodes/interface.py @@ -383,12 +383,12 @@ def shutdown(self) -> None: 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 96a1f4beb..68fbef985 100644 --- a/daemon/core/nodes/netclient.py +++ b/daemon/core/nodes/netclient.py @@ -121,11 +121,7 @@ def device_flush(self, device: str) -> None: :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 d694317a2..4fd78ec1f 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 b130fd8c5..cec9d860f 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 697f4eeef..91e053b26 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 9e2c7cc00..8c474fd83 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 ef077662a..e72b51387 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 b813579e7..788988c96 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 8ac92dd34..522eeaf6c 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 774c41045..a30d1f621 100644 --- a/daemon/core/services/utility.py +++ b/daemon/core/services/utility.py @@ -28,7 +28,7 @@ def generate_config(cls, node: CoreNode, filename: str) -> str: 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 @@ def generateconfiglinux(cls, node: CoreNode, filename: str) -> str: 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 @@ def generate_config(cls, node: CoreNode, filename: str) -> str: 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 @@ def generate_config(cls, node: CoreNode, filename: str) -> str: 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 5f52f4440..c3e6d2bb0 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 From 9e3e0e0326345b8efb07622f5f383728153ce7bd Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:34:05 -0700 Subject: [PATCH 2/4] install: fixed issue identifying python versions to install dataclasses for, using ~ should account for any version up to 3.7 properly --- daemon/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/pyproject.toml b/daemon/pyproject.toml index b75f1ee3b..7ce3a1250 100644 --- a/daemon/pyproject.toml +++ b/daemon/pyproject.toml @@ -10,7 +10,7 @@ include = ["core/gui/data/**/*", "core/configservices/*/templates"] [tool.poetry.dependencies] python = "^3.6" -dataclasses = { version = "*", python = "3.6" } +dataclasses = { version = "*", python = "~3.6" } fabric = "*" grpcio = "1.27.2" invoke = "*" From 511a3037a8d0cc09b36e7d07849dbe08ea53fd18 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:35:46 -0700 Subject: [PATCH 3/4] bumped versions for release --- configure.ac | 2 +- daemon/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 60f6709ec..6ed18b69b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. # this defines the CORE version number, must be static for AC_INIT -AC_INIT(core, 7.0.0) +AC_INIT(core, 7.0.1) # autoconf and automake initialization AC_CONFIG_SRCDIR([netns/version.h.in]) diff --git a/daemon/pyproject.toml b/daemon/pyproject.toml index 7ce3a1250..dec01670e 100644 --- a/daemon/pyproject.toml +++ b/daemon/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "core" -version = "7.0.0" +version = "7.0.1" description = "CORE Common Open Research Emulator" authors = ["Boeing Research and Technology"] license = "BSD-2-Clause" From afe434f25cbf2e01a89fb75f4c914c514675a55e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:39:16 -0700 Subject: [PATCH 4/4] updated changelog for bugfix release 7.0.1 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 375a76079..21eb0a575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2020-07-28 CORE 7.0.1 + +* Bugfixes + * \#500 - fixed issue running node commands with shell=True + * fixed issue for poetry based install not properly vetting requirements for dataclasses dependency + ## 2020-07-23 CORE 7.0.0 * Breaking Changes