Skip to content

Commit cdcafae

Browse files
committed
Add header and trailer to rule-files
1 parent 0ae5dcf commit cdcafae

File tree

1 file changed

+34
-0
lines changed
  • modules/iptables/manifests

1 file changed

+34
-0
lines changed

modules/iptables/manifests/ng.pp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
) {
4848

49+
$chains_header = $chains.map |$chain,$policy| { sprintf(":%s %s [0:0]", $chain, $policy) }
50+
4951
$enforce_command = '/usr/local/sbin/enforce-iptables'
5052
file { 'enforce-command':
5153
path => $enforce_command,
@@ -74,6 +76,22 @@
7476
notify => Exec['enforce-puppet-iptables'],
7577
}
7678

79+
concat::fragment { '00-ipv4-header'
80+
target => $ipv4file,
81+
order => 0,
82+
content => ([
83+
'*filter'
84+
] + $chains_header).join('\n'),
85+
}
86+
87+
concat::fragment { '99-ipv4-trailer'
88+
target => $ipv4file,
89+
order => 9999,
90+
content => [
91+
'COMMIT'
92+
].join('\n'),
93+
}
94+
7795
exec { 'enforce-puppet-iptables':
7896
command => "/usr/bin/echo ${enforce_command} ipv4 '${ipv4file}'",
7997
refreshonly => true,
@@ -108,6 +126,22 @@
108126
notify => Exec['enforce-puppet-ip6tables'],
109127
}
110128

129+
concat::fragment { '00-ipv6-header'
130+
target => $ipv6file,
131+
order => 0,
132+
content => ([
133+
'*filter'
134+
] + $chains_header).join('\n'),
135+
}
136+
137+
concat::fragment { '99-ipv6-trailer'
138+
target => $ipv6file,
139+
order => 9999,
140+
content => [
141+
'COMMIT',
142+
].join('\n'),
143+
}
144+
111145
exec { 'enforce-puppet-ip6tables':
112146
command => "/usr/bin/echo ${enforce_command} ipv6 '${ipv6file}'",
113147
refreshonly => true,

0 commit comments

Comments
 (0)