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':
|
||||
raise DoNotRunAgain
|
||||
|
||||
rules = {
|
||||
'inet filter forward iif wg0 accept',
|
||||
'inet filter forward oif wg0 accept',
|
||||
}
|
||||
rules = set()
|
||||
for number, (peer, config) in enumerate(sorted(metadata.get('wireguard/peers', {}).items())):
|
||||
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:
|
||||
rules.add('nat postrouting ip saddr {} ip daddr != {} snat to {}'.format(
|
||||
config['my_ip'],
|
||||
|
|
Loading…
Reference in a new issue