Files
homeserver/infra/ansible/roles/configure-wireguard/templates/wg0.conf.j2
Taqi Tahmid d9b3ceff6b
All checks were successful
ci/woodpecker/push/demo-workflow Pipeline was successful
update infra and portfolio deployment
2025-08-23 09:25:23 +03:00

26 lines
782 B
Django/Jinja

[Interface]
Address = {{ wg_address }}
ListenPort = {{ wg_port }}
PrivateKey = {{ wg_private_key_content }}
{% if wg_dns is defined %}
DNS = {{ wg_dns }}
{% endif %}
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
SaveConfig = true
{% for peer in wg_peers %}
[Peer]
PublicKey = {{ peer.public_key }}
{% if peer.preshared_key is defined %}
PresharedKey = {{ peer.preshared_key }}
{% endif %}
AllowedIPs = {{ peer.allowed_ips }}
{% if peer.endpoint is defined %}
Endpoint = {{ peer.endpoint }}
{% endif %}
{% if peer.persistent_keepalive is defined %}
PersistentKeepalive = {{ peer.persistent_keepalive }}
{% endif %}
{% endfor %}