bundles/wireguard: support s2s connection to other services
This commit is contained in:
parent
ae14265abc
commit
104d1f11bf
3 changed files with 7 additions and 3 deletions
|
@ -253,7 +253,7 @@ def interface_ips(metadata):
|
|||
my_ip = '{}/31'.format(config['my_ip'])
|
||||
|
||||
ips = {my_ip}
|
||||
if snat_ip:
|
||||
if snat_ip and peer in repo.libs.s2s.WG_AUTOGEN_NODES:
|
||||
ips.add(snat_ip)
|
||||
|
||||
their_ip = config['their_ip']
|
||||
|
@ -289,12 +289,14 @@ def snat(metadata):
|
|||
forward.add(f'iifname wg_{config["iface"]} accept')
|
||||
forward.add(f'oifname wg_{config["iface"]} accept')
|
||||
|
||||
if snat_ip:
|
||||
if snat_ip and peer in repo.libs.s2s.WG_AUTOGEN_NODES:
|
||||
postrouting.add('ip saddr {} ip daddr != {} snat to {}'.format(
|
||||
config['my_ip'],
|
||||
config['their_ip'],
|
||||
snat_ip,
|
||||
))
|
||||
elif config.get('masquerade', False):
|
||||
postrouting.add(f'oifname wg_{peer} masquerade')
|
||||
|
||||
return {
|
||||
'nftables': {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue