summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/vpnlaunchers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/services/eip/vpnlaunchers.py')
-rw-r--r--src/leap/services/eip/vpnlaunchers.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 8522d1df..992f0c50 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -38,6 +38,7 @@ from leap.common.files import which
from leap.config.providerconfig import ProviderConfig
from leap.services.eip.eipconfig import EIPConfig, VPNGatewaySelector
from leap.util import first
+from leap.util.privilege_policies import LinuxPolicyChecker
logger = logging.getLogger(__name__)
@@ -62,7 +63,7 @@ class EIPNoTunKextLoaded(VPNLauncherException):
pass
-class VPNLauncher:
+class VPNLauncher(object):
"""
Abstract launcher class
"""
@@ -250,12 +251,25 @@ class LinuxVPNLauncher(VPNLauncher):
OPENVPN_DOWN_ROOT_BASE,
OPENVPN_DOWN_ROOT_FILE)
- POLKIT_BASE = "/usr/share/polkit-1/actions"
- POLKIT_FILE = "net.openvpn.gui.leap.policy"
- POLKIT_PATH = "%s/%s" % (POLKIT_BASE, POLKIT_FILE)
-
UPDOWN_FILES = (UP_DOWN_PATH,)
- OTHER_FILES = (POLKIT_PATH,)
+ POLKIT_PATH = LinuxPolicyChecker.get_polkit_path()
+ OTHER_FILES = (POLKIT_PATH, )
+
+ def missing_other_files(self):
+ """
+ 'Extend' the VPNLauncher's missing_other_files to check if the polkit
+ files is outdated. If the polkit file is in OTHER_FILES, exists, but is
+ not up to date, it is added to the missing list.
+
+ :rtype: list
+ """
+ missing = VPNLauncher.missing_other_files.im_func(self)
+ polkit_file = LinuxPolicyChecker().get_polkit_path()
+ if polkit_file not in missing:
+ if privilege_policies.is_policy_outdated(self.OPENVPN_BIN_PATH):
+ missing.append(polkit_file)
+
+ return missing
@classmethod
def cmd_for_missing_scripts(kls, frompath, pol_file):