aboutsummaryrefslogtreecommitdiff
path: root/roles/wireguard/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/wireguard/templates')
-rw-r--r--roles/wireguard/templates/wg0.conf.j27
1 files changed, 4 insertions, 3 deletions
diff --git a/roles/wireguard/templates/wg0.conf.j2 b/roles/wireguard/templates/wg0.conf.j2
index 6e7bcc1..5201c32 100644
--- a/roles/wireguard/templates/wg0.conf.j2
+++ b/roles/wireguard/templates/wg0.conf.j2
@@ -1,12 +1,13 @@
# {{ ansible_managed }}
[Interface]
+{% if ansible_os_family == "Debian" %}
Address = {{ wireguard_server_ip }}
+{% endif %}
ListenPort = {{ wireguard_server_listen_port }}
PrivateKey = {{ wireguard_server_priv_key }}
-PostUp = iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT
-PostUp = iptables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-PostDown = iptables -w -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -w -t nat -D POSTROUTING -o eth0 -j MASQUERADE
+PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;iptables -A FORWARD -o %i -j ACCEPT
+PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;iptables -D FORWARD -o %i -j ACCEPT
{% for peer in wireguard_peers %}