summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/vpn/launchers/linux.py16
-rw-r--r--src/leap/bitmask/vpn/process.py19
2 files changed, 29 insertions, 6 deletions
diff --git a/src/leap/bitmask/vpn/launchers/linux.py b/src/leap/bitmask/vpn/launchers/linux.py
index 53a915a7..48977835 100644
--- a/src/leap/bitmask/vpn/launchers/linux.py
+++ b/src/leap/bitmask/vpn/launchers/linux.py
@@ -165,21 +165,37 @@ class LinuxVPNLauncher(VPNLauncher):
:return: A VPN command ready to be launched.
:rtype: list
"""
+ command = []
# we use `super` in order to send the class to use
command = super(LinuxVPNLauncher, kls).get_vpn_command(
vpnconfig, providerconfig, socket_host, socket_port, remotes,
openvpn_verb)
+ print("command super %s" % command)
+ # XXX DEBUG local variable command referenced before assignment
+ # this was breaking the snap. re-do in a more robust way.
+
+ command = ["pkexec", "/usr/local/sbin/bitmask-root", "openvpn", "start"] + command
+
+ """
command.insert(0, force_eval(kls.BITMASK_ROOT))
command.insert(1, "openvpn")
command.insert(2, "start")
+ """
+ print("Inserted: %s" % command)
+
+ """
if os.getuid() != 0:
+ print("OS UID != 0")
policyChecker = LinuxPolicyChecker()
+ print("checker %s", policyChecker)
pkexec = policyChecker.get_usable_pkexec()
if pkexec:
command.insert(0, first(pkexec))
+ """
+ print("Final: %s" % command)
return command
def terminate_or_kill(self, terminatefun, killfun, proc):
diff --git a/src/leap/bitmask/vpn/process.py b/src/leap/bitmask/vpn/process.py
index 27cb51ec..35ccf9f6 100644
--- a/src/leap/bitmask/vpn/process.py
+++ b/src/leap/bitmask/vpn/process.py
@@ -293,17 +293,24 @@ class _VPNProcess(protocol.ProcessProtocol):
:rtype: list of str
"""
- command = self._launcher.get_vpn_command(
- vpnconfig=self._vpnconfig,
- providerconfig=self._providerconfig,
- socket_host=self._host,
- socket_port=self._port,
- remotes=self._remotes)
+ print("GETTING COMMAND", self._launcher)
+ try:
+ command = self._launcher.get_vpn_command(
+ vpnconfig=self._vpnconfig,
+ providerconfig=self._providerconfig,
+ socket_host=self._host,
+ socket_port=self._port,
+ remotes=self._remotes)
+ print("Command: %s", command)
+ except Exception as exc:
+ print("ERROR: %r" % exc)
encoding = sys.getfilesystemencoding()
+ print("encoding", encoding)
for i, c in enumerate(command):
if not isinstance(c, str):
command[i] = c.encode(encoding)
+ print("command: %s", command)
self.log.debug("Running VPN with command: ")
self.log.debug("{0}".format(" ".join(command)))