summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/launchers
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-10-06 02:30:06 +0200
committerKali Kaneko <kali@leap.se>2017-10-06 18:32:11 +0200
commitb66ec16f764be769e4a15dae783292ac4cd32f3b (patch)
tree92526be03d34d8e8a1e1d35803da02137103a330 /src/leap/bitmask/vpn/launchers
parent08ca6b5dbe38c927037e1e6e8256c5dd8a11f03d (diff)
[bug] use sytem-wide bitmask-root, if found
we make a distinction between the system-wide bitmask-root, which should be placed there by the maintainers of whatever packages your distribution uses, and the bitmask-root that is placed by the bundles (using polkit). since the bundles copying over the helper from user-writeable folders is a potential attack vector, we prefer to use the package's version if present. also, if we cannot find either, we abort the launching of the VPN. we've discussed that this might move to the service initialization instead, but I think the cases in which this is needed should be rare. I fix also a corner-case in which we were using getcwd() at import time. if you execute code and then remove the installation path, this will raise a traceback in bitmaskctl. I think it's nicer to catch the error properly when starting.
Diffstat (limited to 'src/leap/bitmask/vpn/launchers')
-rw-r--r--src/leap/bitmask/vpn/launchers/darwin.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/bitmask/vpn/launchers/darwin.py b/src/leap/bitmask/vpn/launchers/darwin.py
index 08772dca..05c3ee22 100644
--- a/src/leap/bitmask/vpn/launchers/darwin.py
+++ b/src/leap/bitmask/vpn/launchers/darwin.py
@@ -74,11 +74,18 @@ class DarwinVPNLauncher(VPNLauncher):
# Hardcode the installation path for OSX for security, openvpn is
# run as root
INSTALL_PATH = "/Applications/Bitmask.app/"
- INSTALL_PATH_ESCAPED = os.path.realpath(os.getcwd() + "/../../")
OPENVPN_BIN = 'openvpn.leap'
OPENVPN_PATH = "%s/Contents/Resources/openvpn" % (INSTALL_PATH,)
+ try:
+ INSTALL_PATH_ESCAPED = os.path.realpath(os.getcwd() + "/../../")
+ except OSError as exc:
+ # this might happen if os.getcwd() was deleted under our feet. We do
+ # not want to raise the Exception at import time.
+ logger.error('Error while setting openvpn paths: %r' % exc)
+ INSTALL_PATH_ESCAPED="/Applications/Bitmask.app/"
OPENVPN_PATH_ESCAPED = "%s/Contents/Resources/openvpn" % (
INSTALL_PATH_ESCAPED,)
+
OTHER_FILES = []
_openvpn_bin_path = "%s/Contents/Resources/%s" % (