diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-10-09 18:53:11 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2020-10-13 19:08:54 +0200 |
commit | 73d0c7a96df2212d5a3ee6289fc286f3e6459028 (patch) | |
tree | d304904b19b1ef365213876a60e19e232a36c95a | |
parent | e4a2efb527fb09b548c14b13d28d0780941ca72d (diff) |
[pkg] refactor vendor init/check
-rw-r--r-- | Makefile | 44 | ||||
-rw-r--r-- | bitmask.pro | 1 | ||||
-rw-r--r-- | branding/README.rst | 64 | ||||
-rw-r--r-- | branding/assets/calyx/osx-background.png | bin | 28726 -> 0 bytes | |||
-rw-r--r-- | branding/assets/demo/icon.bmp | bin | 65674 -> 0 bytes | |||
-rw-r--r-- | branding/assets/demo/icon.png | bin | 17473 -> 0 bytes | |||
l--------- | branding/assets/demolib | 1 | ||||
-rw-r--r-- | branding/assets/riseup/icon.bmp | bin | 65674 -> 0 bytes | |||
-rw-r--r-- | branding/assets/riseup/icon.icns | bin | 1359609 -> 0 bytes | |||
-rwxr-xr-x | branding/assets/riseup/icon.ico | bin | 4286 -> 0 bytes | |||
-rwxr-xr-x | branding/assets/riseup/icon.png | bin | 16809 -> 0 bytes | |||
-rw-r--r-- | branding/assets/riseup/icon.svg | 80 | ||||
-rw-r--r-- | branding/assets/riseup/osx-background.png | bin | 278046 -> 0 bytes | |||
-rw-r--r-- | branding/config/demo-ca.crt | 32 | ||||
-rw-r--r-- | branding/scripts/ASSETS_LIST | 2 | ||||
-rw-r--r-- | branding/scripts/ASSETS_REQUIRED | 3 | ||||
-rwxr-xr-x | branding/scripts/check | 62 | ||||
-rwxr-xr-x | branding/scripts/check-ca-crt (renamed from branding/scripts/check-ca-crt.py) | 31 | ||||
-rwxr-xr-x | branding/scripts/getparam | 5 | ||||
-rwxr-xr-x | branding/scripts/init | 96 | ||||
-rw-r--r-- | docs/branding.rst | 63 | ||||
-rw-r--r-- | providers/calyx/assets/icon.bmp (renamed from branding/assets/calyx/icon.bmp) | bin | 360138 -> 360138 bytes | |||
-rw-r--r-- | providers/calyx/assets/icon.icns (renamed from branding/assets/calyx/icon.icns) | bin | 44161 -> 44161 bytes | |||
-rw-r--r-- | providers/calyx/assets/icon.ico (renamed from branding/assets/calyx/icon.ico) | bin | 18317 -> 18317 bytes | |||
-rw-r--r-- | providers/calyx/assets/icon.png (renamed from branding/assets/calyx/icon.png) | bin | 18339 -> 18339 bytes | |||
-rw-r--r-- | providers/calyx/assets/icon.svg (renamed from branding/assets/calyx/icon.svg) | 0 | ||||
-rw-r--r-- | providers/calyx/calyx-ca.crt (renamed from branding/config/calyx-ca.crt) | 0 | ||||
-rw-r--r-- | providers/demolib/demolib-ca.crt (renamed from branding/config/demolib-ca.crt) | 0 | ||||
-rw-r--r-- | providers/riseup/assets/icon.icns (renamed from branding/assets/demo/icon.icns) | bin | 1359609 -> 1359609 bytes | |||
-rwxr-xr-x | providers/riseup/assets/icon.ico (renamed from branding/assets/demo/icon.ico) | bin | 4286 -> 4286 bytes | |||
-rw-r--r-- | providers/riseup/assets/icon.svg (renamed from branding/assets/demo/icon.svg) | 0 | ||||
-rw-r--r-- | providers/riseup/riseup-ca.crt (renamed from branding/config/riseup-ca.crt) | 0 | ||||
-rw-r--r-- | providers/vendor.conf (renamed from branding/config/vendor.conf) | 0 |
33 files changed, 236 insertions, 248 deletions
@@ -7,11 +7,10 @@ XBUILD ?= no SKIP_CACHECK ?= no -PROVIDER ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '=' -f 2 | tr -d "[:space:]") -APPNAME ?= $(shell branding/scripts/getparam appname | tail -n 1) -TARGET ?= $(shell branding/scripts/getparam binname | tail -n 1) -PROVIDER_CONFIG ?= branding/config/vendor.conf -DEFAULT_PROVIDER = branding/assets/default/ +VENDOR_PATH ?= providers +APPNAME ?= $(shell VENDOR_PATH=${VENDOR_PATH} branding/scripts/getparam appname | tail -n 1) +TARGET ?= $(shell VENDOR_PATH=${VENDOR_PATH} branding/scripts/getparam binname | tail -n 1) +PROVIDER ?= $(shell grep ^'provider =' ${VENDOR_PATH}/vendor.conf | cut -d '=' -f 2 | tr -d "[:space:]") VERSION ?= $(shell git describe) # go paths @@ -195,39 +194,28 @@ test_ui: golib ######################################################################### vendor_init: - @./branding/scripts/init - # TODO we should do the prepare step here, store it in VENDOR_PATH + @VENDOR_PATH=${VENDOR_PATH} ./branding/scripts/init vendor_check: - @./branding/scripts/check - # TODO move ca-check here + @VENDOR_PATH=${VENDOR_PATH} ./branding/scripts/check ${PROVIDER} +ifeq (${SKIP_CACHECK}, no) + @VENDOR_PATH=${VENDOR_PATH} ${SCRIPTS}/check-ca-crt ${PROVIDER} +endif -vendor: gen_providers_json - # TODO merge with prepare, after moving the gen_pkg to vendor_init +vendor: gen_providers_json prepare_templates gen_pkg_snap gen_pkg_deb gen_providers_json: @python3 branding/scripts/gen-providers-json.py branding/config/vendor.conf gui/providers/providers.json -prepare: prepare_templates gen_pkg_win gen_pkg_osx gen_pkg_snap gen_pkg_deb prepare_done - prepare_templates: generate relink_default tgz @mkdir -p build/${PROVIDER}/bin/ deploy @cp ${TEMPLATES}/makefile/Makefile build/${PROVIDER}/Makefile @VERSION=${VERSION} PROVIDER_CONFIG=${PROVIDER_CONFIG} ${SCRIPTS}/generate-vendor-make.py build/${PROVIDER}/vendor.mk -ifeq (${SKIP_CACHECK}, no) - @${SCRIPTS}/check-ca-crt.py ${PROVIDER} ${PROVIDER_CONFIG} -endif generate: @go generate gui/backend.go @go generate pkg/config/version/genver/gen.go -relink_default: -ifneq (,$(wildcard ${DEFAULT_PROVIDER})) - @cd branding/assets && unlink default -endif - @cd branding/assets && ln -s ${PROVIDER} default - TGZ_NAME = bitmask-vpn_${VERSION}-src TGZ_PATH = $(shell pwd)/build/${TGZ_NAME} tgz: @@ -236,12 +224,7 @@ tgz: @cd build/ && tar czf bitmask-vpn_$(VERSION).tgz ${TGZ_NAME} @rm -rf $(TGZ_PATH) -# XXX port/deprecate ----------------------------------------------- -gen_pkg_win: - @mkdir -p build/${PROVIDER}/windows/ - @cp -r ${TEMPLATES}/windows build/${PROVIDER} - @VERSION=${VERSION} PROVIDER_CONFIG=${PROVIDER_CONFIG} ${SCRIPTS}/generate-win.py build/${PROVIDER}/windows/data.json - @cd build/${PROVIDER}/windows && python3 generate.py +# XXX port/deprecate -------------------------------------------------------------------------------------------------- gen_pkg_deb: @cp -r ${TEMPLATES}/debian build/${PROVIDER} @@ -261,9 +244,8 @@ gen_pkg_snap: @cp branding/assets/default/icon.png build/${PROVIDER}/snap/gui/${PROVIDER}-vpn.png rm build/${PROVIDER}/snap/generate.py -prepare_done: - @echo - @echo 'Done. You can do "make build" now.' +# --------------------------------------------------------------------------------------------------------------------- + ######################################################################### # packaging action diff --git a/bitmask.pro b/bitmask.pro index 111ff04..795a3d5 100644 --- a/bitmask.pro +++ b/bitmask.pro @@ -32,6 +32,7 @@ HEADERS += \ LIBS += -L../../lib -lgoshim -lpthread RESOURCES += gui/gui.qrc +RESOURCES += providers/riseup/vendor.qrc DESTDIR = release OBJECTS_DIR = release/.obj diff --git a/branding/README.rst b/branding/README.rst deleted file mode 100644 index 108ba5e..0000000 --- a/branding/README.rst +++ /dev/null @@ -1,64 +0,0 @@ -BitmaskVPN Branding Procedure -================================================================================ - -This folder contains everything that is needed to generate a customized built of -the Desktop BitmaskVPN app for a given provider. - - -Configure --------------------------------------------------------------------------------- - -To start a new vendoring project, initialize a new repo for your provider: - - export VENDOR_PATH=../leapvpn-myprovider-pkg - make vendor_init - -Follow the directions in the output of the above command. Basically you need to -configure your provider CA certificate, and some graphical assets: - - * Copy your provider CA certificate to the same folder: 'config/<provider>-ca.crt' - * Check the list of assets at 'assets/FILES.Readme'. - -You can validate your configuration: - - export VENDOR_PATH=../leapvpn-myprovider-pkg - make vendor_check - -Checkout --------------------------------------------------------------------------------- - - git clone https://0xacab.org/leap/bitmask-vpn - cd bitmask-vpn - git pull --tags - - -Package --------------------------------------------------------------------------------- - -NOTE: Some of the following scripts need network access, since they will check -whether the configuration published by your provider matches what is configured -before the build. If you want to skip this check, pass `SKIP_CACHECK=yes` - -Run:: - - export VENDOR_PATH=../leapvpn-myprovider-pkg - make vendor - make prepare - -Then you can build the binary:: - - make build - -* FIXME: the following does not work yet --------------------- - REFACTORING in progress ------------------------------------ - -Then you can build all the packages:: - - make packages - -Alternatively, you can build only for an specific os:: - - make package_win - make package_osx - make package_snap - make package_deb diff --git a/branding/assets/calyx/osx-background.png b/branding/assets/calyx/osx-background.png Binary files differdeleted file mode 100644 index 91bcd8f..0000000 --- a/branding/assets/calyx/osx-background.png +++ /dev/null diff --git a/branding/assets/demo/icon.bmp b/branding/assets/demo/icon.bmp Binary files differdeleted file mode 100644 index 9e918e4..0000000 --- a/branding/assets/demo/icon.bmp +++ /dev/null diff --git a/branding/assets/demo/icon.png b/branding/assets/demo/icon.png Binary files differdeleted file mode 100644 index fb1aacd..0000000 --- a/branding/assets/demo/icon.png +++ /dev/null diff --git a/branding/assets/demolib b/branding/assets/demolib deleted file mode 120000 index efd261b..0000000 --- a/branding/assets/demolib +++ /dev/null @@ -1 +0,0 @@ -demo
\ No newline at end of file diff --git a/branding/assets/riseup/icon.bmp b/branding/assets/riseup/icon.bmp Binary files differdeleted file mode 100644 index 9e918e4..0000000 --- a/branding/assets/riseup/icon.bmp +++ /dev/null diff --git a/branding/assets/riseup/icon.icns b/branding/assets/riseup/icon.icns Binary files differdeleted file mode 100644 index b4c9a20..0000000 --- a/branding/assets/riseup/icon.icns +++ /dev/null diff --git a/branding/assets/riseup/icon.ico b/branding/assets/riseup/icon.ico Binary files differdeleted file mode 100755 index c65c9e1..0000000 --- a/branding/assets/riseup/icon.ico +++ /dev/null diff --git a/branding/assets/riseup/icon.png b/branding/assets/riseup/icon.png Binary files differdeleted file mode 100755 index 492d850..0000000 --- a/branding/assets/riseup/icon.png +++ /dev/null diff --git a/branding/assets/riseup/icon.svg b/branding/assets/riseup/icon.svg deleted file mode 100644 index a19c6c6..0000000 --- a/branding/assets/riseup/icon.svg +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="128" - height="128" - viewBox="0 0 33.866666 33.866668" - version="1.1" - id="svg896" - inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" - sodipodi:docname="riseupvpn-launcher.svg"> - <defs - id="defs890" /> - <sodipodi:namedview - id="base" - pagecolor="#d7d7d7" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:zoom="5.12" - inkscape:cx="26.899914" - inkscape:cy="56.22909" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="true" - units="px" - inkscape:window-width="1869" - inkscape:window-height="1025" - inkscape:window-x="51" - inkscape:window-y="27" - inkscape:window-maximized="1"> - <inkscape:grid - type="xygrid" - id="grid1471" - empspacing="4" /> - </sodipodi:namedview> - <metadata - id="metadata893"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(0,-263.13332)"> - <path - style="fill:#006cb2;fill-opacity:1;stroke-width:0.26458335" - d="M 15.617988,295.66418 C 9.9401302,292.50672 5.6959906,287.52131 4.7342129,282.87951 4.4622971,281.56718 4.4516145,281.24899 4.4519256,274.47112 l 2.394e-4,-6.47461 0.5616386,-0.36177 c 2.3734615,-1.52883 4.8841786,-2.55103 7.4419094,-3.06699 5.221864,-1.05337 10.639669,0.003 15.485448,3.16684 l 0.398232,0.25998 v 6.50684 c 0,6.8044 -0.01093,7.13134 -0.280843,8.43104 -0.956329,4.6043 -4.632206,9.09553 -10.057782,12.28874 -1.576255,0.9277 -1.527525,0.91863 -2.382844,0.44299 z" - id="path5137" - inkscape:connector-curvature="0" - sodipodi:nodetypes="csccssscssscc" /> - <path - inkscape:connector-curvature="0" - style="fill:#007cc3;fill-opacity:1;stroke-width:0.26458335" - d="m 16.396917,264.17336 c -1.317958,-4.7e-4 -2.635612,0.13103 -3.941076,0.39437 -2.5577318,0.51596 -5.068528,1.53812 -7.4419895,3.06696 l -0.5615828,0.36177 -4.707e-4,6.47466 c -2.394e-4,6.77787 0.010371,7.096 0.2822554,8.40832 0.9617776,4.64181 5.2059168,9.62724 10.8837756,12.7847 h 1.19e-4 c 0.368953,0.20517 0.569745,0.32326 0.805249,0.31706 v -31.80747 c -0.0088,-2e-5 -0.01755,-4.8e-4 -0.02641,-4.8e-4 z" - id="path887" /> - <path - style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458338" - d="m 16.989143,272.54844 c 0,0 -0.315707,-0.61165 -0.336761,-0.69601 -0.02106,-0.0844 -0.189431,-0.94909 -0.189431,-0.94909 l 0.210485,-0.37963 0.463046,-0.696 0.673531,-0.52727 0.168377,-0.0633 1.620684,-0.61164 0.147331,-0.14764 -0.168385,-0.25308 -0.231523,-0.12655 -0.424879,-0.10907 -1.064407,-0.10907 -0.825967,0.007 -0.568293,0.12654 -0.505146,-0.18981 -0.63143,-0.0844 -0.9261,-0.0211 -0.463054,-0.0211 -0.778761,0.29527 -1.178677,1.37091 -0.147339,0.52727 -0.08418,0.464 -0.399908,0.86473 -0.252577,0.82254 -0.126285,0.88582 v 0.18982 l -0.610384,0.92799 -0.336761,0.69601 v 0.99126 l 0.10523,2.04581 0.189431,0.73821 0.378861,0.6749 0.4841,0.44292 0.210477,0.8647 0.799815,1.77155 0.947154,1.13886 0.06311,0.0633 0.336761,1.70835 -1.157623,2.10911 -0.363408,0.28169 -0.272426,0.22054 -0.467179,-0.0129 -0.260603,0.13452 -0.316122,0.0134 -0.190994,0.19047 -0.408963,-0.0616 -0.4044091,-0.0196 -0.311982,0.24606 -0.044916,0.36556 0.207365,-0.23472 0.3488649,-0.10158 0.03654,0.33552 0.5512672,-0.18726 0.316122,-0.0134 0.557721,0.0667 c 0,0 0.483518,-0.0316 0.567216,-0.0407 0.0837,-0.009 0.597276,0.0411 0.597276,0.0411 l 0.376644,-0.041 0.199723,0.0844 0.267456,-0.0716 0.290265,0.13818 0.418488,-0.0455 0.05401,-0.28169 -0.01596,-0.14678 0.28571,0.0962 0.232049,0.18692 0.150642,0.21701 -0.0088,-0.27495 -0.182953,-0.31946 c 0,0 -0.125159,-0.17737 -0.208857,-0.16824 -0.0837,0.009 -0.408971,-0.0616 -0.408971,-0.0616 l -0.223321,0.088 -0.243857,-0.10085 -0.239677,0.13226 -0.220665,-0.0822 -0.106491,-0.20049 -0.153322,-0.0471 0.164763,-0.42962 0.378861,-0.52859 0.505146,-0.84364 0.442,-0.5273 0.168385,-0.21088 c 0,0 0.210477,-0.31633 0.210477,-0.40071 0,-0.0844 0.04212,-0.97016 0.04212,-0.97016 l -0.273623,-0.56947 -0.126285,-0.46402 2.441546,0.59059 h 0.147331 l 2.083731,1.49744 0.294669,0.37959 0.10523,1.49729 -0.04212,0.33746 -0.147338,0.27419 -0.105358,0.16875 -0.09101,0.23675 -0.06215,0.1583 -0.386712,0.11988 -0.393086,-0.0709 -0.238209,-0.0294 -0.437428,0.0633 -0.184118,0.19713 -0.07084,0.24475 0.05712,0.24744 0.09172,-0.24769 0.124641,-0.16724 0.121984,-0.0388 0.0094,0.21174 0.163957,0.10406 0.338995,-0.15563 0.166646,-0.0242 0.05409,0.22658 0.508999,-0.01 0.345035,-0.11394 0.282886,0.0443 0.410893,0.047 0.142823,-0.0417 0.112881,-0.10156 0.182442,0.37841 0.0024,-0.42654 -0.176722,-0.48581 -0.256358,-0.15463 0.04324,-0.12712 -0.189423,-0.35849 0.02106,-1.37079 1.052392,1.2444 1.389154,1.09674 c 0,0 0.947146,0.33749 1.03133,0.33749 0.08419,0 0.736677,-0.0844 0.736677,-0.0844 l 0.420954,-0.69598 -0.315715,-0.94908 0.126284,-0.31642 -0.673531,-0.88574 -1.426794,-1.45279 -0.341213,-1.14141 0.02106,-0.78037 -0.315707,-0.82257 -0.357816,-0.65376 0.210477,-0.65377 -0.168377,-0.94904 -0.717785,-1.61568 0.265151,-0.0448 -0.444984,-0.77034 0.289101,-0.0918 -0.508218,-0.82847 0.213764,-0.11524 -0.380944,-0.62543 0.124202,-0.0696 -0.460971,-0.37337 0.168384,-0.0875 -1.199723,-0.84051 z" - id="path5892" - inkscape:connector-curvature="0" - sodipodi:nodetypes="csccccccccccccccccccccccccccccccccccccccccccccccccccccccscccccccccccccsccccccccccccscccccccccccccccccccccccccccccccccccccccccccscccccccccccccccccccccccc" /> - </g> -</svg> diff --git a/branding/assets/riseup/osx-background.png b/branding/assets/riseup/osx-background.png Binary files differdeleted file mode 100644 index 0e6cbf6..0000000 --- a/branding/assets/riseup/osx-background.png +++ /dev/null diff --git a/branding/config/demo-ca.crt b/branding/config/demo-ca.crt deleted file mode 100644 index 80d41c3..0000000 --- a/branding/config/demo-ca.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQ0FADBKMRgwFgYDVQQDDA9CaXRt -YXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNVBAsME2h0dHBzOi8v -Yml0bWFzay5uZXQwHhcNMTIxMTA2MDAwMDAwWhcNMjIxMTA2MDAwMDAwWjBKMRgw -FgYDVQQDDA9CaXRtYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNV -BAsME2h0dHBzOi8vYml0bWFzay5uZXQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQC1eV4YvayaU+maJbWrD4OHo3d7S1BtDlcvkIRS1Fw3iYDjsyDkZxai -dHp4EUasfNQ+EVtXUvtk6170EmLco6Elg8SJBQ27trE6nielPRPCfX3fQzETRfvB -7tNvGw4Jn2YKiYoMD79kkjgyZjkJ2r/bEHUSevmR09BRp86syHZerdNGpXYhcQ84 -CA1+V+603GFIHnrP+uQDdssW93rgDNYu+exT+Wj6STfnUkugyjmPRPjL7wh0tzy+ -znCeLl4xiV3g9sjPnc7r2EQKd5uaTe3j71sDPF92KRk0SSUndREz+B1+Dbe/RGk4 -MEqGFuOzrtsgEhPIX0hplhb0Tgz/rtug+yTT7oJjBa3u20AAOQ38/M99EfdeJvc4 -lPFF1XBBLh6X9UKF72an2NuANiX6XPySnJgZ7nZ09RiYZqVwu/qt3DfvLfhboq+0 -bQvLUPXrVDr70onv5UDjpmEA/cLmaIqqrduuTkFZOym65/PfAPvpGnt7crQj/Ibl -DEDYZQmP7AS+6zBjoOzNjUGE5r40zWAR1RSi7zliXTu+yfsjXUIhUAWmYR6J3KxB -lfsiHBQ+8dn9kC3YrUexWoOqBiqJOAJzZh5Y1tqgzfh+2nmHSB2dsQRs7rDRRlyy -YMbkpzL9ZsOUO2eTP1mmar6YjCN+rggYjRrX71K2SpBG6b1zZxOG+wIDAQABo2Aw -XjAdBgNVHQ4EFgQUuYGDLL2sswnYpHHvProt1JU+D48wDgYDVR0PAQH/BAQDAgIE -MAwGA1UdEwQFMAMBAf8wHwYDVR0jBBgwFoAUuYGDLL2sswnYpHHvProt1JU+D48w -DQYJKoZIhvcNAQENBQADggIBADeG67vaFcbITGpi51264kHPYPEWaXUa5XYbtmBl -cXYyB6hY5hv/YNuVGJ1gWsDmdeXEyj0j2icGQjYdHRfwhrbEri+h1EZOm1cSBDuY -k/P5+ctHyOXx8IE79DBsZ6IL61UKIaKhqZBfLGYcWu17DVV6+LT+AKtHhOrv3TSj -RnAcKnCbKqXLhUPXpK0eTjPYS2zQGQGIhIy9sQXVXJJJsGrPgMxna1Xw2JikBOCG -htD/JKwt6xBmNwktH0GI/LVtVgSp82Clbn9C4eZN9E5YbVYjLkIEDhpByeC71QhX -EIQ0ZR56bFuJA/CwValBqV/G9gscTPQqd+iETp8yrFpAVHOW+YzSFbxjTEkBte1J -aF0vmbqdMAWLk+LEFPQRptZh0B88igtx6tV5oVd+p5IVRM49poLhuPNJGPvMj99l -mlZ4+AeRUnbOOeAEuvpLJbel4rhwFzmUiGoeTVoPZyMevWcVFq6BMkS+jRR2w0jK -G6b0v5XDHlcFYPOgUrtsOBFJVwbutLvxdk6q37kIFnWCd8L3kmES5q4wjyFK47Co -Ja8zlx64jmMZPg/t3wWqkZgXZ14qnbyG5/lGsj5CwVtfDljrhN0oCWK1FZaUmW3d -69db12/g4f6phldhxiWuGC/W6fCW5kre7nmhshcltqAJJuU47iX+DarBFiIj816e -yV8e ------END CERTIFICATE----- diff --git a/branding/scripts/ASSETS_LIST b/branding/scripts/ASSETS_LIST deleted file mode 100644 index 71c89e3..0000000 --- a/branding/scripts/ASSETS_LIST +++ /dev/null @@ -1,2 +0,0 @@ -svg/icon.svg -ico/logo.ico diff --git a/branding/scripts/ASSETS_REQUIRED b/branding/scripts/ASSETS_REQUIRED new file mode 100644 index 0000000..b1889d1 --- /dev/null +++ b/branding/scripts/ASSETS_REQUIRED @@ -0,0 +1,3 @@ +icon.svg +icon.ico +icon.icns diff --git a/branding/scripts/check b/branding/scripts/check index 07b2a71..aab962e 100755 --- a/branding/scripts/check +++ b/branding/scripts/check @@ -1,4 +1,64 @@ #!/usr/bin/env python3 +import os +import sys + +# TODO check file list +# TODO remove fom README + +VENDOR_PATH = None + +def getVendorPath(): + global VENDOR_PATH + VENDOR_PATH = os.environ.get("VENDOR_PATH") + if not VENDOR_PATH: + print("[ERROR] VENDOR_PATH not set") + sys.exit(1) + + if not os.path.isdir(os.path.abspath(VENDOR_PATH)): + print("[ERROR] VENDOR_PATH folder does not exist:", VENDOR_PATH) + sys.exit(1) + +def checkCAFile(provider): + caFile = os.path.join(os.path.abspath(VENDOR_PATH), provider, provider + '-ca.crt') + if not os.path.isfile(caFile): + print("ERROR: Missing provider CA file:", caFile) + sys.exit(1) + print('[+] CA file ok:', caFile) + +def checkAssets(provider): + top = os.path.join(os.path.abspath(VENDOR_PATH), 'assets') + if os.path.isdir(top): + ok = checkAssetFiles(top) + if ok: + return + under = os.path.join(os.path.abspath(VENDOR_PATH), provider, 'assets') + if os.path.isdir(under): + ok = checkAssetFiles(under) + if ok: + return + print('[!] ERROR: cannot find some assets for provider {provider}'.format(provider=provider)) + sys.exit(1) + +def checkAssetFiles(path): + for item in allAssets(): + asset = os.path.join(path, item) + if not os.path.isfile(asset): + print("[!] Error: missing asset file:", asset) + return False + return True + +def allAssets(): + with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "ASSETS_REQUIRED")) as f: + allAssets = f.readlines() + return list(map(lambda s: s.strip(), allAssets)) + if __name__ == "__main__": - print("[+] Checking your provider config... (WIP)") + print("[+] Checking your provider config...") + provider = sys.argv[1] + if not provider: + print("ERROR: must pass provider as first argument") + sys.exit(1) + getVendorPath() + checkCAFile(provider) + checkAssets(provider) diff --git a/branding/scripts/check-ca-crt.py b/branding/scripts/check-ca-crt index dbf9b40..7458263 100755 --- a/branding/scripts/check-ca-crt.py +++ b/branding/scripts/check-ca-crt @@ -1,21 +1,22 @@ #!/usr/bin/env python3 +import os import re import sys import configparser import urllib.request -SCRIPT_NAME = 'check-ca-crt.py' +SCRIPT_NAME = 'check-ca-crt' +VENDOR_PATH = None USAGE = '''Check that the stored provider CA matches the one announced online. -Usage: {name} <provider> <config> +Usage: {name} <provider> -Example: {name} riseup branding/config/vendor.conf'''.format(name=SCRIPT_NAME) +Example: {name} riseup'''.format(name=SCRIPT_NAME) def getLocalCert(provider): - sanitized = re.sub(r'[^\w\s-]', '', provider).strip().lower() - with open('branding/config/' - '{provider}-ca.crt'.format(provider=sanitized)) as crt: + with open(os.path.join(VENDOR_PATH, provider, + '{provider}-ca.crt'.format(provider=sanitize(provider).lower()))) as crt: return crt.read().strip() @@ -26,22 +27,34 @@ def getRemoteCert(uri): fp.close() return remote_cert - def getUriForProvider(provider, configfile): c = configparser.ConfigParser() c.read(configfile) return c[provider]['caURL'] +def sanitize(s): + return re.sub(r'[^\w\s-]', '', s).strip() if __name__ == '__main__': + VENDOR_PATH = os.environ.get('VENDOR_PATH') - if len(sys.argv) != 3: + if not VENDOR_PATH: + print('[!] ERROR: Please set VENDOR_PATH variable first') + sys.exit(1) + if not os.path.isdir(os.path.abspath(VENDOR_PATH)): + print('[!] ERROR: VENDOR_PATH points to non-existent dir') + sys.exit(1) + + if len(sys.argv) != 2: print('[!] Not enough arguments') print(USAGE) sys.exit(1) provider = sys.argv[1] - config = sys.argv[2] + config = os.path.abspath(os.path.join(VENDOR_PATH, 'vendor.conf')) + if not os.path.isfile(config): + print('[!] ERROR: cannot open {config}') + sys.exit(1) try: uri = getUriForProvider(provider, config) diff --git a/branding/scripts/getparam b/branding/scripts/getparam index 2b87e1e..235745d 100755 --- a/branding/scripts/getparam +++ b/branding/scripts/getparam @@ -13,9 +13,10 @@ from provider import getProviderData def getData(): here = os.path.abspath(os.path.dirname(__file__)) - configPath = os.path.join(here, '../../branding/config/vendor.conf') + vendorPath = os.environ.get('VENDOR_PATH') + configPath = os.path.join(vendorPath, 'vendor.conf') if not os.path.isfile(configPath): - print("ERROR: path does not exist", config) + print("ERROR: path does not exist", configPath) os.exit(1) config = configparser.ConfigParser() config.read(configPath) diff --git a/branding/scripts/init b/branding/scripts/init index ba9ce52..4c57d43 100755 --- a/branding/scripts/init +++ b/branding/scripts/init @@ -2,13 +2,15 @@ # (c) LEAP Encryption Access Project 2020 # License: GPL +import string import subprocess import sys import os VENDOR_PATH = None +PROVIDER=None SCRIPT_NAME = sys.argv[0] -CA_README = "config/CERT.Readme" +CA_README = "CERT.Readme" ASSETS_README = "assets/FILES.Readme" def initVendor(): @@ -17,9 +19,9 @@ def initVendor(): bail("ERROR: Please set VENDOR_PATH environment variable.") VENDOR_PATH = os.path.abspath(VENDOR_PATH) if os.path.isdir(VENDOR_PATH): - bail("ERROR: VENDOR_PATH folder already exists") + bail("ERROR: VENDOR_PATH folder already exists {path}".format(path=VENDOR_PATH)) - for d in ["config", "assets", "pkg"]: + for d in ["assets"]: os.makedirs(os.path.join(VENDOR_PATH, d)) initVendorConfig() @@ -27,10 +29,12 @@ def initVendor(): displayRepoInfo() def displayRepoInfo(): + print() print("[+] Initialized repo in", VENDOR_PATH) - print(f"[ ] - Add the assets in the assets/ folder, see {ASSETS_README}.") - print(f"[ ] - Add the CA certificate in the config/ folder, see {CA_README}.") - print("[ ] - Remember to commit your changes.") + print() + print(f"- Please add all the needed assets. See {VENDOR_PATH}/{ASSETS_README}.") + print(f"- Add your provider's CA certificate, see see {VENDOR_PATH}/{PROVIDER}/{CA_README}.") + print("- Remember to commit your changes.") print() print("[+] After doing that, you can run 'make vendor_check' to validate the configuration for your provider.") @@ -46,15 +50,42 @@ def bail(msg=None): def getVendorPath(): return os.environ.get('VENDOR_PATH') +def sanitize(word): + result = "" + for letter in word: + if letter in string.ascii_letters: + result = result + letter.lower() + return result + +def getProvider(): + provider = os.environ.get('PROVIDER') + if not provider: + provider = input('> provider name? ') + provider = sanitize(provider) + print("[+] provider name:", provider) + return provider + +def getProviderURL(): + url = os.environ.get('PROVIDER_URL') + if not url : + url = input('> provider url?: https://') + return url.replace('https://', '').replace('/', '') + +def getAppName(provider): + return provider[0].capitalize() + provider[1:] + "VPN" + def initVendorConfig(): + with open(os.path.join(VENDOR_PATH, "vendor.conf"), "w") as f: + f.write(getConf()) - with open(os.path.join(VENDOR_PATH, "config", "vendor.conf"), "w") as f: - f.write(CONF_TEMPLATE) + caDir = os.path.join(VENDOR_PATH, PROVIDER) + print("CADIR??", caDir) - with open(os.path.join(VENDOR_PATH, CA_README), "w") as f: - f.write(CA_INFO) + os.makedirs(caDir, exist_ok=True) + with open(os.path.join(caDir, CA_README), "w") as f: + f.write(getCAInfo()) - with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "ASSETS_LIST")) as f: + with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "ASSETS_REQUIRED")) as f: allAssets = f.read() with open(os.path.join(VENDOR_PATH, ASSETS_README), "w") as f: @@ -69,34 +100,44 @@ def initGitRepo(): CONF_TEMPLATE = """[default] -provider = myprovider +provider = {provider} -[myprovider] +[{provider}] -name = MyProvider -applicationName = MyProviderVPN -binaryName = myprovider-vpn +name = {provider} +applicationName = {appName} +binaryName = {provider}-vpn -providerURL = example.org +providerURL = https://{providerURL} auth = anon -apiURL = https://api.myprovider.net/ -caURL = https://myprovider.net/ca.crt +apiURL = https://api.{providerURL}/ +caURL = https://{providerURL}/ca.crt -infoURL = https://myprovider.net/vpn -tosURL = https://myprovider.net/tos -helpURL = https://myprovider.net/support +infoURL = https://{providerURL}/vpn +tosURL = https://{providerURL}/tos +helpURL = https://{providerURL}/support -geolocationAPI = https://myprovider.net:9001/json +geolocationAPI = https://{providerURL}:9001/json -askForDonations = true -donateURL = https://myprovider.net/vpn/donate +askForDonations = false +donateURL = https://{providerURL}/vpn/donate """ +def getConf(): + return CONF_TEMPLATE.format( + provider=PROVIDER, + appName=getAppName(PROVIDER), + providerURL=PROVIDER_URL) + + CA_INFO = """Place in this folder your provider's CA certificate, with the name: - <providerName>-ca.crt + {provider}-ca.crt """ +def getCAInfo(): + return CA_INFO.format(provider=PROVIDER) + ASSETS_INFO = """This is the list of assets that you MUST place in this folder for your provider: """ @@ -104,5 +145,8 @@ ASSETS_INFO = """This is the list of assets that you MUST place in this folder f if __name__ == "__main__": if len(sys.argv) != 1: bail() + VENDOR_PATH = getVendorPath() + PROVIDER = getProvider() + PROVIDER_URL = getProviderURL() initVendor() diff --git a/docs/branding.rst b/docs/branding.rst new file mode 100644 index 0000000..6c7a0d9 --- /dev/null +++ b/docs/branding.rst @@ -0,0 +1,63 @@ +BitmaskVPN Branding Procedure +================================================================================ + +This document contains the instructions to generate a custom build of the +Desktop BitmaskVPN app for a given provider. + +Configure +-------------------------------------------------------------------------------- + +All the needed information to vendorize BitmaskVPN are contained in an external +folder, where you will place the connection details to your own provider and +any asset that you want to customize. To start a new vendoring project, you need +to initialize a new repo for your provider: + + export VENDOR_PATH=../leapvpn-myprovider-pkg + make vendor_init + +Follow the directions in the output of the above command. Basically you need to +configure your provider CA certificate, and some graphical assets: + + * Copy your provider CA certificate to the same folder: '<provider>-ca.crt' + * Check the list of assets at 'assets/FILES.Readme'. + +You can validate your configuration: + + VENDOR_PATH=../myprovider-vpn-pkg vendor_check + +This will fetch your provider's CA against the one you have configured. If you +want to skip the online check, set the `SKIP_CACHECK` to "yes". + +Checkout the source +-------------------------------------------------------------------------------- + + git clone https://0xacab.org/leap/bitmask-vpn + cd bitmask-vpn + git pull --tags + + +Build & package +-------------------------------------------------------------------------------- + +NOTE: Some of the following scripts need network access, since they will check +whether the configuration published by your provider matches what is configured +before the build. If you want to skip this check, pass `SKIP_CACHECK=yes` + +Run:: + + VENDOR_PATH=../myprovider-vpn-pkg make vendor + +Then you can build the binaries for some quick manual testing:: + + make build + +Now you can build the installer for your host platform:: + + make build_installer + +Previously we had a cross-compilation setup in place. Cross compilation will be added back in the future. + +For debian and snap packages (FIXME -- WORK IN PROGRESS): + + make debian + make snap diff --git a/branding/assets/calyx/icon.bmp b/providers/calyx/assets/icon.bmp Binary files differindex c9e1b0a..c9e1b0a 100644 --- a/branding/assets/calyx/icon.bmp +++ b/providers/calyx/assets/icon.bmp diff --git a/branding/assets/calyx/icon.icns b/providers/calyx/assets/icon.icns Binary files differindex 1fd6045..1fd6045 100644 --- a/branding/assets/calyx/icon.icns +++ b/providers/calyx/assets/icon.icns diff --git a/branding/assets/calyx/icon.ico b/providers/calyx/assets/icon.ico Binary files differindex 1950733..1950733 100644 --- a/branding/assets/calyx/icon.ico +++ b/providers/calyx/assets/icon.ico diff --git a/branding/assets/calyx/icon.png b/providers/calyx/assets/icon.png Binary files differindex 5b0e175..5b0e175 100644 --- a/branding/assets/calyx/icon.png +++ b/providers/calyx/assets/icon.png diff --git a/branding/assets/calyx/icon.svg b/providers/calyx/assets/icon.svg index b9d83af..b9d83af 100644 --- a/branding/assets/calyx/icon.svg +++ b/providers/calyx/assets/icon.svg diff --git a/branding/config/calyx-ca.crt b/providers/calyx/calyx-ca.crt index 2923144..2923144 100644 --- a/branding/config/calyx-ca.crt +++ b/providers/calyx/calyx-ca.crt diff --git a/branding/config/demolib-ca.crt b/providers/demolib/demolib-ca.crt index ae726f4..ae726f4 100644 --- a/branding/config/demolib-ca.crt +++ b/providers/demolib/demolib-ca.crt diff --git a/branding/assets/demo/icon.icns b/providers/riseup/assets/icon.icns Binary files differindex b4c9a20..b4c9a20 100644 --- a/branding/assets/demo/icon.icns +++ b/providers/riseup/assets/icon.icns diff --git a/branding/assets/demo/icon.ico b/providers/riseup/assets/icon.ico Binary files differindex c65c9e1..c65c9e1 100755 --- a/branding/assets/demo/icon.ico +++ b/providers/riseup/assets/icon.ico diff --git a/branding/assets/demo/icon.svg b/providers/riseup/assets/icon.svg index a19c6c6..a19c6c6 100644 --- a/branding/assets/demo/icon.svg +++ b/providers/riseup/assets/icon.svg diff --git a/branding/config/riseup-ca.crt b/providers/riseup/riseup-ca.crt index cbec39c..cbec39c 100644 --- a/branding/config/riseup-ca.crt +++ b/providers/riseup/riseup-ca.crt diff --git a/branding/config/vendor.conf b/providers/vendor.conf index d9e6a25..d9e6a25 100644 --- a/branding/config/vendor.conf +++ b/providers/vendor.conf |