summaryrefslogtreecommitdiff
path: root/roles/configure_iptables/templates/iptables.rules
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2021-07-28 01:12:10 +0200
committerNiklas Yann Wettengel <niyawe@niyawe.de>2021-07-28 01:12:10 +0200
commit9ec1670a262597356c24bff27d473eccceb45b61 (patch)
tree8d94c1ab62fef270ea45a103be179609272b3f82 /roles/configure_iptables/templates/iptables.rules
parentf394fd81667a44e267e83d3c453101598a21c58c (diff)
wg
Diffstat (limited to 'roles/configure_iptables/templates/iptables.rules')
-rw-r--r--roles/configure_iptables/templates/iptables.rules25
1 files changed, 9 insertions, 16 deletions
diff --git a/roles/configure_iptables/templates/iptables.rules b/roles/configure_iptables/templates/iptables.rules
index 704d519..2508445 100644
--- a/roles/configure_iptables/templates/iptables.rules
+++ b/roles/configure_iptables/templates/iptables.rules
@@ -10,7 +10,7 @@
{% endfor %}
{% endif %}
-{% if 'fastd' in group_names or 'wg' in group_names %}
+{% if 'fastd' in group_names %}
{% for peer in groups['uplink'] %}
-A PREROUTING -i bb{{ hostvars[peer]['wireguard_bb_name'] }} -j MARK --set-xmark 0x1/0xffffffff
{% endfor %}
@@ -19,9 +19,6 @@
{% for peer in groups['fastd'] %}
-A PREROUTING -i bb{{ hostvars[peer]['wireguard_bb_name'] }} -j MARK --set-xmark 0x1/0xffffffff
{% endfor %}
-{% for peer in groups['wg'] %}
--A PREROUTING -i bb{{ hostvars[peer]['wireguard_bb_name'] }} -j MARK --set-xmark 0x1/0xffffffff
-{% endfor %}
{% for peer in groups['uplink'] | difference([inventory_hostname]) %}
-A PREROUTING -i bb{{ hostvars[peer]['wireguard_bb_name'] }} -j MARK --set-xmark 0x1/0xffffffff
{% endfor %}
@@ -44,7 +41,7 @@ COMMIT
-A INPUT -p tcp -m tcp -s 10.30.0.0/18 --dport 5201 -j ACCEPT
-A INPUT -p tcp -m tcp -s 10.222.0.0/16 --dport 5201 -j ACCEPT
-{% if 'fastd' in group_names or 'wg' in group_names %}
+{% if 'fastd' in group_names %}
# dns
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
@@ -54,18 +51,14 @@ COMMIT
{% endfor %}
# ntp
-A INPUT -p udp -m udp --dport 123 -j ACCEPT
-{% endif %}
-{% if 'fastd' in group_names %}
-# fastd
+# fastd / wg
-A INPUT -s 10.30.0.0/18 -p udp -m udp --dport 10010:10023 -j DROP
-A INPUT -s 10.222.0.0/16 -p udp -m udp --dport 10010:10023 -j DROP
-A INPUT -p udp -m udp --dport 10010:10023 -j ACCEPT
-{% endif %}
-{% if 'wg' in group_names %}
-# wg
--A INPUT -s 10.30.0.0/18 -p udp -m udp --dport 10000 -j DROP
--A INPUT -s 10.222.0.0/16 -p udp -m udp --dport 10000 -j DROP
--A INPUT -p udp -m udp --dport 10000 -j ACCEPT
+# wireguard_mesh
+{% for site in sites %}
+-A INPUT -p udp -m udp --dport {{ site.wireguard_mesh_port }} -j ACCEPT
+{% endfor %}
{% endif %}
# MOSH
-A INPUT -p udp -m udp --dport 60000:61000 -j ACCEPT
@@ -83,9 +76,9 @@ COMMIT
-A INPUT -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped input: " --log-level 4
-{% if 'fastd' in group_names or 'wg' in group_names %}
+{% if 'fastd' in group_names %}
{% for site in sites %}
--A FORWARD -i bat{{ site.name }} -p udp --dport 10010:10021 -j REJECT
+-A FORWARD -i bat{{ site.name }} -p udp --dport 10010:10023 -j REJECT
{% endfor %}
{% endif %}
-A FORWARD -o {{ ansible_default_ipv4.interface }} -j REJECT