puppet rule to create an empty ferm chain
[mirror/dsa-puppet.git] / modules / ferm / manifests / rule / chain.pp
1 # Create an (empty) chain
2 #
3 # @param domain netfilter domain: ip (IPv4), ip6 (IPv6), or both.
4 # @param table  netfilter table
5 # @param chain  netfilter chain
6 # @param description a description of the rule
7 # @param prio   Priority/Order of the rule
8 define ferm::rule::chain (
9   String $chain,
10   String $description = '',
11   Variant[Enum['ip', 'ip6'], Array[Enum['ip', 'ip6']]] $domain = ['ip', 'ip6'],
12   String $table = 'filter',
13   String $prio = '10',
14 ) {
15   include ferm
16
17   $real_domain = Array($domain, true)
18
19   file {
20     "/etc/ferm/dsa.d/${prio}_${name}":
21       ensure  => 'present',
22       mode    => '0400',
23       notify  => Exec['ferm reload'],
24       content => inline_template( @(EOF) ),
25                     domain (<%= @real_domain.join(' ') %>) {
26                       table <%= @table %> {
27                         chain <% @chain %> {}
28                       }
29                     }
30                     | EOF
31   }
32 }