From 5ec7d9ba3e0b2d6a55e5030f643fd4f90593fccf Mon Sep 17 00:00:00 2001 From: Niklas Yann Wettengel Date: Sun, 16 Jul 2017 13:45:10 +0200 Subject: [PATCH] route changes --- .../templates/ip6tables.rules | 17 +++++++++++++++-- .../configure_iptables/templates/iptables.rules | 8 ++++++-- .../files/ffmyk-iproute.sh | 11 +---------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/roles/configure_iptables/templates/ip6tables.rules b/roles/configure_iptables/templates/ip6tables.rules index 3ae179f..5b7a49c 100644 --- a/roles/configure_iptables/templates/ip6tables.rules +++ b/roles/configure_iptables/templates/ip6tables.rules @@ -1,6 +1,19 @@ +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +{% for site in sites %} +-A PREROUTING -i bat{{ site.name }} -j MARK --set-xmark 0x1/0xffffffff +{% endfor %} +{% for peer in wireguard_bb_peers %} +-A PREROUTING -i bb{{ peer.name }} ! -s fe80::/64 ! -d fe80::/64 -j MARK --set-xmark 0x1/0xffffffff +{% endfor %} +COMMIT *filter :INPUT DROP [0:0] -:FORWARD DROP [0:0] +:FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT @@ -33,5 +46,5 @@ {% for site in sites %} -A FORWARD -i bat{{ site.name }} -p udp --dport 10010:10021 -j REJECT {% endfor %} --A FORWARD -m limit --limit 2/min -j LOG --log-prefix "IP6Tables-Dropped forward: " --log-level 4 +-A FORWARD -o {{ ansible_default_ipv6.interface }} -j REJECT COMMIT diff --git a/roles/configure_iptables/templates/iptables.rules b/roles/configure_iptables/templates/iptables.rules index 363958d..6da350c 100644 --- a/roles/configure_iptables/templates/iptables.rules +++ b/roles/configure_iptables/templates/iptables.rules @@ -7,10 +7,13 @@ {% for site in sites %} -A PREROUTING -i bat{{ site.name }} -j MARK --set-xmark 0x1/0xffffffff {% endfor %} +{% for peer in wireguard_bb_peers %} +-A PREROUTING -i bb{{ peer.name }} -j MARK --set-xmark 0x1/0xffffffff +{% endfor %} COMMIT *filter :INPUT DROP [0:0] -:FORWARD DROP [0:0] +:FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -s 127.0.0.1/32 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT @@ -36,11 +39,12 @@ COMMIT {% for site in sites %} -A FORWARD -i bat{{ site.name }} -p udp --dport 10010:10021 -j REJECT {% endfor %} --A FORWARD -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped forward: " --log-level 4 +-A FORWARD -o {{ ansible_default_ipv4.interface }} -j REJECT COMMIT *nat :PREROUTING ACCEPT [0:0] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] +-A POSTROUTING -o mullvad -j MASQUERADE COMMIT diff --git a/roles/configure_static_routes/files/ffmyk-iproute.sh b/roles/configure_static_routes/files/ffmyk-iproute.sh index 13a9dea..391d88f 100755 --- a/roles/configure_static_routes/files/ffmyk-iproute.sh +++ b/roles/configure_static_routes/files/ffmyk-iproute.sh @@ -1,17 +1,8 @@ #!/bin/bash -ip -4 rule add to 10.0.0.0/8 type unreachable priority 200 -ip -4 rule add from 10.0.0.0/8 type unreachable priority 200 -ip -4 rule add to 192.168.0.0/16 type unreachable priority 200 -ip -4 rule add from 192.168.0.0/16 type unreachable priority 200 -ip -4 rule add to 172.16.0.0/12 type unreachable priority 200 -ip -4 rule add from 172.16.0.0/12 type unreachable priority 200 -ip -6 rule add from fc00::/7 type unreachable priority 200 -ip -6 rule add to fc00::/7 type unreachable priority 200 - #Alles, was mit 0x1 markiert wird gehört zu Tabelle ffmyk ip -4 rule add from all fwmark 0x1 table ffmyk priority 10 ip -6 rule add from all fwmark 0x1 table ffmyk priority 10 - + #Alles mit Freifunk-IP - woher auch immer - gehört zu Tabelle ffmyk #ip -4 rule add from 10.222.0.0/16 table ffmyk #ip -6 rule add from 2001:470:cd45:FF00::/56 table ffmyk