bundles/wireguard: add option to set settings based on a specific peer
This commit is contained in:
parent
0084257872
commit
ffb5125ddd
3 changed files with 10 additions and 0 deletions
|
@ -14,4 +14,6 @@ PresharedKey=${psk}
|
||||||
% if endpoint:
|
% if endpoint:
|
||||||
Endpoint=${endpoint}
|
Endpoint=${endpoint}
|
||||||
% endif
|
% endif
|
||||||
|
% if specials.get('persistent_keepalive', True):
|
||||||
PersistentKeepalive=30
|
PersistentKeepalive=30
|
||||||
|
% endif
|
||||||
|
|
|
@ -27,6 +27,7 @@ for peer, config in sorted(node.metadata.get('wireguard/peers', {}).items()):
|
||||||
'privatekey': node.metadata.get('wireguard/privatekey'),
|
'privatekey': node.metadata.get('wireguard/privatekey'),
|
||||||
'psk': config['psk'],
|
'psk': config['psk'],
|
||||||
'pubkey': config['pubkey'],
|
'pubkey': config['pubkey'],
|
||||||
|
'specials': repo.libs.s2s.WG_AUTOGEN_SETTINGS.get(peer, {}),
|
||||||
},
|
},
|
||||||
'needs': deps,
|
'needs': deps,
|
||||||
'triggers': {
|
'triggers': {
|
||||||
|
|
|
@ -20,6 +20,13 @@ WG_AUTOGEN_NODES = [
|
||||||
'daisy',
|
'daisy',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
WG_AUTOGEN_SETTINGS = {
|
||||||
|
# special settings to apply when peering with a specific node
|
||||||
|
'home.router': {
|
||||||
|
'persistent_keepalive': False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
def get_subnet_for_connection(repo, peer_a, peer_b):
|
def get_subnet_for_connection(repo, peer_a, peer_b):
|
||||||
assert peer_a in WG_AUTOGEN_NODES
|
assert peer_a in WG_AUTOGEN_NODES
|
||||||
assert peer_b in WG_AUTOGEN_NODES
|
assert peer_b in WG_AUTOGEN_NODES
|
||||||
|
|
Loading…
Reference in a new issue