diff options
author | Kali Kaneko <kali@leap.se> | 2018-03-01 14:42:02 +0100 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2018-03-02 03:54:20 +0100 |
commit | 4d82a4252c9074dc4f5b5b1d7aa3a682b5571521 (patch) | |
tree | f34548c0d7aa0f048f41846b14470b8c76b103e8 | |
parent | 75b006bfad38565e684ebd3bb11a7161d48f2f0e (diff) |
[refactor] openvpn path and cmd for snap
-rw-r--r-- | src/leap/bitmask/vpn/launchers/linux.py | 20 | ||||
-rw-r--r-- | src/leap/bitmask/vpn/privilege.py | 4 |
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() |