mirror of
https://github.com/speatzle/nfsense.git
synced 2025-09-13 15:19:08 +00:00
Add Wireguard Config Generation
This commit is contained in:
parent
a67911df67
commit
7545e2fcbb
3 changed files with 69 additions and 7 deletions
24
internal/networkd/template/create-wireguard.netdev.tmpl
Normal file
24
internal/networkd/template/create-wireguard.netdev.tmpl
Normal file
|
@ -0,0 +1,24 @@
|
|||
[NetDev]
|
||||
Name={{ $.Name }}
|
||||
Kind=wireguard
|
||||
|
||||
{{- $intertface := index $.Config.VPN.Wireguard.Interfaces .Name }}
|
||||
|
||||
[WireGuard]
|
||||
ListenPort={{ $intertface.ListenPort }}
|
||||
PrivateKey={{ $intertface.PrivateKey }}
|
||||
|
||||
{{ range $i, $peerName := $intertface.Peers }}
|
||||
{{- $peer := index $.Config.VPN.Wireguard.Peers $peerName }}
|
||||
[WireGuardPeer]
|
||||
PublicKey={{ $peer.PublicKey }}
|
||||
{{- if ne $peer.PresharedKey nil }}
|
||||
PresharedKey={{ $peer.PresharedKey }}
|
||||
{{- end }}
|
||||
{{range $i, $allowedIpName := $peer.AllowedIPs }}
|
||||
AllowedIPs={{ getAddressObjectsAsCidr $.Config $allowedIpName}}
|
||||
{{- end }}
|
||||
{{- if ne $peer.Endpoint nil }}
|
||||
Endpoint={{ $peer.Endpoint }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Loading…
Add table
Add a link
Reference in a new issue