2 # Deal with redhat's /etc/sysconfig/iptables save file and startup script
5 # Returns an error message if something is wrong with iptables on this system
8 if (!-r "/etc/rc.d/init.d/iptables") {
9 return &text('redhat_escript', "<tt>/etc/rc.d/init.d/iptables</tt>");
11 if (!$config{'done_check_iptables'}) {
12 local $out = `/etc/rc.d/init.d/iptables status 2>&1`;
13 if ($out !~ /table:|INPUT|FORWARD|OUTPUT/) {
14 return &text('redhat_eoutput',
15 "<tt>/etc/init.d/iptables status</tt>");
17 $config{'done_check_iptables'} = 1;
18 &save_module_config();
23 $iptables_save_file = "/etc/sysconfig/iptables";
26 # Applies the current iptables configuration from the save file
29 #local $out = &backquote_logged("cd / ; /etc/rc.d/init.d/iptables restart 2>&1");
30 #$out =~ s/\033[^m]+m//g;
31 #return $? || $out =~ /FAILED/ ? "<pre>$out</pre>" : undef;
35 # Writes the current iptables configuration to the save file
38 $out = &backquote_logged("cd / ; /etc/rc.d/init.d/iptables save 2>&1 </dev/null");
39 $out =~ s/\033[^m]+m//g;
40 return $? || $out =~ /FAILED/ ? "<pre>$out</pre>" : undef;
46 &foreign_require("init", "init-lib.pl");
47 return &init::action_status("iptables") == 2;
52 &foreign_require("init", "init-lib.pl");
53 &init::enable_at_boot("iptables"); # Assumes init script exists
58 &foreign_require("init", "init-lib.pl");
59 &init::disable_at_boot("iptables");