bundles/wireguard: use one wireguard connection per peer instead of one for all
This commit is contained in:
parent
8110ec508e
commit
902840ee7f
5 changed files with 110 additions and 94 deletions
17
bundles/wireguard/files/wg.netdev
Normal file
17
bundles/wireguard/files/wg.netdev
Normal file
|
@ -0,0 +1,17 @@
|
|||
[NetDev]
|
||||
Name=wg${number}
|
||||
Kind=wireguard
|
||||
Description=WireGuard connection to ${peer}
|
||||
|
||||
[WireGuard]
|
||||
PrivateKey=${privatekey}
|
||||
ListenPort=${port}
|
||||
|
||||
[WireGuardPeer]
|
||||
PublicKey=${pubkey}
|
||||
AllowedIPs=0.0.0.0/0
|
||||
PresharedKey=${psk}
|
||||
% if endpoint:
|
||||
Endpoint=${endpoint}
|
||||
% endif
|
||||
PersistentKeepalive=30
|
|
@ -1,25 +0,0 @@
|
|||
[NetDev]
|
||||
Name=wg0
|
||||
Kind=wireguard
|
||||
Description=WireGuard server
|
||||
|
||||
[WireGuard]
|
||||
PrivateKey=${privatekey}
|
||||
ListenPort=51820
|
||||
|
||||
% for peer, config in sorted(peers.items()):
|
||||
# Peer ${peer}
|
||||
[WireGuardPeer]
|
||||
PublicKey=${config['pubkey']}
|
||||
% if len(peers) == 1: # FIXME
|
||||
AllowedIPs=${network}
|
||||
% else:
|
||||
AllowedIPs=${','.join(sorted(config['ips']))}
|
||||
% endif
|
||||
PresharedKey=${config['psk']}
|
||||
% if 'endpoint' in config:
|
||||
Endpoint=${config['endpoint']}
|
||||
% endif
|
||||
PersistentKeepalive=30
|
||||
|
||||
% endfor
|
Loading…
Add table
Add a link
Reference in a new issue