#!/bin/sh # Nico Schottelius # 2020-11-19 if [ $# -lt 4 ]; then echo "$0 ip-address vpn-server ipv6-network [privatekey]" echo " ip-address: where to find the OpenWRT device" echo " vpn-server: where to connect to" echo " vpn-server-pubkey: public key of the server" echo " ipv6-network: which network to use for us (/48 expected)" echo " private-key: specify wireguard key optionally" exit 1 fi my_ip=$1; shift vpn_endpoint_host=$1; shift vpn_endpoint_pubkey=$1; shift network=$1; shift # wireguard if [ $# -eq 1 ]; then private_key=$1; shift else private_key=$(wg genkey) fi my_prefix=$(echo $network | sed 's,::/.*,,') my_wireguard_ip=${my_prefix}::42 public_key=$(echo $private_key | wg pubkey) cat <