bundles/wireguard: fix forwarding firewall rules
This commit is contained in:
parent
c0ebd25ffc
commit
5179edb458
1 changed files with 4 additions and 5 deletions
|
@ -221,12 +221,11 @@ def snat(metadata):
|
||||||
if not node.has_bundle('nftables') or node.os == 'arch':
|
if not node.has_bundle('nftables') or node.os == 'arch':
|
||||||
raise DoNotRunAgain
|
raise DoNotRunAgain
|
||||||
|
|
||||||
rules = {
|
rules = set()
|
||||||
'inet filter forward iif wg0 accept',
|
for number, (peer, config) in enumerate(sorted(metadata.get('wireguard/peers', {}).items())):
|
||||||
'inet filter forward oif wg0 accept',
|
rules.add(f'inet filter forward iif wg{number} accept')
|
||||||
}
|
rules.add(f'inet filter forward oif wg{number} accept')
|
||||||
|
|
||||||
for config in metadata.get('wireguard/peers', {}).values():
|
|
||||||
if 'snat_to' in config:
|
if 'snat_to' in config:
|
||||||
rules.add('nat postrouting ip saddr {} ip daddr != {} snat to {}'.format(
|
rules.add('nat postrouting ip saddr {} ip daddr != {} snat to {}'.format(
|
||||||
config['my_ip'],
|
config['my_ip'],
|
||||||
|
|
Loading…
Reference in a new issue