#!/bin/bash # enable ip forward echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf sysctl -p # install wireguard, wireguard-tools and curl sudo apt-get update && sudo apt-get install -y wireguard wireguard-tools curl conf="/root/conf" server="$conf/server" user="$conf/user" # create dir for configs && set umask mkdir -p $server && mkdir $user && umask 077 $conf # create server keys wg genkey | tee $server/privatekey | wg pubkey > $server/publickey priv=`cat $server/privatekey` pub=`cat $server/publickey` # create user keys wg genkey | tee $user/privatekey | wg pubkey > $user/publickey upriv=`cat $user/privatekey` upub=`cat $user/publickey` # get server ip ip=`curl ifconfig.me` # generate server config cat > $server/wg0.conf < $user/user.conf <