From 53e827ba43aefbd4e9399c2a5900b88247b15f39 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 14 Jun 2020 23:09:06 +0200 Subject: [PATCH] viirb: script to fully configure --- viirb-configure-fully-after-upgrade.sh | 199 +++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100755 viirb-configure-fully-after-upgrade.sh diff --git a/viirb-configure-fully-after-upgrade.sh b/viirb-configure-fully-after-upgrade.sh new file mode 100755 index 0000000..bd86c25 --- /dev/null +++ b/viirb-configure-fully-after-upgrade.sh @@ -0,0 +1,199 @@ +#!/bin/sh +# 2020-06-13, Nico Schottelius +# See https://ungleich.ch/u/products/viirb-ipv6-box/ + +if [ $# -ne 2 ]; then + echo "$0 viirb-ip-address viirb-id" + echo " viirb-ip-address: where to find the viirb" + echo " viirb-id: number in decimal format" + exit 1 +fi + + +set -x +viirb_ip=$1; shift +id=$1; shift +hex_id=$(printf "%0.2x\n" "$id") +viirb_hostname=viirb${id} + +prefix_base=2a0a:e5c1:3 +my_prefix=${prefix_base}${hex_id} +my_network=${my_prefix}::/48 + +my_wireguard_ip=${my_prefix}::42 +my_lan_ip=${my_prefix}:cafe::42 +my_wifi_ip=${my_prefix}:7ea::42 + +# wireguard +private_key=$(wg genkey) +public_key=$(echo $private_key | wg pubkey) + +vpn_endpoint_host=vpn-2a0ae5c1300.ungleich.ch +vpn_endpoint_pubkey=ft68G2RID7gZ6PXjFCSCOdJ9yspRg+tUw0YrNK9cTxE= + +cat < ${viirb_hostname}.public_key