aboutsummaryrefslogtreecommitdiff
path: root/roles/wireguard/templates
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
committerKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
commitbbe10895d9df8dd7899bbd65575d5bf12e57f8c8 (patch)
tree244d2f1ad38320863fb60f695c88c97799be1171 /roles/wireguard/templates
parent4d34de2f5e757bfeae5738547aabb61d3d28a2f8 (diff)
parentc85806e3289b5e207d51d382f8dc75edad04404d (diff)
Merge branch 'alpine' into 'master'
switched to alpine initial commit See merge request kdam0/vps!2
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 %}