rules.v4.j2 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Generated by Ansible
  2. *mangle
  3. :PREROUTING ACCEPT [0:0]
  4. :INPUT ACCEPT [0:0]
  5. :FORWARD ACCEPT [0:0]
  6. :OUTPUT ACCEPT [0:0]
  7. :POSTROUTING ACCEPT [0:0]
  8. # MSS clamping
  9. {% if peers is defined %}{%for peer in peers %}
  10. -A POSTROUTING -o {{ peer.name }} -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1280
  11. {%endfor%}{% endif %}
  12. COMMIT
  13. *nat
  14. :PREROUTING ACCEPT [0:0]
  15. :INPUT ACCEPT [0:0]
  16. :OUTPUT ACCEPT [0:0]
  17. :POSTROUTING ACCEPT [0:0]
  18. # NAT
  19. {% if nat_ipv4 is defined and peers is defined %}{%for peer in peers %}
  20. -A POSTROUTING -s {{ ipv4_network }} -o {{ peer.name }} -j SNAT --to-source {{ nat_ipv4|ipaddr('address') }}
  21. {%endfor%}{% endif %}
  22. COMMIT
  23. *filter
  24. :INPUT ACCEPT [0:0]
  25. :FORWARD ACCEPT [0:0]
  26. :OUTPUT ACCEPT [0:0]
  27. # Drop bogus
  28. -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -j DROP
  29. -A INPUT -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP
  30. # Fastd over mesh verbieten
  31. -A INPUT -s {{ ipv4_network }} -p udp -m udp --dport 10000 -m limit --limit 2/sec -j LOG --log-prefix "fastd over mesh: "
  32. -A INPUT -s {{ ipv4_network }} -p udp -m udp --dport 10000 -j REJECT --reject-with icmp-admin-prohibited
  33. # Drop invalid
  34. -A FORWARD -m state --state INVALID -j DROP
  35. # Fastd over mesh verbieten
  36. -A FORWARD -s {{ ipv4_network }} -p udp -m udp --dport 10000 -m limit --limit 2/sec -j LOG --log-prefix "fastd over mesh: "
  37. -A FORWARD -s {{ ipv4_network }} -p udp -m udp --dport 10000 -j REJECT --reject-with icmp-admin-prohibited
  38. COMMIT