tlu/salt/states/wireguard/files/interface.conf.template

15 lines
673 B
Plaintext
Raw Normal View History

2021-10-12 13:00:09 +00:00
[Interface]
Address = {{ pillar['wireguard']['address'] }}
PrivateKey = {{ pillar['wireguard']['privatekey'] }}
ListenPort = {{ pillar['wireguard']['port'] }}
2021-10-17 11:55:21 +00:00
PostUp = iptables -A FORWARD -i {{ pillar['wireguard']['iface'] }} -j ACCEPT; iptables -t nat -A POSTROUTING -o {{ pillar['network']['interface'] }} -j MASQUERADE
PostDOWN = iptables -D FORWARD -i {{ pillar['wireguard']['iface'] }} -j ACCEPT; iptables -t nat -D POSTROUTING -o {{ pillar['network']['interface'] }} -j MASQUERADE
2021-10-12 13:00:09 +00:00
{% for peer in pillar['wireguard']['peers'] -%}
[peer]
PublicKey = {{ peer['publickey'] }}
PresharedKey = {{ peer['presharedkey'] }}
AllowedIPs = {{ peer['allowedips'] }}
{% endfor %}