Skip to content
Snippets Groups Projects
Unverified Commit 6a1c90a2 authored by Kali Kaneko's avatar Kali Kaneko Committed by meskio
Browse files

[feat] make vendor_init to create independent repo

this starts a stub for refactoring the authentication process, leading
to keep an external repo.
parent d641b7a6
No related branches found
No related tags found
No related merge requests found
......@@ -129,7 +129,16 @@ build_all_providers:
# packaging templates
#########################################################################
vendor_init:
@./branding/scripts/init
# TODO we should do the prepare step here, store it in VENDOR_PATH
vendor_check:
@./branding/scripts/check
# TODO move ca-check here
vendor: gen_providers_json
# TODO merge with prepare, after moving the gen_pkg to vendor_init
gen_providers_json:
@python3 branding/scripts/gen-providers-json.py branding/config/vendor.conf gui/providers/providers.json
......
Branding for BitmaskVPN
BitmaskVPN Branding Procedure
================================================================================
This folder contains everything that is needed to generate a customized built of
......@@ -8,9 +8,21 @@ the Desktop BitmaskVPN app for a given provider.
Configure
--------------------------------------------------------------------------------
* Copy or edit the file at 'branding/config/vendor.conf'. Add all the needed variables.
* Copy your provider CA certificate to the same folder: 'branding/config/<provider>-ca.crt'
* Make sure that the folder 'branding/assets/<provider>' exists. Copy there all the needed assets.
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
--------------------------------------------------------------------------------
......@@ -29,14 +41,16 @@ before the build. If you want to skip this check, pass `SKIP_CACHECK=yes`
Run::
PROVIDER=example make vendor
export VENDOR_PATH=../leapvpn-myprovider-pkg
make vendor
make prepare
Then you can build the binary::
./build.sh
make build
* The following does not work yet! in progress ------------------
* FIXME: the following does not work yet ---------------------
REFACTORING in progress ------------------------------------
Then you can build all the packages::
......
svg/icon.svg
ico/logo.ico
#!/usr/bin/env python3
if __name__ == "__main__":
print("[+] Checking your provider config... (WIP)")
#!/usr/bin/env python3
# (c) LEAP Encryption Access Project 2020
# License: GPL
import subprocess
import sys
import os
VENDOR_PATH = None
SCRIPT_NAME = sys.argv[0]
CA_README = "config/CERT.Readme"
ASSETS_README = "assets/FILES.Readme"
def initVendor():
global VENDOR_PATH
if not VENDOR_PATH:
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")
for d in ["config", "assets", "pkg"]:
os.makedirs(os.path.join(VENDOR_PATH, d))
initVendorConfig()
initGitRepo()
displayRepoInfo()
def displayRepoInfo():
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("[+] After doing that, you can run 'make vendor_check' to validate the configuration for your provider.")
def bail(msg=None):
if not msg:
print("ERROR: no arguments supported!")
print('Usage: {scriptname}'.format(
scriptname=SCRIPT_NAME))
else:
print(msg)
sys.exit(1)
def getVendorPath():
return os.environ.get('VENDOR_PATH')
def initVendorConfig():
with open(os.path.join(VENDOR_PATH, "config", "vendor.conf"), "w") as f:
f.write(CONF_TEMPLATE)
with open(os.path.join(VENDOR_PATH, CA_README), "w") as f:
f.write(CA_INFO)
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "ASSETS_LIST")) as f:
allAssets = f.read()
with open(os.path.join(VENDOR_PATH, ASSETS_README), "w") as f:
f.write(ASSETS_INFO)
f.write(allAssets)
def initGitRepo():
out = subprocess.run(['git', 'init'], cwd=VENDOR_PATH)
if out.returncode != 0:
print(f'ERROR: cannot initialize git repo in {VENDOR_PATH}')
CONF_TEMPLATE = """[default]
provider = myprovider
[myprovider]
name = MyProvider
applicationName = MyProviderVPN
binaryName = myprovider-vpn
providerURL = example.org
auth = anon
apiURL = https://api.myprovider.net/
caURL = https://myprovider.net/ca.crt
infoURL = https://myprovider.net/vpn
tosURL = https://myprovider.net/tos
helpURL = https://myprovider.net/support
geolocationAPI = https://myprovider.net:9001/json
askForDonations = true
donateURL = https://myprovider.net/vpn/donate
"""
CA_INFO = """Place in this folder your provider's CA certificate, with the name:
<providerName>-ca.crt
"""
ASSETS_INFO = """This is the list of assets that you MUST place in this folder for your provider:
"""
if __name__ == "__main__":
if len(sys.argv) != 1:
bail()
VENDOR_PATH = getVendorPath()
initVendor()
......@@ -32,4 +32,3 @@ def getProviderData(provider, config):
datetime.datetime.now())
return d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment