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.

128 lines
4.3KB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. This file is managed/generated by salt.
  4. Do not edit this file manually, it will be overwritten!
  5. Modify the salt pillar for firewalld instead
  6. -->
  7. <zone{%- if 'target' in zone %} target="{{ zone.target }}"{%- endif %}>
  8. {% if 'short' in zone %}<short>{{ zone.short }}</short>{% else %}<short>{{ name }}</short>{% endif %}
  9. {% if 'description' in zone %}<description>{{ zone.description }}</description>{% endif %}
  10. {%- if 'interfaces' in zone %}
  11. {%- for v in zone.interfaces %}
  12. <interface name="{{ v }}" />
  13. {%- endfor %}
  14. {%- endif %}
  15. {%- if 'sources' in zone %}
  16. {%- for v in zone.sources %}
  17. {%- if 'comment' in v %}
  18. <!-- {{ v.comment }} -->
  19. <source address="{{ v.source }}" />
  20. {%- else %}
  21. <source address="{{ v }}" />
  22. {%- endif %}
  23. {%- endfor %}
  24. {%- endif %}
  25. {%- if 'ipsets' in zone %}
  26. {%- for v in zone.ipsets %}
  27. {%- if 'comment' in v %}
  28. <!-- {{ v.comment }} -->
  29. <source ipset="{{ v.ipset }}" />
  30. {%- else %}
  31. <source ipset="{{ v }}" />
  32. {%- endif %}
  33. {%- endfor %}
  34. {%- endif %}
  35. {%- if 'services' in zone %}
  36. {%- for v in zone.services %}
  37. <service name="{{ v }}" />
  38. {%- endfor %}
  39. {%- endif %}
  40. {%- if 'ports' in zone %}
  41. {%- for v in zone.ports %}
  42. {%- if 'comment' in v %}
  43. <!-- {{ v.comment }} -->
  44. {%- endif %}
  45. <port port="{{ v.port }}" protocol="{{ v.protocol }}"/>
  46. {%- endfor %}
  47. {%- endif %}
  48. {%- if 'icmp_blocks' in zone %}
  49. {%- for v in zone.icmp_blocks %}
  50. <icmp-block name="{{ v }}" />
  51. {%- endfor %}
  52. {%- endif %}
  53. {%- if 'masquerade' in zone %}
  54. {%- if zone.masquerade %}
  55. <masquerade/>
  56. {%- endif %}
  57. {%- endif %}
  58. {%- if 'forward_ports' in zone %}
  59. {%- for v in zone.forward_ports %}
  60. {%- if 'comment' in v %}
  61. <!-- {{ v.comment }} -->
  62. {%- endif %}
  63. <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 %} />
  64. {%- endfor %}
  65. {%- endif %}
  66. {%- if 'rich_rules' in zone %}
  67. {%- for rule in zone.rich_rules %}
  68. {%- if 'family' in rule %}
  69. <rule family="{{ rule.family }}">
  70. {%- else %}
  71. <rule>
  72. {%- endif %}
  73. {%- if 'ipset' in rule %}
  74. <source ipset="{{ rule.ipset.name }}"/>
  75. {%- endif %}
  76. {%- if 'source' in rule %}
  77. <source address="{{ rule.source.address }}" {%- if 'invert' in rule.source %}invert="{{ rule.source.invert }}"{%- endif %}/>
  78. {%- endif %}
  79. {%- if 'destination' in rule %}
  80. <destination address="{{ rule.destination.address }}" {%- if 'invert' in rule.destination %}invert="{{ rule.destination.invert }}"{%- endif %}/>
  81. {%- endif %}
  82. {%- if 'service' in rule %}
  83. <service name="{{ rule.service }}"/>
  84. {%- endif %}
  85. {%- if 'port' in rule %}
  86. <port port="{{ rule.port.portid }}" protocol="{{ rule.port.protocol }}"/>
  87. {%- endif %}
  88. {%- if 'protocol' in rule %}
  89. <protocol value="{{ rule.protocol }}"/>
  90. {%- endif %}
  91. {%- if 'icmp_block' in rule %}
  92. <icmp_block name="{{ rule.icmp_block }}"/>
  93. {%- endif %}
  94. {%- if 'masquerade' in rule %}
  95. {%- if rule.masquerade %}<masquerade/>{%- endif %}
  96. {%- endif %}
  97. {%- if 'forward_port' in rule %}
  98. {%- if 'comment' in rule.forward_port %}
  99. <!-- {{ rule.forward_port.comment }} -->
  100. {%- endif %}
  101. <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 %} />
  102. {%- endif %}
  103. {%- if 'log' in rule %}
  104. <log{%- if 'prefix' in rule.log %} prefix="{{ rule.log.prefix }}"{%- endif %}{%- if 'level' in rule.log %} level="{{ rule.log.level }}"{%- endif %}>
  105. {%- if 'limit' in rule.log %}
  106. <limit value="{{ rule.log.limit }}"/>
  107. {%- endif %}
  108. </log>
  109. {%- endif %}
  110. {%- if 'audit' in rule %}
  111. <audit>{%- if 'limit' in rule.audit %} <limit value="{{ rule.audit.limit }}"/>{%- endif %}</audit>
  112. {%- endif %}
  113. {%- if 'accept' in rule %}
  114. <accept/>
  115. {%- endif %}
  116. {%- if 'reject' in rule %}
  117. <reject{%- if 'type' in rule.reject %} type="{{ rule.reject.type }}"{%- endif %}/>
  118. {%- endif %}
  119. {%- if 'drop' in rule %}
  120. <drop/>
  121. {%- endif %}
  122. </rule>
  123. {%- endfor %}
  124. {%- endif %}
  125. </zone>