Skip to content
Snippets Groups Projects
rule.erb 538 B
Newer Older
Adam Lewenberg's avatar
Adam Lewenberg committed
<%# Generic iptables rule template used by iptables::rule. -%>
# <%= name %><% if description != '' then %> -- <%= description %><% end %>
<% [port].flatten.each do |pt|               -%>
<%   p = (pt != '') ? '--dport ' + pt : ''   -%>
<%   [source].flatten.each do |src|          -%>
<%     [protocol].flatten.each do |pr|       -%>
<%       syn = (pr == 'tcp') ? ' --syn' : '' -%>
<%       s = (src != '') ? ' -s ' + src : '' -%>
-A INPUT<%= s %> -p <%= pr %> <%= p %><%= syn %> -j <%= target %>
<%     end -%>
<%   end -%>
<% end -%>