#!/usr/bin/perl # Show all firewall rules require './ipfilter-lib.pl'; &ReadParse(); # Make sure the ipf command is installed $cmd = &missing_firewall_commands(); if ($cmd) { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1); &ui_print_endpage( &ui_config_link('index_ecmd', [ "$cmd", undef ])); } # Get the version number $vout = &backquote_command("$config{'ipf'} -V 2>&1"); if ($vout =~ /IP\s+Filter:\s+v?(\S+)/i) { $ipf_version = $1; } open(VERSION, ">$module_config_directory/version"); print VERSION $ipf_version,"\n"; close(VERSION); &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("ipf", "man", "doc", "google"), undef, undef, &text('index_version', $ipf_version)); # See if enabled at boot $atboot = &check_firewall_init(); # Get the saved and active rules $live = &get_live_config(); $rules = &get_config(); if (!-r $config{'ipf_conf'} && @$live) { # Offer to save existing rules print &text('index_existing', scalar(@$live), "$config{'ipf_conf'}"),"
\n"; print &ui_form_start("convert.cgi"); print "
\n"; print &ui_checkbox("atboot", 1, $text{'index_atboot'}, $atboot == 2),"\n"; print "
\n"; print "
| $text{'index_headerex'} |
";
foreach $dir ("i", "o") {
open(OUT, "$config{'ipfstat'} -$dir |");
while( |
";
}
else {
$mover .= "
";
}
else {
$mover .= "
";
}
$adder .= "".
"
";
$adder .= "".
"
";
local $active = $r->{'active'} ? $text{'yes'} :
"$text{'no'}";
$active = &ui_link("edit_rule.cgi?idx=$r->{'index'}", $active);
local $action = $text{'action_'.$r->{'action'}} ||
uc($r->{'action'});
$action = &ui_link("edit_rule.cgi?idx=$r->{'index'}", $action);
local $dir = $text{'dir_'.$r->{'dir'}};
$dir = &ui_link("edit_rule.cgi?idx=$r->{'index'}", $dir);
print &ui_checked_columns_row(
[ $active,
$action,
$dir,
$config{'view_condition'} ?
( &describe_rule($r) ) : ( ),
$config{'view_comment'} ?
( $r->{'cmt'} || "| ", &ui_submit($text{'index_delete'}, "delsel")," | \n"; print "", &ui_submit($text{'index_add2'}, "new")," | \n"; print "
";
}
else {
$mover .= "
";
}
else {
$mover .= "
";
}
local $active = $r->{'active'} ? $text{'yes'} :
"$text{'no'}";
$active = &ui_link("edit_nat.cgi?idx=$r->{'index'}",
$active);
local $action = $text{'action_'.$r->{'action'}} ||
uc($r->{'action'});
$action = &ui_link("edit_nat.cgi?idx=$r->{'index'}",
$action);
print &ui_columns_row(
[ &ui_checkbox("d", $r->{'index'}, "", 0),
$active,
$action,
$config{'view_condition'} ?
( &describe_from($r), &describe_to($r) ) : ( ),
$config{'view_comment'} ?
( $r->{'cmt'} || "| ", &ui_submit($text{'index_delete'}, "delsel")," | \n"; print "", &ui_submit($text{'index_add3'}, "newmap"),"\n", &ui_submit($text{'index_add4'}, "newrdr")," | \n"; print "
\n"; print "
| ", &ui_submit($text{'index_add3'}, "newmap"),"\n", &ui_submit($text{'index_add4'}, "newrdr")," | \n"; print "
\n"; print &ui_form_start("setup.cgi"); print &ui_hidden("reset", $in{'reset'}); print "
| \n";
print &ui_oneradio("auto", 0, $text{'index_auto0'}, 1)," \n"; foreach $a (1 .. 4) { print &ui_oneradio("auto", $a, $text{'index_auto'.$a}, 0)," ", &interface_choice("iface".$a, undef, 1)," \n"; } print " |
\n"; print &ui_checkbox("atboot", 1, $text{'index_atboot'}, $atboot == 2),"\n"; print "