summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@win>2020-10-15 22:03:54 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-10-23 23:22:57 +0200
commit015faa8fe70912da4faa1528c88c3ef6b9fcaabd (patch)
tree4f0086db3d4ab2242e171a08248529276a0e0422
parent46f84b7490e0427fc2ddd20238797d1d7523e278 (diff)
[pkg] windows vendoring fixes
-rw-r--r--Makefile52
-rw-r--r--bitmask.pro1
-rw-r--r--branding/scripts/provider.py3
-rwxr-xr-xgui/build.sh9
-rw-r--r--pkg/vpn/launcher.go6
-rw-r--r--pkg/vpn/openvpn.go3
6 files changed, 34 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index 5de5d44..4d0ff32 100644
--- a/Makefile
+++ b/Makefile
@@ -90,7 +90,7 @@ lib/%.a: $(PKGFILES)
build_golib: lib/libgoshim.a
build_gui:
- @XBUILD=no TARGET=${TARGET} VENDOR_PATH=${VENDOR_PATH}/${PROVIDER} gui/build.sh --skip-golib
+ @XBUILD=no TARGET=${TARGET} VENDOR_PATH=${VENDOR_PATH} gui/build.sh --skip-golib
build: build_golib build_helper build_openvpn build_gui
@@ -126,14 +126,18 @@ endif
ifeq (${PLATFORM}, windows)
@VERSION=${VERSION} VENDOR_PATH=${VENDOR_PATH} ${SCRIPTS}/gen-qtinstaller windows ${INSTALLER}
@cp build/bin/${PLATFORM}/bitmask-helper ${INST_DATA}helper.exe
+ifeq (${VENDOR_PATH}, providers)
@cp ${VENDOR_PATH}/${PROVIDER}/assets/icon.ico ${INST_DATA}/icon.ico
+else
+ @cp ${VENDOR_PATH}/assets/icon.ico ${INST_DATA}/icon.ico
+endif
@cp ${QTBUILD}/release/${TARGET}.exe ${INST_DATA}${TARGET}.exe
# FIXME get the signed binaries with curl from openvpn downloads page - see if we have to adapt the openvpn-build to install tap drivers etc from our installer.
@cp "/c/Program Files/OpenVPN/bin/openvpn.exe" ${INST_DATA}
@cp "/c/Program Files/OpenVPN/bin/"*.dll ${INST_DATA}
- # XXX add sign options
+ # FIXME add sign options
@windeployqt --qmldir gui/qml ${INST_DATA}${TARGET}.exe
- # TODO stage it to save time
+ # TODO stage it to shave some time
@wget ${TAP_WINDOWS} -O ${INST_DATA}/tap-windows.exe
endif
ifeq (${PLATFORM}, linux)
@@ -141,7 +145,7 @@ ifeq (${PLATFORM}, linux)
endif
@echo "[+] All templates, binaries and libraries copied to build/installer."
@echo "[+] Now building the installer."
- @cd build/installer && qmake INSTALLER=${APPNAME}-installer-${VERSION} && make
+ @cd build/installer && qmake VENDOR_PATH=${VENDOR_PATH} INSTALLER=${APPNAME}-installer-${VERSION} && make
check_qtifw:
ifdef HAS_QTIFW
@@ -150,36 +154,10 @@ else
$(error "[!] Cannot find QTIFW. Please install it and add it to your PATH")
endif
-# ----------- FIXME ------- old build, reuse or delete -----------------------------
-
-CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++"
-PLATFORM_WIN = PLATFORM=windows
-EXTRA_LDFLAGS_WIN = EXTRA_LDFLAGS="-H=windowsgui"
-build_cross_win:
- @echo "[+] Cross-building for windows..."
- @$(CROSS_WIN_FLAGS) $(PLATFORM_WIN) $(EXTRA_LDFLAGS_WIN) $(MAKE) _buildparts
- # workaround for helper: we use the go compiler
- @echo "[+] Compiling helper with the Go compiler to work around missing stdout bug..."
- cd cmd/bitmask-helper && GOOS=windows GOARCH=386 go build -ldflags "-X main.version=`git describe --tags` -H=windowsgui" -o ../../build/bin/windows/bitmask-helper-go
-
-CROSS_OSX_FLAGS = MACOSX_DEPLOYMENT_TARGET=10.10 CGO_ENABLED=1 GOOS=darwin CC="o64-clang"
-PLATFORM_OSX = PLATFORM=darwin
-build_cross_osx:
- $(CROSS_OSX_FLAGS) $(PLATFORM_OSX) $(MAKE) _buildparts
-
-# --------- FIXME -----------------------------------------------------------------------
-
clean:
@rm -rf build/
@unlink branding/assets/default || true
-#########################################################################
-# build them all
-#########################################################################
-
-build_all_providers:
- branding/scripts/build-all-providers
-
########################################################################
# tests
#########################################################################
@@ -230,28 +208,36 @@ tgz:
@cd build/ && tar czf bitmask-vpn_$(VERSION).tgz ${TGZ_NAME}
@rm -rf $(TGZ_PATH)
-# FIXME port --------------------------------------------------------------------------------------------------
gen_pkg_deb:
+ifeq (${PLATFORM}, linux)
@cp -r ${TEMPLATES}/debian build/${PROVIDER}
@VERSION=${VERSION} VENDOR_PATH=${VENDOR_PATH} ${SCRIPTS}/generate-debian build/${PROVIDER}/debian/data.json
@mkdir -p build/${PROVIDER}/debian/icons/scalable && cp ${VENDOR_PATH}/${PROVIDER}/assets/icon.svg build/${PROVIDER}/debian/icons/scalable/icon.svg
@cd build/${PROVIDER}/debian && python3 generate.py
@cd build/${PROVIDER}/debian && rm app.desktop-template changelog-template rules-template control-template generate.py data.json && chmod +x rules
+endif
gen_pkg_snap:
+ifeq (${PLATFORM}, linux)
@cp -r ${TEMPLATES}/snap build/${PROVIDER}
@VERSION=${VERSION} VENDOR_PATH=${VENDOR_PATH} ${SCRIPTS}/generate-snap build/${PROVIDER}/snap/data.json
@cp helpers/se.leap.bitmask.snap.policy build/${PROVIDER}/snap/local/pre/
@cp helpers/bitmask-root build/${PROVIDER}/snap/local/pre/
@cd build/${PROVIDER}/snap && python3 generate.py
@rm build/${PROVIDER}/snap/data.json build/${PROVIDER}/snap/snapcraft-template.yaml
- @mkdir -p build/${PROVIDER}/snap/gui && cp ${VENDOR_PATH}/${PROVIDER}/assets/icon.svg build/${PROVIDER}/snap/gui/icon.svg
+ @mkdir -p build/${PROVIDER}/snap/gui
+ifeq (${VENDOR_PATH}, providers)
+ @cp ${VENDOR_PATH}/${PROVIDER}/assets/icon.svg build/${PROVIDER}/snap/gui/icon.svg
# FIXME is this png needed?? then add it to ASSETS_REQUIRED
@cp ${VENDOR_PATH}/${PROVIDER}/assets/icon.png build/${PROVIDER}/snap/gui/${PROVIDER}-vpn.png
+else
+ @cp ${VENDOR_PATH}/assets/icon.svg build/${PROVIDER}/snap/gui/icon.svg
+ @cp ${VENDOR_PATH}/assets/icon.png build/${PROVIDER}/snap/gui/${PROVIDER}-vpn.png
+endif
@rm build/${PROVIDER}/snap/generate.py
+endif
-# ---------------------------------------------------------------------------------------------------------------------
#########################################################################
diff --git a/bitmask.pro b/bitmask.pro
index c22ee8c..1601b46 100644
--- a/bitmask.pro
+++ b/bitmask.pro
@@ -7,6 +7,7 @@ lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5")
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
!defined(VENDOR_PATH, var):VENDOR_PATH="providers/riseup"
+message("[qmake] VENDOR_PATH: $$VENDOR_PATH")
RESOURCES += gui/gui.qrc
RESOURCES += $$VENDOR_PATH/vendor.qrc
diff --git a/branding/scripts/provider.py b/branding/scripts/provider.py
index 8904c37..22b36fd 100644
--- a/branding/scripts/provider.py
+++ b/branding/scripts/provider.py
@@ -25,10 +25,11 @@ def getProviderData(provider, config):
'providerURL', 'tosURL', 'helpURL',
'askForDonations', 'donateURL', 'apiURL',
'geolocationAPI', 'caCertString')
+ boolValues = ['askForDonations', 'authEmptyPass']
for value in keys:
d[value] = c.get(value)
- if value == 'askForDonations':
+ if value in boolValues:
d[value] = bool(d[value])
d['timeStamp'] = '{:%Y-%m-%d %H:%M:%S}'.format(
diff --git a/gui/build.sh b/gui/build.sh
index c3d1699..2262d09 100755
--- a/gui/build.sh
+++ b/gui/build.sh
@@ -6,6 +6,8 @@ set -e
# --------------------
XBUILD=${XBUILD-no}
+VENDOR_PATH=${VENDOR_PATH-providers/riseup}
+
OSX_TARGET=10.11
WIN64="win64"
GO=`which go`
@@ -16,7 +18,6 @@ SOURCE_GOLIB=gui/backend.go
QTBUILD=build/qt
RELEASE=$QTBUILD/release
-VENDOR_PATH=${VENDOR_PATH-providers/riseup}
PLATFORM=$(uname -s)
LDFLAGS=""
@@ -58,7 +59,7 @@ function buildGoLib {
fi
if [ "$PLATFORM" == "MINGW64_NT-10.0" ]
then
- LDFLAGS="-H=windowsgui"
+ LDFLAGS="-H windowsgui"
fi
if [ "$XBUILD" == "no" ]
then
@@ -76,9 +77,8 @@ function buildGoLib {
function buildQmake {
echo "[+] Now building Qml app with Qt qmake"
echo "[+] Using qmake in:" $QMAKE
- echo "[+] VENDOR_PATH:" $VENDOR_PATH
mkdir -p $QTBUILD
- $QMAKE -o $QTBUILD/Makefile "CONFIG-=debug CONFIG+=release VENDOR_PATH=${VENDOR_PATH}" $PROJECT
+ $QMAKE -o "$QTBUILD/Makefile" CONFIG-=debug CONFIG+=release VENDOR_PATH=${VENDOR_PATH} $PROJECT
}
function renameOutput {
@@ -118,6 +118,7 @@ function buildDefault {
}
+echo "[build.sh] VENDOR_PATH =" ${VENDOR_PATH}
for i in "$@"
do
case $i in
diff --git a/pkg/vpn/launcher.go b/pkg/vpn/launcher.go
index 234a89c..eb3794c 100644
--- a/pkg/vpn/launcher.go
+++ b/pkg/vpn/launcher.go
@@ -47,11 +47,12 @@ func probeHelperPort(port int) int {
return port
}
port++
- if port > 65535 {
+ /* we could go until 65k, but there's really no need */
+ if port > 10000 {
break
}
}
- log.Println("WARN: Cannot find working helper")
+ log.Println("WARN: Cannot find any working helper")
return 0
}
@@ -72,6 +73,7 @@ func smellsLikeOurHelperSpirit(port int, c *http.Client) bool {
return true
} else {
log.Println("DEBUG: Another helper seems to be running:", string(ver))
+ log.Println("DEBUG: But we were hoping to find:", config.ApplicationName)
}
}
return false
diff --git a/pkg/vpn/openvpn.go b/pkg/vpn/openvpn.go
index 4997a34..c0ec2e1 100644
--- a/pkg/vpn/openvpn.go
+++ b/pkg/vpn/openvpn.go
@@ -51,6 +51,9 @@ func (b *Bitmask) StartVPN(provider string) error {
}
func (b *Bitmask) CanStartVPN() bool {
+ /* FIXME this is not enough. We should check, if provider needs
+ * credentials, if we have a valid token, otherwise remove it and
+ make sure that we're asking for the credentials input */
return !b.bonafide.NeedsCredentials()
}