summaryrefslogtreecommitdiff
path: root/installer
diff options
context:
space:
mode:
authorkali <kali@leap.se>2020-07-27 18:18:38 +0200
committerRuben Pollan <meskio@sindominio.net>2020-10-13 19:08:40 +0200
commit2cf32806dcce2d41920be28bd0e7d12e5d049357 (patch)
tree5ecad10f0c2804ab0ded8380431490e475f57998 /installer
parent211fc457329b074fd4331aec0c4fc5d765e9023f (diff)
[pkg] update build script for openvpn
Diffstat (limited to 'installer')
-rw-r--r--installer/bitmask-installer.pro5
-rw-r--r--installer/config/config.xml2
-rw-r--r--installer/packages/riseupvpn/data/.gitignore3
-rwxr-xr-xinstaller/packages/riseupvpn/data/post-install.py54
-rw-r--r--installer/packages/riseupvpn/data/se.leap.bitmask-helper.plist26
5 files changed, 71 insertions, 19 deletions
diff --git a/installer/bitmask-installer.pro b/installer/bitmask-installer.pro
index 1435e4c..49179c4 100644
--- a/installer/bitmask-installer.pro
+++ b/installer/bitmask-installer.pro
@@ -22,6 +22,11 @@ macx {
OTHER_FILES += "packages/riseupvpn/data/riseup-vpn.app"
OTHER_FILES += "packages/riseupvpn/data/bitmask-helper"
OTHER_FILES += "packages/riseupvpn/data/installer.py"
+ OTHER_FILES += "packages/riseupvpn/data/se.leap.bitmask-helper.plist"
+ OTHER_FILES += "packages/riseupvpn/data/openvpn.leap"
+ OTHER_FILES += "packages/riseupvpn/data/helper/bitmask.pf.conf"
+ OTHER_FILES += "packages/riseupvpn/data/client.up.sh"
+ OTHER_FILES += "packages/riseupvpn/data/client.down.sh"
}
linux {
OTHER_FILES += "packages/riseupvpn/data/riseup-vpn"
diff --git a/installer/config/config.xml b/installer/config/config.xml
index ef0e5e8..492e76f 100644
--- a/installer/config/config.xml
+++ b/installer/config/config.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>RiseupVPN Installer 1.0</Name>
+ <Publisher>LEAP Encryption Access Project</Publisher>
<Title>RiseupVPN Installer</Title>
<Version>1.0.0</Version>
<TargetDir>@ApplicationsDir@/RiseupVPN</TargetDir>
@@ -9,4 +10,5 @@
<Url>http://localhost/repository/</Url>
</Repository>
</RemoteRepositories>
+ <WizardStyle>mac</WizardStyle>
</Installer>
diff --git a/installer/packages/riseupvpn/data/.gitignore b/installer/packages/riseupvpn/data/.gitignore
new file mode 100644
index 0000000..63c86a1
--- /dev/null
+++ b/installer/packages/riseupvpn/data/.gitignore
@@ -0,0 +1,3 @@
+openvpn.leap
+bitmask-helper
+riseup-vpn.app
diff --git a/installer/packages/riseupvpn/data/post-install.py b/installer/packages/riseupvpn/data/post-install.py
index 1e1addd..02da859 100755
--- a/installer/packages/riseupvpn/data/post-install.py
+++ b/installer/packages/riseupvpn/data/post-install.py
@@ -1,49 +1,49 @@
#!/usr/bin/env python
import os
+import shutil
import sys
import subprocess
HELPER = "bitmask-helper"
HELPER_PLIST = "/Library/LaunchDaemons/se.leap.bitmask-helper.plist"
+_dir = os.path.dirname(os.path.realpath(__file__))
def main():
- _dir = os.path.dirname(os.path.realpath(__file__))
log = open(os.path.join(_dir, 'post-install.log'), 'w')
- log.write('Checking for admin privileges...')
+ log.write('Checking for admin privileges...\n')
_id = os.getuid()
if _id != 0:
err = "error: need to run as root. UID: %s\n" % str(_id)
- logErr(log, msg)
+ logErr(log, err)
# failure: sys.exit(1)
if isHelperRunning():
- log.write("Trying to stop bitmask-helper...")
+ log.write("Trying to stop bitmask-helper...\n")
# if this fail, we can check if the HELPER_PLIST is there
ok = unloadHelper()
log.write("success: %s \n" % str(ok))
- ok = makeHelperExecutable()
- log.write("chmod +x helper: %s \n" % str(ok))
+ ok = fixHelperOwner(log)
+ log.write("chown helper: %s \n" % str(ok))
- # 3. cp se.leap.bitmask-helper.plist /Library/LaunchDaemons/
+ log.write("Copy launch daemon...\n")
copyLaunchDaemon()
- # 4. launchctl load /Library/LaunchDaemons/se.leap.bitmask-helper.plist
- launchHelper()
+ out = launchHelper()
+ log.write("Copy plist: %s \n" % str(ok))
- # 5. chown admin:wheel /Applications/$applicationName.app/Contents/helper # is this the folder?
grantPermissionsOnLogFolder()
- # all good
- log.write('post-install script: done')
+ # all done
+ log.write('post-install script: done\n')
sys.exit(0)
def logErr(log, msg):
- log.write(err)
+ log.write(msg)
sys.exit(1)
def isHelperRunning():
@@ -54,18 +54,34 @@ def unloadHelper():
out = subprocess.call(["launchctl", "unload", HELPER_PLIST])
return out == 0
-def makeHelperExecutable():
- out = subprocess.call(["chmod", "+x", HELPER])
- return out == 0
+def fixHelperOwner(log):
+ path = os.path.join(_dir, HELPER)
+ try:
+ os.chown(path, 0, 0)
+ except OSError as exc:
+ log.write(str(exc))
+ return False
+ return True
def copyLaunchDaemon():
- pass
+ plist = "se.leap.bitmask-helper.plist"
+ path = os.path.join(_dir, plist)
+ dest = os.path.join('/Library/LaunchDaemons', plist)
+ _p = _dir.replace("/", "\/")
+ subprocess.call(["sed", "-i.back", "s/PATH/%s/" % _p, path])
+ shutil.copy(path, dest)
def launchHelper():
- pass
+ out = subprocess.call(["launchctl", "load", "/Library/LaunchDaemons/se.leap.bitmask-helper.plist"])
+ return out == 0
def grantPermissionsOnLogFolder():
- pass
+ helperDir = os.path.join(_dir, 'helper')
+ try:
+ os.makedirs(helperDir)
+ except Exception:
+ pass
+ os.chown(helperDir, 0, 0)
def _getProcessList():
_out = []
diff --git a/installer/packages/riseupvpn/data/se.leap.bitmask-helper.plist b/installer/packages/riseupvpn/data/se.leap.bitmask-helper.plist
new file mode 100644
index 0000000..c9d9687
--- /dev/null
+++ b/installer/packages/riseupvpn/data/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>/tmp</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>PATH/bitmask-helper</string>
+</dict>
+</plist>