Log port openings properly

This commit is contained in:
Jamie Cameron
2011-08-13 12:52:16 -07:00
parent d804e52d30
commit 94b99d74a9
2 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,9 @@ elsif ($type eq "chain") {
elsif ($type eq "host" || $type eq "group") {
return &text("log_${action}_${type}", "<tt>$object</tt>");
}
elsif ($action eq "openports") {
return &text('log_openports', join(" ", split(/\0/, $p->{'ports'})));
}
else {
return $text{"log_$action"};
}

View File

@ -114,9 +114,9 @@ PORT: foreach $p (@ARGV) {
if (@added) {
# Added some rules .. save them
&run_before_command();
&unlock_file($iptables_save_file);
&save_table($filter);
&lock_file($iptables_save_file);
&save_table($filter);
&unlock_file($iptables_save_file);
&run_after_command();
&copy_to_cluster();
print STDERR "Opened ports ",join(" ", @added),"\n";
@ -133,10 +133,10 @@ if (@added) {
print "Applied configuration successfully\n";
}
}
&webmin_log("openports");
&webmin_log("openports", undef, undef, { 'ports' => \@added });
exit($ex);
}
else {
print STDERR "Add ports are already open\n";
print STDERR "All ports are already open\n";
exit(0);
}