예제 #1
0
    def netconf(self):
        """ Prints the network configuration as saved in the config file """
        logging.debugv("menu/status.py->netconf(self)", [])
        infs = f.ifListAll()
        report = t.formatTitle("Main network configuration")

        try:
            self.c.validNetConf()
        except excepts.ConfigException, e:
            e = str(e)
            e = e.strip('"')
            report += t.formatLog("Valid network config", False, 1)
            report += "    %s\n" % str(e)
예제 #2
0
    def netconf(self):
        """ Prints the network configuration as saved in the config file """
        logging.debugv("menu/status.py->netconf(self)", [])
        infs = f.ifListAll()
        report = t.formatTitle("Main network configuration")

        try:
            self.c.validNetConf()
        except excepts.ConfigException, e:
            e = str(e)
            e = e.strip('"')
            report += t.formatLog("Valid network config", False, 1)
            report += "    %s\n" % str(e)
예제 #3
0
    def interfaces(self):
        """ Prints information about the actual network interfaces """
        logging.debugv("menu/status.py->interfaces(self)", [])

        infList = f.ifListAll()

        report = t.formatTitle("Network interfaces")
        for (inf) in infList:
            status = f.infStatus(inf)
            if status == 0:
                statustxt = "Non-existant"
            elif status == 1:
                statustxt = "Down"
            elif status == 2:
                statustxt = "Up"
            elif status == 3:
                statustxt = "Up, configured"
            report += t.formatLog("Interface", inf)
            report += t.formatLog("  Status", statustxt)
            if status != 0:
                try:
                    mac = f.getMac(inf)
                except excepts.InterfaceException:
                    mac = "false"
                report += t.formatLog("    MAC", mac)
            if status == 3:
                ip = f.getIp(inf)
                nm = f.getNm(inf)
                bc = t.broadcast(ip, nm)
                gw = f.getGw(inf)
                if ip: report += t.formatLog("    Address", ip)
                if nm: report += t.formatLog("    Netmask", nm)
                if bc: report += t.formatLog("    Broadcast", bc)
                if gw: report += t.formatLog("    Gateway", gw)
            if status != 0:
                active_flags = f.getIfFlags(inf)
                report += t.formatLog("    Flags", active_flags)
            report += "\n"

        return self.d.msgbox(report,
                             width=100,
                             height=40,
                             no_collapse=1,
                             colors=1)
예제 #4
0
    def interfaces(self):
        """ Prints information about the actual network interfaces """
        logging.debugv("menu/status.py->interfaces(self)", [])

        infList = f.ifListAll()

        report = t.formatTitle("Network interfaces")
        for (inf) in infList:
            status = f.infStatus(inf)
            if status == 0:
                statustxt = "Non-existant"
            elif status == 1:
                statustxt = "Down"
            elif status == 2:
                statustxt = "Up"
            elif status == 3:
                statustxt = "Up, configured"
            report += t.formatLog("Interface", inf)
            report += t.formatLog("  Status", statustxt)
            if status != 0:
                try:
                    mac = f.getMac(inf)
                except excepts.InterfaceException:
                    mac = "false"
                report += t.formatLog("    MAC", mac)
            if status == 3:
                ip = f.getIp(inf)
                nm = f.getNm(inf)
                bc = t.broadcast(ip, nm)
                gw = f.getGw(inf)
                if ip: report += t.formatLog("    Address", ip)
                if nm: report += t.formatLog("    Netmask", nm)
                if bc: report += t.formatLog("    Broadcast", bc)
                if gw: report += t.formatLog("    Gateway", gw)
            if status != 0:
                active_flags = f.getIfFlags(inf)
                report += t.formatLog("    Flags", active_flags)
            report += "\n"

        return self.d.msgbox(report, width=100, height=40, no_collapse=1, colors=1)
예제 #5
0
    def ipmi(self):
        """ Status overview of the configured IPMI interface """
        info = f.ipmiLanStatus()
        report = t.formatTitle("IPMI interface info")

        report += t.formatLog("IP address", info["IP Address"])
        report += t.formatLog("Subnet Mask", info["Subnet Mask"])
        report += t.formatLog("MAC address", info["MAC Address"])
        report += "\n"
        report += t.formatLog("Gateway IP address", info["Default Gateway IP"])
        report += t.formatLog("Gateway MAC address", info["Default Gateway MAC"])
        if self.c.getIpmiVlanID():
            report += "\n"
            report += t.formatLog("VLAN ID", self.c.ipmi["vlanid"])

        return self.d.msgbox(report, width=70, height=25, no_collapse=1, colors=1)
예제 #6
0
    def ipmi(self):
        """ Status overview of the configured IPMI interface """
        info = f.ipmiLanStatus()
        report = t.formatTitle("IPMI interface info")

        report += t.formatLog("IP address", info["IP Address"])
        report += t.formatLog("Subnet Mask", info["Subnet Mask"])
        report += t.formatLog("MAC address", info["MAC Address"])
        report += "\n"
        report += t.formatLog("Gateway IP address", info["Default Gateway IP"])
        report += t.formatLog("Gateway MAC address",
                              info["Default Gateway MAC"])
        if self.c.getIpmiVlanID():
            report += "\n"
            report += t.formatLog("VLAN ID", self.c.ipmi["vlanid"])

        return self.d.msgbox(report,
                             width=70,
                             height=25,
                             no_collapse=1,
                             colors=1)
예제 #7
0
    def sensor(self):
        """ Prints information about the sensor status """
        logging.debugv("menu/status.py->sensor(self)", [])
        sid = self.c.getSensorID()
        mainInf = self.c.getMainIf()
        status = f.tunnelStatus()
        if status:
            status = True
        else:
            status = False
        networkStatus = f.networkStatus(mainInf)
        pversion = f.getPackageVersion()

        # Subtitle
        report = t.formatTitle("General sensor info")

        # Package version
        report += t.formatLog("Package version", str(pversion))

        # Sensor name
        report += t.formatLog("Sensor", sid)

        # Sensor status
        report += t.formatLog("Status", status, 1)

        # Network status
        report += t.formatLog("Network", networkStatus, 1)

        report += "\n"

        # Subtitle
        report += t.formatTitle("Sanity checks")

        if networkStatus:
            # OpenVPN port check
            ovnport = f.scanPort(self.c.getServer(), 1194)
            report += t.formatLog("OpenVPN port", ovnport, 1)

            # Updates port check
            upport = f.scanPort(self.c.getServer(), 4443)
            report += t.formatLog("Updates port", upport, 1)
        else:
            report += t.formatLog("OpenVPN port", "Unchecked")
            report += t.formatLog("Updates port", "Unchecked")

        # Check crt existance
        report += t.formatLog("Sensor certificate", f.verifyCrt(), 1)
        # Check key existance
        report += t.formatLog("Sensor key", f.verifyKey(), 1)

        report += "\n"

        # Subtitle
        report += t.formatTitle("Program checks")

        # Check SSH status
        report += t.formatLog("SSH daemon running", f.sshStatus(), 1)

        if status:
            # Checking OpenVPN daemon
            report += t.formatLog("OpenVPN daemon running", f.openvpnStatus(),
                                  1)

        return self.d.msgbox(report,
                             width=70,
                             height=25,
                             no_collapse=1,
                             colors=1)
예제 #8
0
    def netconf(self):
        """ Prints the network configuration as saved in the config file """
        logging.debugv("menu/status.py->netconf(self)", [])
        infs = f.ifListAll()
        report = t.formatTitle("Main network configuration")

        try:
            self.c.validNetConf()
        except excepts.ConfigException, e:
            e = str(e)
            e = e.strip('"')
            report += t.formatLog("Valid network config", False, 1)
            report += "    %s\n" % str(e)
        else:
            report += t.formatLog("Valid network config", True, 1)

        report += "\n"
        sensorType = self.c.getSensorType()
        if sensorType == "":
            report += t.formatLog("Sensor type", "Not configured")
        else:
            report += t.formatLog("Sensor type", sensorType)
        report += "\n"

        # Only use the first interface that is configured
        try:
            manInf = self.c.getMainIf()
            if manInf == "":
                manInf = "Not configured"
                manInfConf = "Not configured"
예제 #9
0
    def sensor(self):
        """ Prints information about the sensor status """
        logging.debugv("menu/status.py->sensor(self)", [])
        sid = self.c.getSensorID()
        mainInf = self.c.getMainIf()
        status = f.tunnelStatus()
        if status:
            status = True
        else:
            status = False
        networkStatus = f.networkStatus(mainInf)
        pversion = f.getPackageVersion()

        # Subtitle
        report = t.formatTitle("General sensor info")

        # Package version
        report += t.formatLog("Package version", str(pversion))

        # Sensor name
        report += t.formatLog("Sensor", sid)

        # Sensor status
        report += t.formatLog("Status", status, 1)

        # Network status
        report += t.formatLog("Network", networkStatus, 1)

        report += "\n"

        # Subtitle
        report += t.formatTitle("Sanity checks")

        if networkStatus:
            # OpenVPN port check
            ovnport = f.scanPort(self.c.getServer(), 1194)
            report += t.formatLog("OpenVPN port", ovnport, 1)

            # Updates port check
            upport = f.scanPort(self.c.getServer(), 4443)
            report += t.formatLog("Updates port", upport, 1)
        else:
            report += t.formatLog("OpenVPN port", "Unchecked")
            report += t.formatLog("Updates port", "Unchecked")

        # Check crt existance
        report += t.formatLog("Sensor certificate", f.verifyCrt(), 1)
        # Check key existance
        report += t.formatLog("Sensor key", f.verifyKey(), 1)

        report += "\n"

        # Subtitle
        report += t.formatTitle("Program checks")

        # Check SSH status
        report += t.formatLog("SSH daemon running", f.sshStatus(), 1)

        if status:
            # Checking OpenVPN daemon
            report += t.formatLog("OpenVPN daemon running", f.openvpnStatus(), 1)

        return self.d.msgbox(report, width=70, height=25, no_collapse=1, colors=1)
예제 #10
0
        
    def netconf(self):
        """ Prints the network configuration as saved in the config file """
        logging.debugv("menu/status.py->netconf(self)", [])
        infs = f.ifListAll()
        report = t.formatTitle("Main network configuration")

        try:
            self.c.validNetConf()
        except excepts.ConfigException, e:
            e = str(e)
            e = e.strip('"')
            report += t.formatLog("Valid network config", False, 1)
            report += "    %s\n" % str(e)
        else:
            report += t.formatLog("Valid network config", True, 1)

        report += "\n"
        sensorType = self.c.getSensorType()
        if sensorType == "":
            report += t.formatLog("Sensor type", "Not configured")
        else:
            report += t.formatLog("Sensor type", sensorType)
        report += "\n"

        # Only use the first interface that is configured
        try:
            manInf = self.c.getMainIf()
            if manInf == "":
                manInf = "Not configured"
                manInfConf = "Not configured"