Saltstack Official FirewallD Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

113 行
3.9KB

  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 %}
  7. <interface name="{{ v }}" />
  8. {%- endfor %}
  9. {%- endif %}
  10. {%- if 'sources' in zone %}
  11. {%- for v in zone.sources %}
  12. {%- if 'comment' in v %}
  13. <!-- {{ v.comment }} -->
  14. <source address="{{ v.source }}" />
  15. {%- else %}
  16. <source address="{{ v }}" />
  17. {%- endif %}
  18. {%- endfor %}
  19. {%- endif %}
  20. {%- if 'services' in zone %}
  21. {%- for v in zone.services %}
  22. <service name="{{ v }}" />
  23. {%- endfor %}
  24. {%- endif %}
  25. {%- if 'ports' in zone %}
  26. {%- for v in zone.ports %}
  27. {%- if 'comment' in v %}
  28. <!-- {{ v.comment }} -->
  29. {%- endif %}
  30. <port port="{{ v.port }}" protocol="{{ v.protocol }}"/>
  31. {%- endfor %}
  32. {%- endif %}
  33. {%- if 'icmp_blocks' in zone %}
  34. {%- for v in zone.icmp_blocks %}
  35. <icmp-block name="{{ v }}" />
  36. {%- endfor %}
  37. {%- endif %}
  38. {%- if 'masquerade' in zone %}
  39. {%- if zone.masquerade %}
  40. <masquerade/>
  41. {%- endif %}
  42. {%- endif %}
  43. {%- if 'forward_ports' in zone %}
  44. {%- for v in zone.forward_ports %}
  45. {%- if 'comment' in v %}
  46. <!-- {{ v.comment }} -->
  47. {%- endif %}
  48. <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 %} />
  49. {%- endfor %}
  50. {%- endif %}
  51. {%- if 'rich_rules' in zone %}
  52. {%- for rule in zone.rich_rules %}
  53. {%- if 'family' in rule %}
  54. <rule family="{{ rule.family }}">
  55. {%- else %}
  56. <rule>
  57. {%- endif %}
  58. {%- if 'ipset' in rule %}
  59. <source ipset="{{ rule.ipset.name }}"/>
  60. {%- endif %}
  61. {%- if 'source' in rule %}
  62. <source address="{{ rule.source.address }}" {%- if 'invert' in rule.source %}invert="{{ rule.source.invert }}"{%- endif %}/>
  63. {%- endif %}
  64. {%- if 'destination' in rule %}
  65. <destination address="{{ rule.destination.address }}" {%- if 'invert' in rule.destination %}invert="{{ rule.destination.invert }}"{%- endif %}/>
  66. {%- endif %}
  67. {%- if 'service' in rule %}
  68. <service name="{{ rule.service }}"/>
  69. {%- endif %}
  70. {%- if 'port' in rule %}
  71. <port port="{{ rule.port.portid }}" protocol="{{ rule.port.protocol }}"/>
  72. {%- endif %}
  73. {%- if 'protocol' in rule %}
  74. <protocol value="{{ rule.protocol }}"/>
  75. {%- endif %}
  76. {%- if 'icmp_block' in rule %}
  77. <icmp_block name="{{ rule.icmp_block }}"/>
  78. {%- endif %}
  79. {%- if 'masquerade' in rule %}
  80. {%- if rule.masquerade %}<masquerade/>{%- endif %}
  81. {%- endif %}
  82. {%- if 'forward_port' in rule %}
  83. {%- if 'comment' in rule.forward_port %}
  84. <!-- {{ rule.forward_port.comment }} -->
  85. {%- endif %}
  86. <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 %} />
  87. {%- endif %}
  88. {%- if 'log' in rule %}
  89. <log{%- if 'prefix' in rule.log %} prefix="{{ rule.log.prefix }}"{%- endif %}{%- if 'level' in rule.log %} level="{{ rule.log.level }}"{%- endif %}>
  90. {%- if 'limit' in rule.log %}
  91. <limit value="{{ rule.log.limit }}"/>
  92. {%- endif %}
  93. </log>
  94. {%- endif %}
  95. {%- if 'audit' in rule %}
  96. <audit>{%- if 'limit' in rule.audit %} <limit value="{{ rule.audit.limit }}"/>{%- endif %}</audit>
  97. {%- endif %}
  98. {%- if 'accept' in rule %}
  99. <accept/>
  100. {%- endif %}
  101. {%- if 'reject' in rule %}
  102. <reject{%- if 'type' in rule.reject %} type="{{ rule.reject.type }}"{%- endif %}/>
  103. {%- endif %}
  104. {%- if 'drop' in rule %}
  105. <drop/>
  106. {%- endif %}
  107. </rule>
  108. {%- endfor %}
  109. {%- endif %}
  110. </zone>