move .conf files to EOF inside script

This commit is contained in:
ducoterra
2019-12-30 09:30:18 -05:00
parent 1e17c09de2
commit 33b993a0d8
4 changed files with 15 additions and 21 deletions

View File

@@ -1,9 +0,0 @@
[Interface]
PrivateKey =
Address = 10.10.0.<?>/32, fd86:ea04:1111::<?>/128
DNS = 3.14.3.2,3.14.3.3
[Peer]
PublicKey =
Endpoint = wireguard.ducoterra.net:51820
AllowedIPs = 0.0.0.0/0, ::/0

View File

@@ -9,13 +9,26 @@ printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --a
apt update
apt install -y wireguard qrencode
cp sysctl.conf /etc/sysctl.conf
cp wg0.conf /etc/wireguard/wg0.conf
cat > /etc/sysctl.conf <<EOF
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
EOF
cd /etc/wireguard
umask 077
export PRIVKEY=$(wg genkey)
echo $PRIVKEY | tee privatekey | wg pubkey | tee publickey
echo $PRIVKEY | tee --append /etc/wireguard/wg0.conf
cat > /etc/wireguard/wg0.conf <<EOF
[Interface]
Address = 10.10.0.1/24
Address = fd86:ea04:1111::1/64
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ens3 -j MASQUERADE
ListenPort = 51820
PrivateKey = $PRIVKEY
EOF
sysctl -p
wg-quick up wg0

View File

@@ -1,2 +0,0 @@
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

View File

@@ -1,8 +0,0 @@
[Interface]
Address = 10.10.0.1/24
Address = fd86:ea04:1111::1/64
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ens3 -j MASQUERADE
ListenPort = 51820
PrivateKey =