move .conf files to EOF inside script
This commit is contained in:
@@ -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
|
||||
17
install.sh
17
install.sh
@@ -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
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
net.ipv4.ip_forward=1
|
||||
net.ipv6.conf.all.forwarding=1
|
||||
8
wg0.conf
8
wg0.conf
@@ -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 =
|
||||
Reference in New Issue
Block a user