rules.v4.j2 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # This file is managed by ansible, don't make changes here - they will be overwritten.
  2. *filter
  3. :INPUT ACCEPT [0:0]
  4. :FORWARD ACCEPT [0:0]
  5. :OUTPUT ACCEPT [0:0]
  6. COMMIT
  7. *nat
  8. :PREROUTING ACCEPT [0:0]
  9. :INPUT ACCEPT [0:0]
  10. :OUTPUT ACCEPT [0:0]
  11. :POSTROUTING ACCEPT [0:0]
  12. {% if ffrl_tun is defined and ffrl_nat_ip is defined %}
  13. -A POSTROUTING -o tun-ffrl+ -j SNAT --to-source {{ffrl_nat_ip | ipaddr('address')}}
  14. {% endif %}
  15. {% if ffnw_tun is defined %}
  16. -A POSTROUTING -o tun-ffnw+ -j SNAT --to-source {{ffnw_nat_ip| ipaddr('address')}}
  17. {% endif %}
  18. {% if ffnw_tun is not defined and ffrl_tun is not defined %}
  19. -A POSTROUTING -o gre+ -p tcp -m tcp --dport 53 -j SNAT --to-source 10.0.0.{{vm_id}}
  20. -A POSTROUTING -o gre+ -p udp -m udp --dport 53 -j SNAT --to-source 10.0.0.{{vm_id}}
  21. {% endif %}
  22. COMMIT
  23. *mangle
  24. :PREROUTING ACCEPT [0:0]
  25. :INPUT ACCEPT [0:0]
  26. :FORWARD ACCEPT [0:0]
  27. :OUTPUT ACCEPT [0:0]
  28. -N DNS
  29. -A OUTPUT -p udp -m udp --dport 53 -j DNS
  30. -A OUTPUT -p tcp -m tcp --dport 53 -j DNS
  31. {% if 'dienste' in groups %}
  32. {% for host in groups['dienste'] %}
  33. {% if hostvars[host].inventory_hostname_short == "dnsmaster" %}
  34. -A DNS -d {{hostvars[host].ansible_ssh_host}}/32 -j RETURN
  35. {% endif %}
  36. {% endfor %}
  37. {% endif %}
  38. {% if v4dnsips is defined %}
  39. {% for entry in v4dnsips %}
  40. -A DNS -d {{entry}}/32 -j RETURN
  41. {% endfor %}
  42. {% endif %}
  43. -A DNS -j MARK --set-mark 0x1
  44. -A DNS -j RETURN
  45. :POSTROUTING ACCEPT [0:0]
  46. {% if ffrl_tun is defined or ffnw_tun is defined %}
  47. -A POSTROUTING -o tun-+ -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss ! --mss 0:1240 -j TCPMSS --set-mss 1240
  48. {% endif %}
  49. COMMIT