Add wireguard interface setup script.
This commit is contained in:
parent
6d8c2d883d
commit
43dce8e7ba
|
|
@ -0,0 +1,35 @@
|
||||||
|
apt-get update
|
||||||
|
apt-get install wireguard-dkms wireguard-tools
|
||||||
|
|
||||||
|
|
||||||
|
LISTENPORT=51820
|
||||||
|
PEERPORT=52037
|
||||||
|
SAVECONFIG=true
|
||||||
|
ADDRESS="10.0.0.5/24"
|
||||||
|
PEER="tagmar.net"
|
||||||
|
ALLOWED="10.0.0.1/32"
|
||||||
|
PRIVATEKEY=$(wg genkey)
|
||||||
|
PUBLICKEY=$(echo ${PRIVATEKEY} | wg pubkey)
|
||||||
|
PEERPUBLIC="IUV3V1SwE1b+6HbJPoVg5XGrkSS8re3oV4JamDbmrC0="
|
||||||
|
|
||||||
|
(umask 077 && printf "[Interface]\nPrivateKey = " | sudo tee /etc/wireguard/wg0.conf > /dev/null)
|
||||||
|
wg genkey | sudo tee -a /etc/wireguard/wg0.conf | wg pubkey | sudo tee /etc/wireguard/publickey
|
||||||
|
|
||||||
|
echo > /etc/wireguard/wg0.conf<< "EOF"
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = ${PRIVATEKEY}
|
||||||
|
ListenPort = ${LISTENPORT}
|
||||||
|
SaveConfig = ${SAVECONFIG}
|
||||||
|
|
||||||
|
Address = ${ADDRESS}
|
||||||
|
|
||||||
|
|
||||||
|
[Peer]
|
||||||
|
PublicKey = ${PEERPUBLIC}
|
||||||
|
AllowedIPs = ${ALLOWED}
|
||||||
|
Endpoint = ${PEER}:${PEERPORT}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo ${PUBLICKEY} > /etc/wireguard/publickey
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue