Skip to content

Commit

Permalink
Merge branch 'COOK-580'
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Jun 8, 2011
2 parents 13cb62d + c8ceaad commit 9a66631
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion iptables/files/default/rebuild-iptables
Expand Up @@ -6,6 +6,7 @@ our $ID = q$Id: rebuild-iptables 344 2006-10-04 02:48:30Z digant $;
#
# Written by Russ Allbery <rra@stanford.edu>
# Adapted by Digant C Kasundra <digant@stanford.edu>
# Adapted by Joe Williams (2011) <joe@joetify.com>
# Copyright 2005, 2006 Board of Trustees, Leland Stanford Jr. University
#
# Constructs an iptables rules file from the prefix, standard, and suffix
Expand Down Expand Up @@ -130,7 +131,8 @@ sub install_debian {
or die "$0: cannot mkdir /etc/iptables: $!\n";
}
write_iptables( "/etc/iptables/general", @data );
system("/sbin/iptables-restore < /etc/iptables/general");
system("/sbin/iptables-restore < /etc/iptables/general") == 0
or die "rebuild-iptables: iptables-restore failed! - $?"
}

##############################################################################
Expand Down
13 changes: 13 additions & 0 deletions iptables/recipes/default.rb
Expand Up @@ -33,5 +33,18 @@
mode 0755
end

case node[:platform]
when "redhat", "centos"
iptables_save_file = "/etc/sysconfig/iptables"
when "ubuntu", "debian"
iptables_save_file = "/etc/iptables/general"
end

template "/etc/network/if-pre-up.d/iptables_load" do
source "iptables_load.erb"
mode 0755
variables :iptables_save_file => iptables_save_file
end

iptables_rule "all_established"
iptables_rule "all_icmp"
3 changes: 3 additions & 0 deletions iptables/templates/default/iptables_load.erb
@@ -0,0 +1,3 @@
#!/bin/sh
/sbin/iptables-restore < <%= @iptables_save_file %>
exit 0

0 comments on commit 9a66631

Please sign in to comment.