summaryrefslogtreecommitdiff
path: root/src/leap/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/services')
-rw-r--r--src/leap/services/eip/vpn.py7
-rw-r--r--src/leap/services/eip/vpnlaunchers.py46
2 files changed, 51 insertions, 2 deletions
diff --git a/src/leap/services/eip/vpn.py b/src/leap/services/eip/vpn.py
index 55ace23b..9d838609 100644
--- a/src/leap/services/eip/vpn.py
+++ b/src/leap/services/eip/vpn.py
@@ -157,7 +157,14 @@ class VPN(QtCore.QThread):
socket_host=socket_host,
socket_port=socket_port)
try:
+ env = QtCore.QProcessEnvironment.systemEnvironment()
+ for key, val in self._launcher.get_vpn_env(providerconfig).items():
+ env.insert(key, val)
+
self._subp = QtCore.QProcess()
+
+ self._subp.setProcessEnvironment(env)
+
self._subp.finished.connect(self.process_finished)
self._subp.finished.connect(self._dump_exitinfo)
self._subp.start(command[:1][0], command[1:])
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 773b1f92..78db0176 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -79,6 +79,20 @@ class VPNLauncher:
"""
return []
+ @abstractmethod
+ def get_vpn_env(self, providerconfig):
+ """
+ Returns a dictionary with the custom env for the platform.
+ This is mainly used for setting LD_LIBRARY_PATH to the correct
+ path when distributing a standalone client
+
+ @param providerconfig: provider specific configuration
+ @type providerconfig: ProviderConfig
+
+ @rtype: dict
+ """
+ return {}
+
def get_platform_launcher():
launcher = globals()[platform.system() + "VPNLauncher"]
@@ -125,7 +139,9 @@ class LinuxVPNLauncher(VPNLauncher):
def get_vpn_command(self, eipconfig=None, providerconfig=None,
socket_host=None, socket_port="unix"):
"""
- Returns the platform dependant vpn launching command
+ Returns the platform dependant vpn launching command. It will
+ look for openvpn in the regular paths and algo in
+ path_prefix/apps/eip/ (in case standalone is set)
Might raise VPNException.
@@ -149,7 +165,16 @@ class LinuxVPNLauncher(VPNLauncher):
leap_assert(socket_host, "We need a socket host!")
leap_assert(socket_port, "We need a socket port!")
- openvpn_possibilities = which(self.OPENVPN_BIN)
+ kwargs = {}
+ if ProviderConfig.standalone:
+ kwargs['path_extension'] = os.path.join(
+ providerconfig.get_path_prefix(),
+ "..", "apps", "eip")
+
+ openvpn_possibilities = which(
+ self.OPENVPN_BIN,
+ **kwargs)
+
if len(openvpn_possibilities) == 0:
raise OpenVPNNotFoundException()
@@ -229,6 +254,23 @@ class LinuxVPNLauncher(VPNLauncher):
return [openvpn] + args
+ def get_vpn_env(self, providerconfig):
+ """
+ Returns a dictionary with the custom env for the platform.
+ This is mainly used for setting LD_LIBRARY_PATH to the correct
+ path when distributing a standalone client
+
+ @param providerconfig: provider specific configuration
+ @type providerconfig: ProviderConfig
+
+ @rtype: dict
+ """
+ leap_assert(providerconfig, "We need a provider config")
+ leap_assert_type(providerconfig, ProviderConfig)
+
+ return {"LD_LIBRARY_PATH": os.path.join(
+ providerconfig.get_path_prefix(),
+ "..", "lib")}
class DarwinVPNLauncher(VPNLauncher):
"""