summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-03-01 20:19:10 +0100
committerKali Kaneko <kali@leap.se>2018-03-02 03:54:22 +0100
commit7fc83d53ea8a2b974bdf058e9e86706441f63147 (patch)
tree6a2c94aa66f3ddbc91b4222fb92a3dad7f1a866b
parent0bcf30d0969334143de236dfd9e74fd804724126 (diff)
[bug] fix openvpn path in snap check
-rw-r--r--src/leap/bitmask/vpn/constants.py5
-rw-r--r--src/leap/bitmask/vpn/helpers/__init__.py7
-rw-r--r--src/leap/bitmask/vpn/launchers/linux.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/leap/bitmask/vpn/constants.py b/src/leap/bitmask/vpn/constants.py
index 32f35e93..868ac193 100644
--- a/src/leap/bitmask/vpn/constants.py
+++ b/src/leap/bitmask/vpn/constants.py
@@ -34,5 +34,8 @@ if IS_LINUX:
BITMASK_ROOT_LOCAL = '/usr/local/sbin/bitmask-root'
OPENVPN_SYSTEM = '/usr/sbin/openvpn'
OPENVPN_LOCAL = '/usr/local/sbin/leap-openvpn'
- POLKIT_LOCAL = '/usr/share/polkit-1/actions/se.leap.bitmask-bundle.policy'
+ # this should change when bitmask is also a snap. for now,
+ # snap means RiseupVPN
+ OPENVPN_SNAP = '/snap/bin/riseup-vpn.openvpn'
+ POLKIT_LOCAL = '/usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy'
POLKIT_SYSTEM = '/usr/share/polkit-1/actions/se.leap.bitmask.policy'
diff --git a/src/leap/bitmask/vpn/helpers/__init__.py b/src/leap/bitmask/vpn/helpers/__init__.py
index 29e22e5d..df785057 100644
--- a/src/leap/bitmask/vpn/helpers/__init__.py
+++ b/src/leap/bitmask/vpn/helpers/__init__.py
@@ -20,7 +20,7 @@ if IS_LINUX:
from leap.bitmask.vpn.constants import BITMASK_ROOT_SYSTEM
from leap.bitmask.vpn.constants import BITMASK_ROOT_LOCAL
- from leap.bitmask.vpn.constants import OPENVPN_SYSTEM, OPENVPN_LOCAL
+ from leap.bitmask.vpn.constants import OPENVPN_SYSTEM, OPENVPN_LOCAL, OPENVPN_SNAP
from leap.bitmask.vpn.constants import POLKIT_SYSTEM, POLKIT_LOCAL
from leap.bitmask.vpn.privilege import is_pkexec_in_system
from leap.bitmask.vpn.privilege import LinuxPolicyChecker
@@ -83,18 +83,19 @@ if IS_LINUX:
if (_exists_and_can_read(BITMASK_ROOT_SYSTEM) and
helper_path_digest == digest(BITMASK_ROOT_SYSTEM)):
log.debug('global bitmask-root: %s' % os.path.isfile(BITMASK_ROOT_SYSTEM))
- log.debug('global bitmask-root: %s' % digest(BITMASK_ROOT_SYSTEM))
return True
if (_exists_and_can_read(BITMASK_ROOT_LOCAL) and
helper_path_digest == digest(BITMASK_ROOT_LOCAL)):
log.debug('local bitmask-root: %s' % os.path.isfile(BITMASK_ROOT_LOCAL))
- log.debug('local bitmask-root: %s' % digest(BITMASK_ROOT_LOCAL))
return True
log.debug('No valid bitmask-root found')
return False
def _check_openvpn():
+ if IS_SNAP:
+ return os.path.exists(OPENVPN_SNAP)
+
if os.path.exists(OPENVPN_SYSTEM):
return True
diff --git a/src/leap/bitmask/vpn/launchers/linux.py b/src/leap/bitmask/vpn/launchers/linux.py
index 526b0ceb..5e05bea4 100644
--- a/src/leap/bitmask/vpn/launchers/linux.py
+++ b/src/leap/bitmask/vpn/launchers/linux.py
@@ -129,7 +129,7 @@ class LinuxVPNLauncher(VPNLauncher):
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'
+ return constants.OPENVPN_SNAP
_sys = constants.OPENVPN_SYSTEM
_local = constants.OPENVPN_LOCAL