#!/bin/sh # Copyright (c) 2020 TorGuard forum user 19807409 # import script related functions source tgfunctions LOGFILE="tginit" AUTHOR="TorGuard forum user 19807409" # Each server in a string must be provided by server and port "server:port" and separated by space "srv1:1234 srv2:5678" TGSERVERLIST="${17}" # TorGuard Server List separated by space, "srv1:1234 srv2:5678" # TorGuard credentials VPNUSERNAME="${1}" # TorGuard VPN username VPNPASS="${2}" # TorGuard VPN password WGINTERFACE="${3}" # Wireguard interface name, default: tgwg WGIFNR="${4}" # Wireguard interface number, default 0 NOHOSTROUTE="${5}" # Optional. Do not create host routes to peers, default 0 LISTENPORT="${6}" # Optional. UDP port used for outgoing and incoming packets. MTU="${7}" # Optional. Maximum Transmission Unit of tunnel interface. # Optional. 32-bit mark for outgoing encrypted packets. Enter value in hex, starting with 0x. Default: 0xFE if [ -z ${8+x} ]; then echo "FWMARK was not submited, using dummy value 0xFE" FWMARK="0xFE"; else FWMARK="${8}"; fi KEEPALIVE="${9}" # Optional. Seconds between keep alive messages. Default is 0 (disabled). Recommended value if this device is behind a NAT is 25. USEBUILTINIPV6="${10}" # Use builtin IPv6-management 0 to disable, 1 to enable ROUTEALLOWEDIPS="${11}" # Route allowed IPs, 0 to disable, 1 to enable FIREWALLZONE="${12}" # Assign firewall-zone, 1 is wan, 0 is lan, default: 1 TGPRIVKEY="${13}" # this is your peers wireguard private key, if not passed/empty, new keypairs will be generated # create torguard api server test script with current settings TGAPITEST="${14}" # TorGuard API test/fix script, default: /usr/bin/tgapitest LOOPWAITTIME="${15}" # TorGuard API fix timeout, default: 1m SERVICEFILE="${16}" # TorGuard API test/fix service file: /etc/init.d/tgapi if [[ $ENABLELOGGING == 1 ]]; then # logInitVars && logCleanupOldLogFolder && initLogFiles && logInitVars && initLogFiles tgInitMainRun | tee -a ${LOGFILEDIR}/${LOGFILE}/${LOGFILE}.${LOGEXT} else tgInitMainRun fi