summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/vpn/launchers/linux.py20
-rw-r--r--src/leap/bitmask/vpn/privilege.py4
2 files changed, 10 insertions, 14 deletions
diff --git a/src/leap/bitmask/vpn/launchers/linux.py b/src/leap/bitmask/vpn/launchers/linux.py
index 3b541d33..526b0ceb 100644
--- a/src/leap/bitmask/vpn/launchers/linux.py
+++ b/src/leap/bitmask/vpn/launchers/linux.py
@@ -126,10 +126,10 @@ class LinuxVPNLauncher(VPNLauncher):
class OPENVPN_BIN_PATH(object):
def __call__(self):
- #if IS_SNAP:
- # this should change when bitmask is also a snap. for now,
- # snap means RiseupVPN
- # return '/snap/bin/riseup-vpn/bin/riseup-vpn.openvpn'
+ if IS_SNAP:
+ # this should change when bitmask is also a snap. for now,
+ # snap means RiseupVPN
+ return '/snap/bin/riseup-vpn/bin/riseup-vpn.openvpn'
_sys = constants.OPENVPN_SYSTEM
_local = constants.OPENVPN_LOCAL
@@ -176,26 +176,20 @@ class LinuxVPNLauncher(VPNLauncher):
:return: A VPN command ready to be launched.
:rtype: list
"""
- print ">>> GET VPN COMMAND"
-
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" % str(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
+ if IS_SNAP:
+ return ["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" % str(command))
-
if os.getuid() != 0:
policyChecker = LinuxPolicyChecker()
pkexec = policyChecker.get_usable_pkexec()
diff --git a/src/leap/bitmask/vpn/privilege.py b/src/leap/bitmask/vpn/privilege.py
index afbca6f0..94d6cce5 100644
--- a/src/leap/bitmask/vpn/privilege.py
+++ b/src/leap/bitmask/vpn/privilege.py
@@ -29,9 +29,11 @@ from twisted.logger import Logger
from twisted.python.procutils import which
from leap.bitmask.util import STANDALONE, here
-from .constants import IS_LINUX, IS_SNAP
+from .constants import IS_LINUX
from . import polkit
+IS_SNAP = os.environ.get('SNAP')
+
log = Logger()