Saltstack Official FirewallD Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

105 rindas
3.7KB

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