Saltstack Official IPTables Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

v6_service.sls 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {% from "iptables/map.jinja" import defaults,schema,service with context %}
  2. {%- if service.v6.enabled %}
  3. iptables_packages_v6:
  4. pkg.installed:
  5. - names: {{ service.v6.pkgs }}
  6. iptables_modules_v6_load:
  7. kmod.present:
  8. - persist: true
  9. - mods: {{ service.v6.modules }}
  10. - require:
  11. - pkg: iptables_packages_v6
  12. {{ service.v6.persistent_config }}:
  13. file.managed:
  14. - user: root
  15. - group: root
  16. - mode: 640
  17. - source: salt://iptables/v{{ schema.epoch }}/files/v6_rules
  18. - template: jinja
  19. - require:
  20. - pkg: iptables_packages_v6
  21. {% if grains['os'] == 'Ubuntu' %}
  22. iptables_services_v6_start:
  23. cmd.run:
  24. - name: find /usr/share/netfilter-persistent/plugins.d/[0-9]*-ip6tables -exec {} start \;
  25. - onlyif: test $(ip6tables-save | wc -l) -eq 0
  26. - require:
  27. - file: {{ service.v6.persistent_config }}
  28. - kmod: iptables_modules_v6_load
  29. {%- endif %}
  30. {{ service.v6.service }}:
  31. service.running:
  32. - enable: true
  33. - require:
  34. - file: {{ service.v6.persistent_config }}
  35. - kmod: iptables_modules_v6_load
  36. - watch:
  37. - file: {{ service.v6.persistent_config }}
  38. iptables_tables_cleanup_v6:
  39. module.wait:
  40. - name: iptables_extra.remove_stale_tables
  41. - config_file: {{ service.v6.persistent_config }}
  42. - family: ipv6
  43. - require:
  44. - file: {{ service.v6.persistent_config }}
  45. - watch:
  46. - file: {{ service.v6.persistent_config }}
  47. {%- else %}
  48. {% if grains['os'] == 'Ubuntu' %}
  49. iptables_services_v6_stop:
  50. cmd.run:
  51. - name: find /usr/share/netfilter-persistent/plugins.d/[0-9]*-ip6tables -exec {} flush \;
  52. - onlyif: test $(which ip6tables-save) -eq 0 && test $(ip6tables-save | wc -l) -ne 0
  53. {{ service.v6.persistent_config }}:
  54. file.absent:
  55. - require:
  56. - cmd: iptables_services_v6_stop
  57. iptables_tables_flush_v6:
  58. module.wait:
  59. - name: iptables_extra.flush_all
  60. - family: ipv6
  61. - watch:
  62. - file: {{ service.v6.persistent_config }}
  63. {%- endif %}
  64. {%- endif %}