From d1d724092d9eab606114dbf2aab8a9a0ad0e0e09 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 21 Nov 2013 10:16:12 -0300 Subject: Disable eip-config for uninitialized providers. - Show the user which provider has not been initialized and disable its usage. - Add support for absolute path in get_eipconfig_path. - Replace hadr-coded paths with get_eipconfig_path. --- src/leap/bitmask/services/eip/eipconfig.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/leap/bitmask/services/eip') diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py index 16ed4cc0..09a3d257 100644 --- a/src/leap/bitmask/services/eip/eipconfig.py +++ b/src/leap/bitmask/services/eip/eipconfig.py @@ -33,17 +33,25 @@ from leap.common.check import leap_assert, leap_assert_type logger = logging.getLogger(__name__) -def get_eipconfig_path(domain): +def get_eipconfig_path(domain, relative=True): """ - Returns relative path for EIP config. + Returns relative or absolute path for EIP config. :param domain: the domain to which this eipconfig belongs to. :type domain: str + :param relative: defines whether the path should be relative or absolute. + :type relative: bool :returns: the path :rtype: str """ leap_assert(domain is not None, "get_eipconfig_path: We need a domain") - return os.path.join("leap", "providers", domain, "eip-service.json") + + path = os.path.join("leap", "providers", domain, "eip-service.json") + + if not relative: + path = os.path.join(get_path_prefix(), path) + + return path def load_eipconfig_if_needed(provider_config, eip_config, domain): -- cgit v1.2.3 From a9dc083c7ddf0181e5124bbae170c4ac9f752738 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 25 Nov 2013 15:13:00 -0200 Subject: Avoids the checking for an "updated" policy file for debian package. In the case of the debian package, we already take care to put the file in place, so this check is not needed. --- src/leap/bitmask/services/eip/linuxvpnlauncher.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/leap/bitmask/services/eip') diff --git a/src/leap/bitmask/services/eip/linuxvpnlauncher.py b/src/leap/bitmask/services/eip/linuxvpnlauncher.py index d02f6f96..73a0a948 100644 --- a/src/leap/bitmask/services/eip/linuxvpnlauncher.py +++ b/src/leap/bitmask/services/eip/linuxvpnlauncher.py @@ -148,18 +148,21 @@ class LinuxVPNLauncher(VPNLauncher): def missing_other_files(kls): """ 'Extend' the VPNLauncher's missing_other_files to check if the polkit - files is outdated. If the polkit file that is in OTHER_FILES exists but - is not up to date, it is added to the missing list. + files is outdated, in the case of an standalone bundle. + If the polkit file that is in OTHER_FILES exists but is not up to date, + it is added to the missing list. :returns: a list of missing files :rtype: list of str """ # we use `super` in order to send the class to use missing = super(LinuxVPNLauncher, kls).missing_other_files() - polkit_file = LinuxPolicyChecker.get_polkit_path() - if polkit_file not in missing: - if privilege_policies.is_policy_outdated(kls.OPENVPN_BIN_PATH): - missing.append(polkit_file) + + if flags.STANDALONE is True: + polkit_file = LinuxPolicyChecker.get_polkit_path() + if polkit_file not in missing: + if privilege_policies.is_policy_outdated(kls.OPENVPN_BIN_PATH): + missing.append(polkit_file) return missing -- cgit v1.2.3 From 4ca43c0ea751231a1f59702af9e347541faa859b Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 26 Nov 2013 14:13:09 -0200 Subject: do not compare to True as per pep8 recommendations --- src/leap/bitmask/services/eip/linuxvpnlauncher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/services/eip') diff --git a/src/leap/bitmask/services/eip/linuxvpnlauncher.py b/src/leap/bitmask/services/eip/linuxvpnlauncher.py index 73a0a948..d24e7ae7 100644 --- a/src/leap/bitmask/services/eip/linuxvpnlauncher.py +++ b/src/leap/bitmask/services/eip/linuxvpnlauncher.py @@ -77,7 +77,7 @@ def _try_to_launch_agent(): Tries to launch a polkit daemon. """ env = None - if flags.STANDALONE is True: + if flags.STANDALONE: env = {"PYTHONPATH": os.path.abspath('../../../../lib/')} try: # We need to quote the command because subprocess call @@ -158,7 +158,7 @@ class LinuxVPNLauncher(VPNLauncher): # we use `super` in order to send the class to use missing = super(LinuxVPNLauncher, kls).missing_other_files() - if flags.STANDALONE is True: + if flags.STANDALONE: polkit_file = LinuxPolicyChecker.get_polkit_path() if polkit_file not in missing: if privilege_policies.is_policy_outdated(kls.OPENVPN_BIN_PATH): -- cgit v1.2.3 From 00e544f4f312fc926dd2f68d094c0e2d37347b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 28 Nov 2013 09:29:25 -0300 Subject: Add --nobind as VPN parameter --- src/leap/bitmask/services/eip/vpnlauncher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap/bitmask/services/eip') diff --git a/src/leap/bitmask/services/eip/vpnlauncher.py b/src/leap/bitmask/services/eip/vpnlauncher.py index 07497814..99cae7f9 100644 --- a/src/leap/bitmask/services/eip/vpnlauncher.py +++ b/src/leap/bitmask/services/eip/vpnlauncher.py @@ -147,7 +147,8 @@ class VPNLauncher(object): args = [] args += [ - '--setenv', "LEAPOPENVPN", "1" + '--setenv', "LEAPOPENVPN", "1", + '--nobind' ] if openvpn_verb is not None: -- cgit v1.2.3