Saltstack Official FirewallD Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 line
3.6KB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <zone{% if 'target' in zone %} target="{{ zone.target }}"{% endif %}>
  3. {% if 'short' in zone %}<short>{{ zone.short }}</short>{% else %}<short>{{ name }}</short>{% endif %}
  4. {% if 'description' in zone %}<description>{{ zone.description }}</description>{% endif %}
  5. {% if 'interfaces' in zone %}
  6. {% for v in zone.interfaces %}<interface name="{{ v }}" />{% endfor %}
  7. {% endif %}
  8. {% if 'sources' in zone %}
  9. {% for v in zone.sources %}<source name="{{ v }}" />{% endfor %}
  10. {% endif %}
  11. {% if 'services' in zone %}
  12. {% for v in zone.services %}<service name="{{ v }}" />{% endfor %}
  13. {% endif %}
  14. {% if 'ports' in zone %}
  15. {% for v in zone.ports %}
  16. {% if 'comment' in v %}
  17. <!-- {{ v.comment }} -->
  18. {% endif %}
  19. <port port="{{ v.port }}" protocol="{{ v.protocol }}"/>
  20. {% endfor %}
  21. {% endif %}
  22. {% if 'icmp_blocks' in zone %}
  23. {% for v in zone.icmp_blocks %}<icmp-block name="{{ v }}" />{% endfor %}
  24. {% endif %}
  25. {% if 'masquerade' in zone %}{% if zone.masquerade %}<masquerade/>{% endif %}{% endif %}
  26. {% if 'forward_ports' in zone %}
  27. {% for v in zone.forward_ports %}
  28. {% if 'comment' in v %}
  29. <!-- {{ v.comment }} -->
  30. {% endif %}
  31. <forward-port port="{{ v.portid }}" protocol="{{ v.protocol }}"{% if 'to_port' in v %} to-port="{{ v.to_port }}"{% endif %}{% if 'to_addr' in v %} to-addr="{{ v.to_addr }}"{% endif %} />
  32. {% endfor %}
  33. {% endif %}
  34. {% if 'rich_rules' in zone %}
  35. {% for rule in zone.rich_rules %}
  36. {% if 'family' in rule %}
  37. <rule family="{{ rule.family }}">
  38. {% else %}
  39. <rule>
  40. {% endif %}
  41. {% if 'source' in rule %}
  42. <source address="{{ rule.source.address }}" {% if 'invert' in rule.source %}invert="{{ rule.source.invert }}"{% endif %}/>
  43. {% endif %}
  44. {% if 'destination' in rule %}
  45. <destination address="{{ rule.destination.address }}" {% if 'invert' in rule.destination %}invert="{{ rule.destination.invert }}"{% endif %}/>
  46. {% endif %}
  47. {% if 'service' in rule %}
  48. <destination name="{{ rule.service }}"/>
  49. {% endif %}
  50. {% if 'port' in rule %}
  51. <port port="{{ rule.port.portid }}" protocol="{{ rule.port.protocol }}"/>
  52. {% endif %}
  53. {% if 'protocol' in rule %}
  54. <protocol value="{{ rule.protocol }}"/>
  55. {% endif %}
  56. {% if 'icmp_block' in rule %}
  57. <icmp_block name="{{ rule.icmp_block }}"/>
  58. {% endif %}
  59. {% if 'masquerade' in rule %}
  60. {% if rule.masquerade %}<masquerade/>{% endif %}
  61. {% endif %}
  62. {% if 'forward_port' in rule %}
  63. {% if 'comment' in rule.forward_port %}
  64. <!-- {{ rule.forward_port.comment }} -->
  65. {% endif %}
  66. <forward-port port="{{ rule.forward_port.portid }}" protocol="{{ rule.forward_port.protocol }}"{% if 'to_port' in rule.forward_port %} to-port="{{ rule.forward_port.to_port }}"{% endif %}{% if 'to_addr' in rule.forward_port %} to-addr="{{ rule.forward_port.to_addr }}"{% endif %} />
  67. {% endif %}
  68. {% if 'log' in rule %}
  69. <log{% if 'prefix' in rule.log %} prefix="{{ rule.log.prefix }}"{% endif %}{% if 'level' in rule.log %} level="{{ rule.log.level }}"{% endif %}>
  70. {% if 'limit' in rule.log %}
  71. <limit value="{{ rule.log.limit }}"/>
  72. {% endif %}
  73. </log>
  74. {% endif %}
  75. {% if 'audit' in rule %}
  76. <audit>{% if 'limit' in rule.audit %} <limit value="{{ rule.audit.limit }}"/>{% endif %}</audit>
  77. {% endif %}
  78. {% if 'accept' in rule %}
  79. <accept/>
  80. {% endif %}
  81. {% if 'reject' in rule %}
  82. <reject{% if 'type' in rule.reject %} type="{{ rule.reject.type }}"{% endif %}/>
  83. {% endif %}
  84. {% if 'drop' in rule %}
  85. <drop/>
  86. {% endif %}
  87. </rule>
  88. {% endfor %}
  89. {% endif %}
  90. </zone>