fix iptables rule

This commit is contained in:
Kirigaya Kazuto 2022-01-26 15:04:47 +00:00
parent ea89859850
commit 811e81f126

View File

@ -48,7 +48,8 @@ for line in content:
elif line.startswith('#enable-forward'): elif line.startswith('#enable-forward'):
results.append('PostUp=sysctl net.ipv4.ip_forward=1') results.append('PostUp=sysctl net.ipv4.ip_forward=1')
elif line.startswith('#iptables-forward'): elif line.startswith('#iptables-forward'):
results.append('PostUp=iptables -A FORWARD -i {} -j ACCEPT') results.append('PostUp=iptables -A FORWARD -i {} -j ACCEPT'.format(wg_name))
gen_ctx['post_down'].append('PostDown=iptables -D FORWARD -i {} -j ACCEPT'.format(wg_name))
elif line.startswith('#udp2raw-server'): elif line.startswith('#udp2raw-server'):
parts = line.split(' ')[1:] parts = line.split(' ')[1:]
tunnel_name = parts[0] tunnel_name = parts[0]