#!/bin/bash set -eux ip_address="$1"; shift vpn_ip_address="$1"; shift # configure the motd. # NB this was generated at http://patorjk.com/software/taag/#p=display&f=Big&t=WireGuard. # it could also be generated with figlet.org. cat >/etc/motd <<'EOF' __ ___ _____ _ \ \ / (_) / ____| | | \ \ /\ / / _ _ __ ___| | __ _ _ __ _ _ __ __| | \ \/ \/ / | | '__/ _ \ | |_ | | | |/ _` | '__/ _` | \ /\ / | | | | __/ |__| | |_| | (_| | | | (_| | \/ \/ |_|_| \___|\_____|\__,_|\__,_|_| \__,_| EOF # install wireguard. # see https://www.wireguard.com/install/ apt-get install -y wireguard # create the configuration file. # see https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8 umask 077 wg genkey >"$(hostname).key" cat >/etc/wireguard/wg0.conf <>"/vagrant/wg-conf/wg-peer-$(hostname).conf" <