Esempio n. 1
0
class EIPManager(object):
    def __init__(self, remotes, cert, key, ca, flags):
        """
        """
        self._firewall = FirewallManager(remotes)
        self._vpn = VPNManager(remotes, cert, key, ca, flags)

    def start(self):
        """TODO: Docstring for start.
        :returns: TODO

        """
        print(Fore.BLUE + "Firewall: starting..." + Fore.RESET)
        fw_ok = self._firewall.start()
        if not fw_ok:
            return False

        print(Fore.GREEN + "Firewall: started" + Fore.RESET)

        vpn_ok = self._vpn.start()
        if not vpn_ok:
            print (Fore.RED + "VPN: Error starting." + Fore.RESET)
            self._firewall.stop()
            print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: started" + Fore.RESET)

    def stop(self):
        """TODO: Docstring for stop.

        :returns: TODO
        """
        print(Fore.BLUE + "Firewall: stopping..." + Fore.RESET)
        fw_ok = self._firewall.stop()

        if not fw_ok:
            print (Fore.RED + "Firewall: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
        print(Fore.BLUE + "VPN: stopping..." + Fore.RESET)

        vpn_ok = self._vpn.stop()
        if not vpn_ok:
            print (Fore.RED + "VPN: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: stopped." + Fore.RESET)
        return True
Esempio n. 2
0
class EIPManager(object):
    def __init__(self, remotes, cert, key, ca, flags):
        """
        """
        self._firewall = FirewallManager(remotes)
        self._vpn = VPNManager(remotes, cert, key, ca, flags)

    def start(self):
        """TODO: Docstring for start.
        :returns: TODO

        """
        print(Fore.BLUE + "Firewall: starting..." + Fore.RESET)
        fw_ok = self._firewall.start()
        if not fw_ok:
            return False

        print(Fore.GREEN + "Firewall: started" + Fore.RESET)

        vpn_ok = self._vpn.start()
        if not vpn_ok:
            print(Fore.RED + "VPN: Error starting." + Fore.RESET)
            self._firewall.stop()
            print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: started" + Fore.RESET)

    def stop(self):
        """TODO: Docstring for stop.

        :returns: TODO
        """
        print(Fore.BLUE + "Firewall: stopping..." + Fore.RESET)
        fw_ok = self._firewall.stop()

        if not fw_ok:
            print(Fore.RED + "Firewall: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
        print(Fore.BLUE + "VPN: stopping..." + Fore.RESET)

        vpn_ok = self._vpn.stop()
        if not vpn_ok:
            print(Fore.RED + "VPN: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: stopped." + Fore.RESET)
        return True
Esempio n. 3
0
File: eip.py Progetto: azul/leap_vpn
 def __init__(self, remotes, cert, key, ca, flags):
     """
     """
     self._firewall = FirewallManager(remotes)
     self._status_queue = StatusQueue()
     self._pub = ZMQPublisher(self._status_queue)
     self._vpn = VPNManager(remotes, cert, key, ca, flags,
                            self._status_queue)
Esempio n. 4
0
 def __init__(self, remotes, cert, key, ca, flags):
     """
     """
     self._firewall = FirewallManager(remotes)
     self._vpn = VPNManager(remotes, cert, key, ca, flags)
Esempio n. 5
0
 def __init__(self, remotes, cert, key, ca, flags):
     """
     """
     self._firewall = FirewallManager(remotes)
     self._vpn = VPNManager(remotes, cert, key, ca, flags)
Esempio n. 6
0
File: eip.py Progetto: azul/leap_vpn
class EIPManager(object):
    def __init__(self, remotes, cert, key, ca, flags):
        """
        """
        self._firewall = FirewallManager(remotes)
        self._status_queue = StatusQueue()
        self._pub = ZMQPublisher(self._status_queue)
        self._vpn = VPNManager(remotes, cert, key, ca, flags,
                               self._status_queue)

    def start(self):
        """
        Start EIP service (firewall and vpn)

        This may raise exceptions, see errors.py
        """
        self._pub.start()
        print(Fore.BLUE + "Firewall: starting..." + Fore.RESET)
        fw_ok = self._firewall.start()
        if not fw_ok:
            return False

        print(Fore.GREEN + "Firewall: started" + Fore.RESET)

        vpn_ok = self._vpn.start()
        if not vpn_ok:
            print (Fore.RED + "VPN: Error starting." + Fore.RESET)
            self._firewall.stop()
            print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: started" + Fore.RESET)

    def stop(self):
        """
        Stop EIP service
        """
        self._pub.stop()
        print(Fore.BLUE + "Firewall: stopping..." + Fore.RESET)
        fw_ok = self._firewall.stop()

        if not fw_ok:
            print (Fore.RED + "Firewall: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "Firewall: stopped." + Fore.RESET)
        print(Fore.BLUE + "VPN: stopping..." + Fore.RESET)

        vpn_ok = self._vpn.stop()
        if not vpn_ok:
            print (Fore.RED + "VPN: Error stopping." + Fore.RESET)
            return False

        print(Fore.GREEN + "VPN: stopped." + Fore.RESET)
        return True

    def get_state(self):
        pass

    def get_status(self):
        pass