net/peers_update

38 lines
954 B
Bash

#!/bin/sh
###########################################################################
#
# $0 - No args
#
# This is alpha software. Use/test/please to be making fix, if applicable.
# Bug reports to ubergeek@thunix.net
#
###########################################################################
PEERS_SRC="https://tildegit.org/tildeverse/net/raw/branch/master/peers.txt"
TMP_PEERS="/tmp/peers.txt"
# This file contains your private key. It should be in a secure location"
HEADER_SRC="/root/wg_header"
# You can point this direct to your wg-conf, or you can cron something else. Your call
WG_CONF="/etc/wireguard/wg0.conf"
curl "$PEERS_SRC" > "$TMP_PEERS"
cat "$HEADER_SRC" "$TMP_PEERS" > "$WG_CONF"
# Clean up our mess.
rm "$TMP_PEERS"
# Uncomment the below, and adjust it to your interface names...
# wg-quick down wg-p2p
# wg-quick up wg-p2p
# We need this to activate the tunnel
ping -c 1 10.0.0.1
ping -c 1 10.0.0.5
ping -c 1 10.0.0.65