Slight reordering/cleanup

This commit is contained in:
Matt Low 2021-01-01 09:10:11 -07:00
parent 79a2d1124b
commit 696976c52d

View File

@ -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