diff --git a/api/wireguard_manager.py b/api/wireguard_manager.py index e5c14c0..7e59f71 100644 --- a/api/wireguard_manager.py +++ b/api/wireguard_manager.py @@ -183,13 +183,11 @@ class WireGuardManager(BaseServiceManager): f'PostUp = iptables -A FORWARD -i %i -j DROP; ' f'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ' f'{hairpin}' - f'{dnat_up}; ' - f'sysctl -q net.ipv4.conf.all.rp_filter=0 || true\n' + f'{dnat_up}\n' f'PostDown = iptables -D FORWARD -i %i -j DROP 2>/dev/null || true; ' f'iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE 2>/dev/null || true; ' f'{hairpin_down}' - f'{dnat_down}; ' - f'sysctl -q net.ipv4.conf.all.rp_filter=1 || true\n' + f'{dnat_down}\n' ) @staticmethod diff --git a/scripts/setup_cell.py b/scripts/setup_cell.py index ca2a5f8..af07a04 100644 --- a/scripts/setup_cell.py +++ b/scripts/setup_cell.py @@ -147,11 +147,9 @@ def write_wg0_conf(private_key: str, address: str, port: int): f'Address = {address}\n' f'ListenPort = {port}\n' f'PostUp = iptables -A FORWARD -i %i -j ACCEPT; ' - f'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ' - f'sysctl -q net.ipv4.conf.all.rp_filter=0\n' + f'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\n' f'PostDown = iptables -D FORWARD -i %i -j ACCEPT; ' - f'iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ' - f'sysctl -q net.ipv4.conf.all.rp_filter=1\n' + f'iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE\n' ) with open(wg_conf, 'w') as f: f.write(content)