summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/eip
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-09-04 08:45:28 -0300
committerTomás Touceda <chiiph@leap.se>2013-09-04 08:45:28 -0300
commitcdc10a30b0a76eaa5c302b12996766faa90300dc (patch)
tree7b31c82bef19873888ab21717bd73bd5f616648d /src/leap/bitmask/services/eip
parent5dc4bf2886e13a914f8888bc4e49ac813f3cd56c (diff)
parentd315312740333abf8450e4e0b004d219a0936488 (diff)
Merge remote-tracking branch 'kali/bug/fix-polkit-aut' into develop
Diffstat (limited to 'src/leap/bitmask/services/eip')
-rw-r--r--src/leap/bitmask/services/eip/vpnlaunchers.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py
index a9213a9a..49edc8eb 100644
--- a/src/leap/bitmask/services/eip/vpnlaunchers.py
+++ b/src/leap/bitmask/services/eip/vpnlaunchers.py
@@ -23,8 +23,8 @@ import logging
import getpass
import os
import platform
-import subprocess
import stat
+import subprocess
try:
import grp
except ImportError:
@@ -34,6 +34,7 @@ from abc import ABCMeta, abstractmethod
from functools import partial
from leap.bitmask.config.leapsettings import LeapSettings
+
from leap.bitmask.config.providerconfig import ProviderConfig
from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector
from leap.bitmask.util import first
@@ -218,19 +219,19 @@ def _is_auth_agent_running():
return any(is_running)
-def _try_to_launch_agent():
+def _try_to_launch_agent(standalone=False):
"""
Tries to launch a polkit daemon.
"""
- opts = [
- "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
- # XXX add kde thing here
- ]
- for cmd in opts:
- try:
- subprocess.Popen([cmd], shell=True)
- except:
- pass
+ env = None
+ if standalone is True:
+ env = {
+ "PYTHONPATH": os.path.abspath('../../../../lib/')}
+ try:
+ subprocess.call(["python", "-m", "leap.bitmask.util.polkit_agent"],
+ shell=True, env=env)
+ except Exception as exc:
+ logger.exception(exc)
class LinuxVPNLauncher(VPNLauncher):
@@ -314,7 +315,7 @@ class LinuxVPNLauncher(VPNLauncher):
"""
if _is_pkexec_in_system():
if not _is_auth_agent_running():
- _try_to_launch_agent()
+ _try_to_launch_agent(ProviderConfig.standalone)
if _is_auth_agent_running():
pkexec_possibilities = which(kls.PKEXEC_BIN)
leap_assert(len(pkexec_possibilities) > 0,