system-config/modules/iptables/manifests/init.pp
Clark Boylan a54bdc86b0 Add ipv6 functionality to iptables module.
Rackspace nova cloud supports ipv6. Add ip6tables support to the
iptables module so that we can take advantage of ipv6 on this cloud
platform.

Change-Id: I628b7c71ff486a925cdb3d44277cca0d6ae7c985
Reviewed-on: https://review.openstack.org/14315
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2012-10-11 21:20:08 +00:00

60 lines
1.8 KiB
Puppet

#http://projects.puppetlabs.com/projects/1/wiki/Module_Iptables_Patterns
class iptables($rules='', $public_tcp_ports=[], $public_udp_ports=[]) {
package { 'iptables-persistent':
ensure => present,
}
service { 'iptables-persistent':
require => Package['iptables-persistent'],
# Because there is no running process for this service, the normal status
# checks fail. Because puppet then thinks the service has been manually
# stopped, it won't restart it. This fake status command will trick puppet
# into thinking the service is *always* running (which in a way it is, as
# iptables is part of the kernel.)
hasstatus => true,
status => true,
# Under Debian, the "restart" parameter does not reload the rules, so tell
# Puppet to fall back to stop/start, which does work.
hasrestart => false,
}
file { '/etc/iptables':
ensure => directory,
}
file { '/etc/iptables/rules':
owner => 'root',
group => 'root',
mode => '0640',
content => template('iptables/rules.erb'),
require => [Package['iptables-persistent'], File['/etc/iptables']],
# When this file is updated, make sure the rules get reloaded.
notify => Service['iptables-persistent'],
}
file { '/etc/iptables/rules.v4':
ensure => link,
owner => 'root',
group => 'root',
mode => '0640',
target => '/etc/iptables/rules',
require => File['/etc/iptables/rules'],
notify => Service['iptables-persistent'],
}
file { '/etc/iptables/rules.v6':
owner => 'root',
group => 'root',
mode => '0640',
content => template('iptables/rules.v6.erb'),
require => [Package['iptables-persistent'], File['/etc/iptables']],
# When this file is updated, make sure the rules get reloaded.
notify => Service['iptables-persistent'],
replace => true,
}
}