Slight reordering/cleanup
This commit is contained in:
parent
79a2d1124b
commit
696976c52d
10
vpnerator.sh
10
vpnerator.sh
@ -90,7 +90,7 @@ ssh -T ${HOST} /bin/bash << END
|
||||
# include SERVER_LIB
|
||||
${SERVER_LIB}
|
||||
|
||||
# Install depends
|
||||
# Check/install depends
|
||||
deps || exit 1
|
||||
|
||||
# Cleanup previous tunnel
|
||||
@ -102,9 +102,6 @@ if [ "\$?" -eq 2 ] ; then
|
||||
fi
|
||||
|
||||
umask 0177
|
||||
|
||||
exec_sudo ip link add "${INTERFACE_NAME}" type wireguard
|
||||
|
||||
TMP=\$(mktemp)
|
||||
cat << EOF > \${TMP}
|
||||
[Interface]
|
||||
@ -118,11 +115,10 @@ PresharedKey = ${PSK}
|
||||
AllowedIPs = ${CLIENT_ADDR}
|
||||
EOF
|
||||
|
||||
exec_sudo ip link add "${INTERFACE_NAME}" type wireguard
|
||||
exec_sudo wg setconf "${INTERFACE_NAME}" "\${TMP}"
|
||||
rm "\${TMP}"
|
||||
|
||||
enable_forwarding
|
||||
|
||||
exec_sudo ip addr add "${SERVER_ADDR}" dev "${INTERFACE_NAME}"
|
||||
exec_sudo ip link set mtu 1420 up dev "${INTERFACE_NAME}"
|
||||
|
||||
@ -130,6 +126,8 @@ exec_sudo iptables -A FORWARD -i "${INTERFACE_NAME}" -j ACCEPT
|
||||
exec_sudo iptables -A FORWARD -o "${INTERFACE_NAME}" -j ACCEPT
|
||||
exec_sudo iptables -t nat -A POSTROUTING -s "${CLIENT_ADDR}" -o "\${DEFAULT_IFACE}" -j MASQUERADE
|
||||
|
||||
enable_forwarding
|
||||
|
||||
echo
|
||||
sudo wg show "$INTERFACE_NAME"
|
||||
END
|
||||
|
Loading…
Reference in New Issue
Block a user