In this case we are the client and we cannot leak any local subnets.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
iptables -A INPUT -i wg+ -j WGBLOCK
iptables -A FORWARD -i wg+ -j WGBLOCK
+ # NAT for WireGuard peers
+ iptables -t nat -N WGNAT
+ iptables -t nat -A POSTROUTING -j WGNAT
+
# Block OpenVPN transfer networks
iptables -N OVPNBLOCK
iptables -A INPUT -i tun+ -j OVPNBLOCK
# Assign the local address
if [ -n "${local_address}" ]; then
ip addr add "${local_address}" dev "${intf}"
+
+ # Apply MASQUERADE
+ iptables -t nat -A WGNAT -o "${intf}" -j MASQUERADE
fi
echo "[Interface]"
reload_firewall() {
# Flush all previous rules
iptables -F WGINPUT
+ iptables -t nat -F WGNAT
if [ "${ENABLED}" = "on" ]; then
iptables -A WGINPUT -p udp --dport "${PORT}" -j ACCEPT