summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpkg/build_osx_bundle_riseupvpn_with_venv.sh3
-rw-r--r--pkg/bundles/build.mk12
-rwxr-xr-xpkg/osx/scripts-riseupvpn/postinstall13
-rwxr-xr-xpkg/osx/scripts-riseupvpn/preinstall12
-rw-r--r--pkg/osx/scripts-riseupvpn/se.leap.bitmask-helper.plist26
-rw-r--r--src/leap/bitmask/vpn/launchers/darwin.py24
6 files changed, 67 insertions, 23 deletions
diff --git a/pkg/build_osx_bundle_riseupvpn_with_venv.sh b/pkg/build_osx_bundle_riseupvpn_with_venv.sh
index 7f819849..2e7ec759 100755
--- a/pkg/build_osx_bundle_riseupvpn_with_venv.sh
+++ b/pkg/build_osx_bundle_riseupvpn_with_venv.sh
@@ -20,8 +20,7 @@ echo "[+] Using venv in" $VIRTUAL_ENV
$VIRTUAL_ENV/bin/pip install -U pyinstaller
$VIRTUAL_ENV/bin/pip install zope.interface zope.proxy
-
-$VIRTUAL_ENV/bin/pip install -r pkg/requirements-osx.pip
+$VIRTUAL_ENV/bin/pip install -r pkg/requirements-vpn.pip
# Get the bundled libzmq
$VIRTUAL_ENV/bin/pip install -I pyzmq --install-option="--zmq=bundled"
diff --git a/pkg/bundles/build.mk b/pkg/bundles/build.mk
index e93199db..aa411239 100644
--- a/pkg/bundles/build.mk
+++ b/pkg/bundles/build.mk
@@ -169,16 +169,16 @@ bundle_anonvpn_osx_missing:
mv $(OSX_ANON_CON)/anonvpn $(OSX_ANON_CON)/bitmask-app
cp pkg/osx/bitmask-wrapper $(OSX_ANON_CON)/anonvpn
mkdir -p $(OSX_ANON_RES)/bitmask-helper
- cp -r pkg/osx/daemon $(OSX_ANON_RES)/bitmask-helper/
- cp -r pkg/osx/openvpn $(OSX_ANON_RES)/bitmask-helper/
+ cp -r pkg/osx/openvpn/* $(OSX_ANON_RES)/
+ cp -r pkg/osx/daemon/* $(OSX_ANON_RES)/bitmask-helper/
mkdir -p $(OSX_ANON_RES)/../apps/providers
cp -r src/leap/bitmask/bonafide/providers/* $(OSX_ANON_RES)/../apps/providers/
cp -r $(ANONVPN_DIST_VERSION)/apps/providers/* $(OSX_ANON_RES)/../apps/providers
cp src/leap/bitmask/vpn/helpers/osx/bitmask-helper $(OSX_ANON_RES)/bitmask-helper/
- sed "s/.*Bitmask.app.*/APP_PATH='\/Applications\/RiseupVPN\.app\/'/" $(OSX_ANON_RES)/bitmask-helper/bitmask-helper2
- mv $(OSX_ANON_RES)/bitmask-helper/bitmask-helper2 $(OSX_ANON_RES)/bitmask-helper/bitmask-helper
+ chmod +x $(OSX_ANON_RES)/bitmask-helper/bitmask-helper
+ sed "s/.*Bitmask.app.*/APP_PATH='\/Applications\/RiseupVPN\.app\/'/" $(OSX_ANON_RES)/bitmask-helper/bitmask-helper > $(OSX_ANON_RES)/bitmask-helper/bitmask-helper2 && mv $(OSX_ANON_RES)/bitmask-helper/bitmask-helper2 $(OSX_ANON_RES)/bitmask-helper/bitmask-helper
cp src/leap/bitmask/vpn/helpers/osx/bitmask.pf.conf $(OSX_ANON_RES)/bitmask-helper/
- cp pkg/osx/scripts/se.leap.bitmask-helper.plist $(OSX_ANON_RES)/bitmask-helper/
+ cp pkg/osx/scripts-riseupvpn/se.leap.bitmask-helper.plist $(OSX_ANON_RES)/bitmask-helper/
wget https://downloads.leap.se/thirdparty/osx/openvpn/openvpn -O $(OSX_ANON_RES)/openvpn.leap
chmod +x $(OSX_ANON_RES)/openvpn.leap
@@ -187,7 +187,7 @@ bundle_anonvpn_osx_pkg:
cp ../bitmask-systray/bitmask-systray $(OSX_ANON_CON)/bitmask-systray
cp /usr/local/opt/zeromq/lib/libzmq.5.dylib $(OSX_ANON_CON)/libzmq.5.dylib
install_name_tool -change /usr/local/opt/zeromq/lib/libzmq.5.dylib "@loader_path/libzmq.5.dylib" $(OSX_ANON_CON)/bitmask-systray
- pkg/osx/quickpkg --output dist/RiseupVPN-$(NEXT_VERSION)_pre.pkg --scripts pkg/osx/scripts/ dist/RiseupVPN.app/
+ pkg/osx/quickpkg --output dist/RiseupVPN-$(NEXT_VERSION)_pre.pkg --scripts pkg/osx/scripts-riseupvpn/ dist/RiseupVPN.app/
@if [ $(BUILD_RELEASE) = no ]; then\
echo "[!] BUILD_RELEASE=no, skipping signature";\
else\
diff --git a/pkg/osx/scripts-riseupvpn/postinstall b/pkg/osx/scripts-riseupvpn/postinstall
new file mode 100755
index 00000000..93430390
--- /dev/null
+++ b/pkg/osx/scripts-riseupvpn/postinstall
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Bitmask Post-Instalation script
+# (c) LEAP Encryption access Project
+# We copy the bitmask-helper plist to the LaunchDaemons folder, and load the bitmask-helper that runs as root.
+
+LOG=/tmp/bitmask-install.log
+
+chmod +x /Applications/RiseupVPN.app/Contents/Resources/bitmask-helper/bitmask-helper
+cp se.leap.bitmask-helper.plist /Library/LaunchDaemons/ \
+ && echo `date` ":: Bitmask post-install: copied bitmask-helper Plist." >> $LOG
+launchctl load /Library/LaunchDaemons/se.leap.bitmask-helper.plist && echo `date` ":: Bitmask post-install: loaded bitmask-helper." >> $LOG
+echo `date` ":: Bitmask post-install: ok." >> $LOG
+exit 0
diff --git a/pkg/osx/scripts-riseupvpn/preinstall b/pkg/osx/scripts-riseupvpn/preinstall
new file mode 100755
index 00000000..1ae68f9c
--- /dev/null
+++ b/pkg/osx/scripts-riseupvpn/preinstall
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Bitmask Pre-Instalation script
+# (c) LEAP Encryption access Project
+# We unload the bitmask-helper if it is running, because we can be installing an upgrade.
+
+LOG=/tmp/bitmask-install.log
+
+ps aux | grep [b]itmask-helper \
+ && launchctl unload /Library/LaunchDaemons/se.leap.bitmask-helper.plist \
+ && echo `date` ":: Bitmask pre-install: unloaded bitmask-helper." >> $LOG
+echo `date` ":: Bitmask pre-install: ok." >> $LOG
+exit 0
diff --git a/pkg/osx/scripts-riseupvpn/se.leap.bitmask-helper.plist b/pkg/osx/scripts-riseupvpn/se.leap.bitmask-helper.plist
new file mode 100644
index 00000000..8ebfb947
--- /dev/null
+++ b/pkg/osx/scripts-riseupvpn/se.leap.bitmask-helper.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>WorkingDirectory</key>
+ <string>/Applications/RiseupVPN.app/Contents/Resources/bitmask-helper/</string>
+ <key>StandardOutPath</key>
+ <string>bitmask-helper.log</string>
+ <key>StandardErrorPath</key>
+ <string>bitmask-helper-err.log</string>
+ <key>GroupName</key>
+ <string>daemon</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>SessionCreate</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>ThrottleInterval</key>
+ <integer>5</integer>
+ <key>Label</key>
+ <string>se.leap.BitmaskHelper</string>
+ <key>Program</key>
+ <string>/Applications/RiseupVPN.app/Contents/Resources/bitmask-helper/bitmask-helper</string>
+</dict>
+</plist>
diff --git a/src/leap/bitmask/vpn/launchers/darwin.py b/src/leap/bitmask/vpn/launchers/darwin.py
index 03393da2..d959b159 100644
--- a/src/leap/bitmask/vpn/launchers/darwin.py
+++ b/src/leap/bitmask/vpn/launchers/darwin.py
@@ -73,29 +73,23 @@ class DarwinVPNLauncher(VPNLauncher):
# Hardcode the installation path for OSX for security, openvpn is
# run as root
- INSTALL_PATH = "/Applications/Bitmask.app/"
- 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,)
+ if os.path.isdir('/Applications/RiseupVPN.app'):
+ INSTALL_PATH = '/Applications/RiseupVPN.app'
+ else:
+ INSTALL_PATH = '/Applications/Bitmask.app'
- OTHER_FILES = []
+ OPENVPN_BIN = 'openvpn.leap'
+ OPENVPN_PATH = "%s/Contents/Resources/" % (INSTALL_PATH,)
- _openvpn_bin_path = "%s/Contents/Resources/%s" % (
- INSTALL_PATH, OPENVPN_BIN)
+ _openvpn_bin_path = os.path.join(OPENVPN_PATH, OPENVPN_BIN)
if os.path.isfile(_openvpn_bin_path):
OPENVPN_BIN_PATH = _openvpn_bin_path
else:
# let's try with the homebrew path
OPENVPN_BIN_PATH = '/usr/local/sbin/openvpn'
+ OTHER_FILES = []
+
def kill_previous_openvpn():
pass