[viirb2] allow to inject private key

This commit is contained in:
Nico Schottelius 2020-10-12 21:17:05 +02:00
parent 0875392098
commit dbe77a6792

View file

@ -3,9 +3,10 @@
# See https://ungleich.ch/u/products/viirb-ipv6-box/
if [ $# -ne 2 ]; then
echo "$0 viirb-ip-address viirb-id"
echo "$0 viirb-ip-address viirb-id [wgprivkey]"
echo " viirb-ip-address: where to find the viirb"
echo " viirb-id: number in decimal format"
echo " wgprivkey: if specified, use this private key"
exit 1
fi
@ -25,7 +26,11 @@ my_lan_ip=${my_prefix}:cafe::42
my_wifi_ip=${my_prefix}:7ea::42
# wireguard
private_key=$(wg genkey)
if [ $# -eq 1 ]; then
private_key=$1; shift
else
private_key=$(wg genkey)
fi
public_key=$(echo $private_key | wg pubkey)
vpn_endpoint_host=vpn-2a0ae5c1300.ungleich.ch