homelab/roles/wireguard/templates/wg0.conf.j2

12 lines
457 B
Django/Jinja

[Interface]
PrivateKey = {{ private_key.content | b64decode }}
Address = {{ address }}
ListenPort = {{ listen_port }}
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o {{ interface }} -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o {{ interface }} -j MASQUERADE
{% for peer in peers %}
[Peer]
PublicKey = {{ peer.public_key }}
AllowedIPs = {{ peer.allowed_ips }}
{% endfor %}