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
This commit is contained in:
Clark Boylan 2012-10-10 15:29:03 -07:00 committed by Jenkins
parent 16ba76b01d
commit a54bdc86b0
2 changed files with 49 additions and 16 deletions

View File

@ -32,7 +32,6 @@ class iptables($rules='', $public_tcp_ports=[], $public_udp_ports=[]) {
mode => '0640', mode => '0640',
content => template('iptables/rules.erb'), content => template('iptables/rules.erb'),
require => [Package['iptables-persistent'], File['/etc/iptables']], require => [Package['iptables-persistent'], File['/etc/iptables']],
# When this file is updated, make sure the rules get reloaded. # When this file is updated, make sure the rules get reloaded.
notify => Service['iptables-persistent'], notify => Service['iptables-persistent'],
} }
@ -47,4 +46,14 @@ class iptables($rules='', $public_tcp_ports=[], $public_udp_ports=[]) {
notify => Service['iptables-persistent'], 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,
}
} }

View File

@ -0,0 +1,24 @@
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:openstack-INPUT - [0:0]
-A INPUT -j openstack-INPUT
-A FORWARD -j openstack-INPUT
-A openstack-INPUT -i lo -j ACCEPT
-A openstack-INPUT -p icmpv6 -j ACCEPT
-A openstack-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# SSH from anywhere
-A openstack-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
# Public TCP ports
<% public_tcp_ports.each do |port| -%>
-A openstack-INPUT -m state --state NEW -m tcp -p tcp --dport <%= port %> -j ACCEPT
<% end -%>
# Public UDP ports
<% public_udp_ports.each do |port| -%>
-A openstack-INPUT -m udp -p udp --dport <%= port %> -j ACCEPT
<% end -%>
# Per-host rules
<%= rules %>
-A openstack-INPUT -j REJECT --reject-with icmp6-adm-prohibited
COMMIT