#!/bin/sh # 2021-04-27 echo BUG: cannot use more than one due to port assignment echo All WG IPv4 have same source port if [ $# -lt 2 ]; then echo "$0 host ipv4-address interface [private-key]" echo " host: where to find the OpenWRT device" echo " ipv4-address: which ipv4 address to use" echo " private-key: Use this wireguard key instead of generating one" exit 1 fi my_ip=$1; shift my_wireguard_ip=$1; shift if [ $# -eq 1 ]; then private_key=$1; shift else private_key=$(wg genkey) fi public_key=$(echo $private_key | wg pubkey) case $my_wireguard_ip in 185.155.29.*) vpn_endpoint_pubkey="6BRnQ+dmeFzVCH9RbM1pbJ7u3y3qrl+zUzzYCmC88kE=" ;; 185.155.30.*) vpn_endpoint_pubkey="5ach7pUQ57aa402LHz1MYh7lyBZS0GvBEw2PC6dMHW4=" ;; *) echo "Unknown VPN host for IP $my_wireguard_ip" >&2 exit 1 ;; esac interface="ip$(echo $my_wireguard_ip | awk -F. '{ print $1 $2 $3 $4 }')" vpn_endpoint_host=vpn-$(echo $my_wireguard_ip | awk -F. '{ print $1 $2 $3 }').ungleich.ch cat <