mirror of
https://github.com/webmin/webmin.git
synced 2026-02-17 04:02:15 +00:00
Merge branch 'master' of git@github.com:webmin/webmin
This commit is contained in:
@@ -59,7 +59,7 @@ download_envs=<tt>Makefile.PL</tt> environment variables
|
||||
download_name=Name
|
||||
download_value=Value
|
||||
download_emodname=No module to install was entered
|
||||
download_need=Fetching Missing Pre-Requesites
|
||||
download_need=Fetching Missing Pre-Requisites
|
||||
download_missing=Missing $1 modules
|
||||
download_nomissing=All installed
|
||||
download_ebuild=One or more of the Perl modules needs $1 to be built, but this Perl module is not installed.
|
||||
|
||||
@@ -21,62 +21,60 @@ else {
|
||||
$in{'idx'} = $group->{'index'};
|
||||
}
|
||||
}
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
|
||||
print "<form action=save_group.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<input type=hidden name=from value='$in{'from'}'>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'group_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_form_start("save_group.cgi", "post");
|
||||
print &ui_hidden("new", $in{'new'});
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_hidden("from", $in{'from'});
|
||||
print &ui_table_start($text{'group_header'}, undef, 2);
|
||||
|
||||
print "<tr> <td><b>$text{'group_name'}</b></td>\n";
|
||||
printf "<td><input name=name size=20 value='%s'></td> </tr>\n",
|
||||
$group->{'name'};
|
||||
print &ui_table_row($text{'group_name'},
|
||||
&ui_textbox("name", $group->{'name'}, 20) );
|
||||
|
||||
print "<tr> <td valign=top><b>$text{'group_members'}</b></td>\n";
|
||||
print "<td><table>\n";
|
||||
my $tx = "";
|
||||
$tx .= &ui_columns_start(undef);
|
||||
$i = 0;
|
||||
foreach $m (( grep { !/\!?\@/ } @{$group->{'members'}} ),
|
||||
$blank, $blank, $blank, $blank, $blank, $blank) {
|
||||
$neg = ($m =~ s/^\!//);
|
||||
print "<input name=member_$i size=40 value='$m'>\n";
|
||||
print "<input type=checkbox name=neg_$i value=! ",
|
||||
$neg ? "checked" : "","> $text{'group_neg'}<br>\n";
|
||||
my @cols;
|
||||
push(@cols, &ui_textbox("member_".$i, $m, 40) );
|
||||
push(@cols, &ui_checkbox("neg_".$i, "!", $text{'group_neg'}, ($neg ? 1 : 0 ) ) );
|
||||
$tx .= &ui_columns_row(\@cols);
|
||||
$i++;
|
||||
}
|
||||
print "</table>\n";
|
||||
print "<input type=checkbox name=resolv value=1> $text{'group_resolv'}\n";
|
||||
print "</td> </tr>\n";
|
||||
$tx .= &ui_columns_row([ &ui_checkbox("resolv", 1, $text{'group_resolv'}) ], ["colspan=2"]);
|
||||
$tx .= ui_columns_end();
|
||||
|
||||
print &ui_table_row($text{'group_members'}, $tx);
|
||||
|
||||
# Show member groups
|
||||
print "<tr> <td valign=top><b>$text{'group_members2'}</b></td>\n";
|
||||
print "<td><table>\n";
|
||||
$i = 0;
|
||||
$tx = &ui_columns_start(undef);
|
||||
foreach $m (( grep { /\!?\@/ } @{$group->{'members'}} ),
|
||||
$blank, $blank, $blank, $blank, $blank, $blank) {
|
||||
$neg = ($m =~ s/^\!//);
|
||||
$m =~ s/^\@//;
|
||||
print "<tr> <td>\n";
|
||||
print &group_input("group_$i", $m, 1);
|
||||
print "</td> </tr>\n";
|
||||
$tx .= &ui_columns_row([&group_input("group_$i", $m, 1)]);
|
||||
$i++;
|
||||
}
|
||||
print "</table></td> </tr>\n";
|
||||
$tx .= ui_columns_end();
|
||||
print &ui_table_row($text{'group_members2'}, $tx);
|
||||
|
||||
print &ui_table_end();
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
if ($in{'new'}) {
|
||||
print "<input type=submit value='$text{'create'}'>\n";
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
else {
|
||||
print "<input type=submit value='$text{'save'}'>\n";
|
||||
print "<input type=submit name=delete value='$text{'delete'}'>\n";
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_submit($text{'delete'}, "delete");
|
||||
}
|
||||
print "</form>\n";
|
||||
print &ui_form_end(undef,undef,1);
|
||||
&can_edit_disable("groups");
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
$from = $in{'from'} || "groups";
|
||||
&footer("list_${from}.cgi", $text{$from.'_return'});
|
||||
|
||||
|
||||
@@ -23,21 +23,18 @@ else {
|
||||
undef, undef, undef, undef, &apply_button());
|
||||
$rule = $rules[$in{'idx'}];
|
||||
}
|
||||
print "<hr>\n";
|
||||
|
||||
print "<form action=save_rule.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<input type=hidden name=insert value='$in{'insert'}'>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'rule_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_hr();
|
||||
print &ui_form_start("save_rule.cgi", "post");
|
||||
print &ui_hidden("new", $in{'new'});
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_hidden("insert", $in{'insert'});
|
||||
print &ui_table_start($text{'rule_header'}, undef, 2);
|
||||
|
||||
# Show comment
|
||||
print "<tr> <td valign=top><b>$text{'rule_desc'}</b></td> <td colspan=2>\n";
|
||||
printf "<input name=desc size=60 value='%s'></td> </tr>\n",
|
||||
$rule->{'desc'} eq "*" ? "" : $rule->{'desc'};
|
||||
|
||||
print &ui_table_row($text{'rule_desc'},
|
||||
&ui_textbox("desc", ($rule->{'desc'} eq "*" ? "" : $rule->{'desc'}), 60),undef,
|
||||
["valign=middle","valign=middle"]);
|
||||
|
||||
# Show source and destination
|
||||
foreach $s ('source', 'dest') {
|
||||
$not = ($rule->{$s} =~ s/^!//g);
|
||||
@@ -46,27 +43,14 @@ foreach $s ('source', 'dest') {
|
||||
$rule->{$s} =~ /^\%/ ? 3 : 1;
|
||||
|
||||
# Any address options
|
||||
print "<tr> <td valign=top><b>",$text{'rule_'.$s},
|
||||
"</b></td> <td colspan=2>\n";
|
||||
print "<table>\n";
|
||||
print "<tr><td colspan=2>";
|
||||
printf "<input type=radio name=${s}_mode value=0 %s> %s\n",
|
||||
$sm == 0 ? "checked" : "",
|
||||
$text{'rule_anywhere'};
|
||||
print "</td></tr>\n";
|
||||
print &ui_table_row($text{'rule_'.$s},
|
||||
&ui_oneradio(${s}."_mode", 0, $text{'rule_anywhere'}, ($sm == 0 ? 1 : 0 ))."<br>".
|
||||
|
||||
# Specific host option
|
||||
print "<tr><td valign=top>";
|
||||
printf "<input type=radio name=${s}_mode value=1 %s> %s\n",
|
||||
$sm == 1 ? "checked" : "", $text{'rule_host'};
|
||||
print "</td><td>";
|
||||
printf "<input name=${s}_host size=30 value='%s'>\n",
|
||||
$sm == 1 ? $rule->{$s} : "";
|
||||
print "$text{'rule_named'}\n";
|
||||
print "<input name=${s}_name size=15><br>\n";
|
||||
print "<input type=checkbox name=${s}_resolv value=1> ",
|
||||
"$text{'rule_resolv'}\n";
|
||||
print "</td></tr>\n";
|
||||
&ui_oneradio(${s}."_mode", 1, $text{'rule_host'}, ($sm == 1 ? 1 : 0))." ".
|
||||
&ui_textbox(${s}."_host", ($sm == 1 ? $rule->{$s} : ""), 30)." ".$text{'rule_named'}." ".
|
||||
&ui_textbox(${s}."_name", undef, 15)."<br>".
|
||||
&ui_checkbox(${s}."_resolv", 1, $text{'rule_resolv'}), undef, ["valign=top","valign=middle"] );
|
||||
|
||||
# Host group option
|
||||
local $gv;
|
||||
@@ -76,117 +60,80 @@ foreach $s ('source', 'dest') {
|
||||
}
|
||||
$gi = &group_input("${s}_group", $gv, 0, 1);
|
||||
if ($gi || $sm == 2) {
|
||||
print "<tr><td valign=top>";
|
||||
printf "<input type=radio name=${s}_mode value=2 %s> %s\n",
|
||||
$sm == 2 ? "checked" : "", $text{'rule_group'};
|
||||
print "</td><td>";
|
||||
print $gi;
|
||||
print "</td></tr>\n";
|
||||
print &ui_table_row(" ",
|
||||
&ui_oneradio(${s}."_mode", 2, $text{'rule_group'}, ($sm == 2 ? 1 : 0))." ".
|
||||
$gi);
|
||||
}
|
||||
|
||||
# Interface option
|
||||
$ii = &iface_input("${s}_iface",
|
||||
$rule->{$s} =~ /^\%(.*)$/ ? $1 : undef);
|
||||
if ($ii || $sm == 3) {
|
||||
print "<tr><td>";
|
||||
printf "<input type=radio name=${s}_mode value=3 %s> %s\n",
|
||||
$sm == 3 ? "checked" : "", $text{'rule_iface'};
|
||||
print "</td><td>";
|
||||
print $ii;
|
||||
print "</td></tr>\n";
|
||||
print &ui_table_row(" ",
|
||||
&ui_oneradio(${s}."_mode", 3, $text{'rule_iface'}, ($sm == 3 ? 1 : 0))." ".
|
||||
$ii);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</td> <td valign=top>\n";
|
||||
#printf "<input type=checkbox name=${s}_not value=1 %s> %s\n",
|
||||
# $not ? "checked" : "", $text{'rule_not'};
|
||||
print "</td> </tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Show service
|
||||
$not = ($rule->{'service'} =~ s/^!//g);
|
||||
print "<tr> <td valign=top><b>$text{'rule_service'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=service_mode value=0 %s> %s\n",
|
||||
$rule->{'service'} eq '*' ? "checked" : "", $text{'rule_anyserv'};
|
||||
printf "<input type=radio name=service_mode value=1 %s> %s<br>\n",
|
||||
$rule->{'service'} eq '*' ? "" : "checked", $text{'rule_oneserv'};
|
||||
print &service_input("service",
|
||||
$rule->{'service'} eq '*' ? undef : $rule->{'service'},
|
||||
0, 1);
|
||||
print "</td> <td valign=top>\n";
|
||||
#printf "<input type=checkbox name=snot value=1 %s> %s\n",
|
||||
# $not ? "checked" : "", $text{'rule_not'};
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'rule_service'},
|
||||
&ui_radio("service_mode", ( $rule->{'service'} eq '*' ? 0 : 1 ),
|
||||
[ [ 0, $text{'rule_anyserv'} ], [1, $text{'rule_oneserv'}] ]) );
|
||||
print &ui_table_row(" ",
|
||||
&service_input("service", $rule->{'service'} eq '*' ? undef : $rule->{'service'}, 0, 1) );
|
||||
|
||||
|
||||
# Show action upon match
|
||||
print "<tr> <td valign=top><b>$text{'rule_action'}</b></td> <td>\n";
|
||||
print &action_input("action", $rule->{'action'});
|
||||
print "</td> <td>\n";
|
||||
printf "<input type=checkbox name=log value=1 %s> %s\n",
|
||||
$rule->{'log'} ? 'checked' : '', $text{'rule_log'};
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'rule_action'},
|
||||
&action_input("action", $rule->{'action'}).
|
||||
" — ".&ui_checkbox("log", 1, $text{'rule_log'}, ($rule->{'log'} ? 1 : 0) )
|
||||
);
|
||||
|
||||
|
||||
# Show time that this rule applies
|
||||
$inp = &time_input("time", $rule->{'time'} eq "*" ? undef : $rule->{'time'});
|
||||
if ($inp) {
|
||||
print "<tr> <td valign=top><b>$text{'rule_time'}</b></td> <td>";
|
||||
printf "<input type=radio name=time_def value=1 %s> %s\n",
|
||||
$rule->{'time'} eq "*" ? "checked" : "", $text{'rule_anytime'};
|
||||
printf "<input type=radio name=time_def value=0 %s> %s\n",
|
||||
$rule->{'time'} eq "*" ? "" : "checked", $text{'rule_seltime'};
|
||||
print $inp;
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'rule_time'},
|
||||
&ui_radio("time_def", ( $rule->{'time'} eq '*' ? 1 : 0 ),
|
||||
[ [ 1, $text{'rule_anytime'} ], [0, $text{'rule_seltime'}] ]).$inp);
|
||||
}
|
||||
else {
|
||||
print "<input type=hidden name=time_def value=1>\n";
|
||||
print &ui_hidden("time_def",1);
|
||||
}
|
||||
|
||||
# Show enabled flag
|
||||
print "<tr> <td valign=top><b>$text{'rule_enabled'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=enabled value=1 %s> %s\n",
|
||||
$rule->{'enabled'} ? "checked" : "", $text{'yes'};
|
||||
printf "<input type=radio name=enabled value=0 %s> %s\n",
|
||||
$rule->{'enabled'} ? "" : "checked", $text{'no'};
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'rule_enabled'},
|
||||
&ui_yesno_radio("enabled", ( $rule->{'enabled'} ? 1 : 0 ), 1, 0) );
|
||||
|
||||
# Show input for position of rule
|
||||
print "<tr> <td><b>$text{'rule_atpos'}</b></td> <td>\n";
|
||||
print "<select name=pos>\n";
|
||||
my @sel;
|
||||
foreach $br (@rules) {
|
||||
next if ($br eq $rule);
|
||||
if ($br->{'sep'}) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$br->{'index'},
|
||||
!$in{'new'} &&
|
||||
$rule->{'index'} == $br->{'index'}-1 ? "selected" : "",
|
||||
&text('rule_spos', $br->{'desc'});
|
||||
}
|
||||
else {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$br->{'index'},
|
||||
!$in{'new'} &&
|
||||
$rule->{'index'} == $br->{'index'}-1 ? "selected" : "",
|
||||
&text('rule_pos', $br->{'num'},
|
||||
&group_name($br->{'source'}),
|
||||
&group_name($br->{'dest'}));
|
||||
push(@sel, [ $br->{'index'}, &text('rule_spos', $br->{'desc'}),
|
||||
(!$in{'new'} && $rule->{'index'} == $br->{'index'}-1 ? "selected" : "") ] );
|
||||
} else {
|
||||
push(@sel, [ $br->{'index'}, &text('rule_pos', $br->{'num'}, &group_name($br->{'source'}), &group_name($br->{'dest'})),
|
||||
(!$in{'new'} && $rule->{'index'} == $br->{'index'}-1 ? "selected" : "") ] );
|
||||
}
|
||||
}
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
-1, $in{'new'} || $rule eq $rules[$#rules] ? "selected" : "",
|
||||
$text{'rule_end'};
|
||||
print "</select></td> </tr>\n";
|
||||
push(@sel, [ -1, $text{'rule_end'}, ($in{'new'} || $rule eq $rules[$#rules] ? "selected" : "") ] );
|
||||
print &ui_table_row($text{'rule_atpos'}, &ui_select("pos", undef, \@sel, 1) );
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print &ui_table_end();
|
||||
if ($in{'new'}) {
|
||||
print "<input type=submit value='$text{'create'}'>\n";
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
else {
|
||||
print "<input type=submit value='$text{'save'}'>\n";
|
||||
print "<input type=submit name=delete value='$text{'delete'}'>\n";
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_submit($text{'delete'}, "delete");
|
||||
}
|
||||
print "</form>\n";
|
||||
|
||||
print &ui_form_end(undef,undef,1);
|
||||
|
||||
&can_edit_disable("rules");
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
&footer("list_rules.cgi", $text{'rules_return'});
|
||||
|
||||
|
||||
@@ -16,59 +16,45 @@ else {
|
||||
undef, undef, undef, undef, &apply_button());
|
||||
$rule = $rules[$in{'idx'}];
|
||||
}
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
|
||||
print "<form action=save_sep.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<input type=hidden name=insert value='$in{'insert'}'>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'sep_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_form_start("save_sep.cgi", "post");
|
||||
foreach my $th ('new', 'idx', 'insert') {
|
||||
print &ui_hidden($th, $in{'$th'} );
|
||||
}
|
||||
|
||||
# Show separator title
|
||||
print "<tr> <td valign=top><b>$text{'sep_desc'}</b></td> <td>\n";
|
||||
printf "<input name=desc size=60 value='%s'></td> </tr>\n",
|
||||
$rule->{'desc'} eq "*" ? "" : $rule->{'desc'};
|
||||
print &ui_table_start($text{'sep_header'}, undef, 2);
|
||||
print &ui_table_row($text{'sep_desc'},
|
||||
&ui_textbox("desc", ( $rule->{'desc'} eq "*" ? "" : $rule->{'desc'} ), 60) );
|
||||
|
||||
# Show input for position of rule
|
||||
print "<tr> <td><b>$text{'rule_atpos'}</b></td> <td>\n";
|
||||
print "<select name=pos>\n";
|
||||
my @sel;
|
||||
foreach $br (@rules) {
|
||||
next if ($br eq $rule);
|
||||
if ($br->{'sep'}) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$br->{'index'},
|
||||
!$in{'new'} &&
|
||||
$rule->{'index'} == $br->{'index'}-1 ? "selected" : "",
|
||||
&text('rule_spos', $br->{'desc'});
|
||||
}
|
||||
else {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$br->{'index'},
|
||||
!$in{'new'} &&
|
||||
$rule->{'index'} == $br->{'index'}-1 ? "selected" : "",
|
||||
&text('rule_pos', $br->{'num'},
|
||||
&group_name($br->{'source'}),
|
||||
&group_name($br->{'dest'}));
|
||||
push(@sel, [ $br->{'index'}, &text('rule_spos', $br->{'desc'}),
|
||||
(!$in{'new'} && $rule->{'index'} == $br->{'index'}-1 ? "selected" : "") ] );
|
||||
} else {
|
||||
push(@sel, [ $br->{'index'},
|
||||
&text('rule_pos', $br->{'num'}, &group_name($br->{'source'}), &group_name($br->{'dest'})),
|
||||
(!$in{'new'} && $rule->{'index'} == $br->{'index'}-1 ? "selected" : "") ] );
|
||||
}
|
||||
}
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
-1, $in{'new'} || $rule eq $rules[$#rules] ? "selected" : "",
|
||||
$text{'rule_end'};
|
||||
print "</select></td> </tr>\n";
|
||||
push(@sel, [ -1, $text{'rule_end'}, ($in{'new'} || $rule eq $rules[$#rules] ? "selected" : "") ] );
|
||||
print &ui_table_row($text{'rule_atpos'}, &ui_select("pos", undef, \@sel, 1) );
|
||||
print &ui_table_end();
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
if ($in{'new'}) {
|
||||
print "<input type=submit value='$text{'create'}'>\n";
|
||||
print &ui_hidden($text{'create'});
|
||||
}
|
||||
else {
|
||||
print "<input type=submit value='$text{'save'}'>\n";
|
||||
print "<input type=submit name=delete value='$text{'delete'}'>\n";
|
||||
print &ui_hidden($text{'save'});
|
||||
print &ui_hidden($text{'delete'}, "delete");
|
||||
}
|
||||
print "</form>\n";
|
||||
|
||||
print &ui_form_end();
|
||||
&can_edit_disable("rules");
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
&footer("list_rules.cgi", $text{'rules_return'});
|
||||
|
||||
|
||||
@@ -22,52 +22,46 @@ else {
|
||||
$in{'idx'} = $services->{'index'};
|
||||
}
|
||||
}
|
||||
print "<hr>\n";
|
||||
|
||||
print "<form action=save_service.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'service_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_hr();
|
||||
|
||||
print &ui_form_start("save_service.cgi","post");
|
||||
print &ui_hidden("new", $in{'new'});
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_table_start($text{'service_header'}, undef, 2);
|
||||
|
||||
# Show service name input
|
||||
print "<tr> <td><b>$text{'service_name'}</b></td>\n";
|
||||
printf "<td><input name=name size=20 value='%s'></td> </tr>\n",
|
||||
$service->{'name'};
|
||||
print &ui_table_row($text{'service_name'}, &ui_textbox("name", $service->{'name'}, 20) );
|
||||
|
||||
# Show protocols and ports
|
||||
print "<tr> <td valign=top><b>$text{'service_ports'}</b></td>\n";
|
||||
print "<td><table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'service_proto'}</b></td> ",
|
||||
"<td><b>$text{'service_port'}</b></td> </tr>\n";
|
||||
my $tx = "";
|
||||
$tx .= &ui_columns_start([$text{'service_proto'}, $text{'service_port'}]);
|
||||
for($i=0; $i<@{$service->{'protos'}}+6; $i++) {
|
||||
print "<tr>\n";
|
||||
print "<td>",&protocol_input(
|
||||
"proto_$i", $service->{'protos'}->[$i]),"</td>\n";
|
||||
printf "<td><input name=port_%d size=20 value='%s'></td>\n",
|
||||
$i, $service->{'ports'}->[$i];
|
||||
print "</tr>\n";
|
||||
my @cols;
|
||||
push(@cols, &protocol_input("proto_$i", $service->{'protos'}->[$i]) );
|
||||
push(@cols, &ui_textbox("port_".$i, $service->{'ports'}->[$i], 20) );
|
||||
$tx .= &ui_columns_row(\@cols);
|
||||
}
|
||||
print "</table></td> </tr>\n";
|
||||
$tx .= ui_columns_end();
|
||||
|
||||
print &ui_table_row($text{'service_ports'}, $tx);
|
||||
|
||||
# Show member services
|
||||
print "<tr> <td valign=top><b>$text{'service_members'}</b></td>\n";
|
||||
print "<td>",&service_input("others",
|
||||
join(",", @{$service->{'others'}}), 0, 1),"</td> </tr>\n";
|
||||
print &ui_table_row($text{'service_members'},
|
||||
&service_input("others", join(",", @{$service->{'others'}}), 0, 1) );
|
||||
|
||||
print &ui_table_end();
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
if ($in{'new'}) {
|
||||
print "<input type=submit value='$text{'create'}'>\n";
|
||||
print &ui_submit($text{'create'});
|
||||
}
|
||||
else {
|
||||
print "<input type=submit value='$text{'save'}'>\n";
|
||||
print "<input type=submit name=delete value='$text{'delete'}'>\n";
|
||||
print &ui_submit($text{'save'});
|
||||
print &ui_submit($text{'delete'}, "delete");
|
||||
}
|
||||
print "</form>\n";
|
||||
|
||||
print &ui_form_end(undef,undef,1);
|
||||
&can_edit_disable("services");
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
&footer("list_services.cgi", $text{'services_return'});
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
require './itsecur-lib.pl';
|
||||
&header($text{'index_title'}, "", undef, 1, 1, 0, &apply_button(), undef, undef,
|
||||
&text('index_version', $module_info{'version'}));
|
||||
print "<hr>\n";
|
||||
|
||||
print "<p>";
|
||||
|
||||
# Icons table
|
||||
@can_opts = grep { $_ eq "backup" || $_ eq "restore" || $_ eq "remote" || $_ eq "import" ? &can_edit($_) : &can_use($_) } @opts;
|
||||
@@ -16,17 +17,14 @@ print "<hr>\n";
|
||||
&itsecur_icons_table(\@links, \@titles, \@icons, 4, \@hrefs);
|
||||
|
||||
if (&can_edit("apply") || &can_edit("bootup")) {
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
}
|
||||
|
||||
print "<table width=100%>\n";
|
||||
print &ui_buttons_start();
|
||||
|
||||
if (&can_edit("apply")) {
|
||||
# Apply button
|
||||
print "<form action=apply.cgi><tr>\n";
|
||||
print "<td><input type=submit value='$text{'index_apply'}'></td>\n";
|
||||
print "<td>$text{'index_applydesc'}</td>\n";
|
||||
print "</tr></form>\n";
|
||||
print &ui_buttons_row("apply.cgi", $text{'index_apply'}, $text{'index_applydesc'});
|
||||
}
|
||||
|
||||
if (&can_edit("bootup")) {
|
||||
@@ -34,19 +32,13 @@ if (&can_edit("bootup")) {
|
||||
$atboot = &init::action_status("itsecur-firewall") == 2;
|
||||
|
||||
# At-boot button
|
||||
print "<tr><form action=bootup.cgi>\n";
|
||||
print "<td nowrap><input type=submit value='$text{'index_bootup'}'>\n";
|
||||
printf "<input type=radio name=boot value=1 %s> %s\n",
|
||||
$atboot ? "checked" : "", $text{'yes'};
|
||||
printf "<input type=radio name=boot value=0 %s> %s\n",
|
||||
$atboot ? "" : "checked", $text{'no'};
|
||||
print "</td> <td>$text{'index_bootupdesc'}</td>\n";
|
||||
print "</form></tr>\n";
|
||||
print &ui_buttons_row("bootup.cgi", $text{'index_bootup'}, $text{'index_bootupdesc'}, undef,
|
||||
&ui_yesno_radio("boot", ( $atboot ? 1 : 0 ), 1, 0));
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print &ui_buttons_end();
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
&footer("/", $text{'index'});
|
||||
|
||||
# itsecur_icons_table(&links, &titles, &icons, [columns], [href], [width], [height])
|
||||
@@ -58,10 +50,10 @@ if (defined(&theme_icons_table)) {
|
||||
&theme_icons_table(@_);
|
||||
return;
|
||||
}
|
||||
local ($i, $need_tr);
|
||||
local $cols = $_[3] ? $_[3] : 4;
|
||||
local $per = int(100.0 / $cols);
|
||||
print "<table width=100% cellpadding=5>\n";
|
||||
my ($i, $need_tr);
|
||||
my $cols = $_[3] ? $_[3] : 4;
|
||||
my $per = int(100.0 / $cols);
|
||||
print &ui_table_start(undef,"width=100% cellpadding=5",2);
|
||||
for($i=0; $i<@{$_[0]}; $i++) {
|
||||
if ($i%$cols == 0) { print "<tr>\n"; }
|
||||
print "<td width=$per% align=center valign=top>\n";
|
||||
@@ -72,7 +64,7 @@ for($i=0; $i<@{$_[0]}; $i++) {
|
||||
}
|
||||
while($i++%$cols) { print "<td width=$per%></td>\n"; $need_tr++; }
|
||||
print "</tr>\n" if ($need_tr);
|
||||
print "</table>\n";
|
||||
print &ui_table_end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,35 +6,31 @@ require './itsecur-lib.pl';
|
||||
&can_use_error("groups");
|
||||
&header($text{'groups_title'}, "",
|
||||
undef, undef, undef, undef, &apply_button());
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
|
||||
my @groups = &list_groups();
|
||||
my $edit = &can_edit("groups");
|
||||
|
||||
@groups = &list_groups();
|
||||
$edit = &can_edit("groups");
|
||||
if (@groups) {
|
||||
print "<a href='edit_group.cgi?new=1'>$text{'groups_add'}</a><br>\n"
|
||||
if ($edit);
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'group_name'}</b></td> ",
|
||||
"<td><b>$text{'group_members'}</b></td> </tr>\n";
|
||||
foreach $g (@groups) {
|
||||
print "<tr $cb>\n";
|
||||
print "<td><a href='edit_group.cgi?idx=$g->{'index'}'>",
|
||||
"$g->{'name'}</a></td>\n";
|
||||
@mems = @{$g->{'members'}};
|
||||
print &ui_link("edit_group.cgi?new=1", $text{'groups_add'}) if ($edit);
|
||||
print &ui_columns_start([$text{'group_name'}, $text{'group_members'}]);
|
||||
foreach my $g (@groups) {
|
||||
my @cols_row;
|
||||
my $tx = "";
|
||||
my $link = &ui_link("edit_group.cgi?idx=".$g->{'index'}, $g->{'name'});
|
||||
push(@cols_row, ( $edit ? $link : $g->{'name'} ) );
|
||||
my @mems = @{$g->{'members'}};
|
||||
if (@mems > 5) {
|
||||
@mems = (@mems[0..4], "...");
|
||||
}
|
||||
print "<td>",join(" , ",
|
||||
map { &group_name($_) } @mems),"</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
@mems = (@mems[0..4], "...");
|
||||
}
|
||||
push(@cols_row, join(" , ", map { &group_name($_) } @mems) );
|
||||
print &ui_columns_row(\@cols_row);
|
||||
}
|
||||
print &ui_columns_end();
|
||||
}
|
||||
else {
|
||||
print "<b>$text{'groups_none'}</b><p>\n";
|
||||
}
|
||||
print "<a href='edit_group.cgi?new=1'>$text{'groups_add'}</a><p>\n"
|
||||
if ($edit);
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_link("edit_group.cgi?new=1", $text{'groups_add'}) if ($edit);
|
||||
print &ui_hr();
|
||||
&footer("", $text{'index_return'});
|
||||
|
||||
@@ -9,42 +9,65 @@ require './itsecur-lib.pl';
|
||||
print "<hr>\n";
|
||||
|
||||
|
||||
# 0-No. 1-Source,2-Destination, 3-Services, 4-Time, 5-Action, 6-Enabled, 7-Comment
|
||||
local @CW=( "5%", "15%", "15%", "20%", "5%", "5%", "5%", "20%");
|
||||
$C_drop="#FFCCcc";
|
||||
$C_reject="#FFDDAA";
|
||||
$C_accept="";
|
||||
$C_disabled="#FF3333";
|
||||
$C_separator="#ffffcc";
|
||||
# 0-No. 1-Source,2-Destination, 3-Services, 4-Time, 5-Action, 6-Enabled, 7-Comment 8-move
|
||||
my @CW=( "5%", "15%", "15%", "20%", "5%", "10%", "5%", "10%", "2%");
|
||||
my $C_drop="#FFCCcc";
|
||||
my $C_reject="#FFDDAA";
|
||||
my $C_accept="";
|
||||
my $C_disabled="#FF3333";
|
||||
my $C_separator="#ffffcc";
|
||||
|
||||
local $Row_Color="";
|
||||
my $Row_Color="";
|
||||
|
||||
my @rules = &list_rules();
|
||||
my @servs = &list_services();
|
||||
my $edit = &can_edit("rules");
|
||||
my $times = &supports_time() && &list_times() > 0;
|
||||
my $rules_cnt = scalar(@rules);
|
||||
my @links;
|
||||
if ( $rules_cnt > 1 ) {
|
||||
push(@links, &select_all_link("r"));
|
||||
push(@links, &select_invert_link("r"));
|
||||
}
|
||||
if ($edit) {
|
||||
push(@links, &ui_link("edit_rule.cgi?new=1", $text{'rules_add'}) );
|
||||
push(@links, &ui_link("edit_sep.cgi?new=1", $text{'rules_sadd'}) );
|
||||
}
|
||||
|
||||
@rules = &list_rules();
|
||||
@servs = &list_services();
|
||||
$edit = &can_edit("rules");
|
||||
$times = &supports_time() && &list_times() > 0;
|
||||
if (@rules) {
|
||||
if ($edit) {
|
||||
print "<a href='edit_rule.cgi?new=1'>$text{'rules_add'}</a>\n";
|
||||
print " " x 2;
|
||||
print "<a href='edit_sep.cgi?new=1'>$text{'rules_sadd'}</a>\n";
|
||||
print &ui_links_row(\@links);
|
||||
print "<br>\n";
|
||||
print "<form action=enable_rules.cgi method=post>\n";
|
||||
print &ui_form_start("enable_rules.cgi", "post");
|
||||
}
|
||||
$cols = $times ? 8 : 7;
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> ",
|
||||
"<td width=$CW[0]><b>$text{'rule_num'}</b></td> ",
|
||||
"<td width=$CW[1]><b>$text{'rule_source'}</b></td> ",
|
||||
"<td width=$CW[2]><b>$text{'rule_dest'}</b></td> ",
|
||||
"<td width=$CW[3]><b>$text{'rules_service'}</b></td> ",
|
||||
($times ? "<td><b>$text{'rule_time'}</b></td> " : ""),
|
||||
"<td width=$CW[5]><b>$text{'rule_action'}</b></td> ",
|
||||
"<td width=$CW[6]><b>$text{'rule_enabled'}</b></td> ",
|
||||
($config{'show_desc'} ? "<td width=$CW[7]><b>$text{'rules_desc'}</b></td> " :
|
||||
"<td width=10><b>$text{'rules_move'}</b></td>"),
|
||||
"</tr>\n";
|
||||
foreach $r (@rules) {
|
||||
|
||||
my @cols_text = ( "rule_num", "rule_source", "rule_dest",
|
||||
"rules_service", "rule_time",
|
||||
"rule_action", "rule_enabled",
|
||||
"rules_desc", "rules_move" );
|
||||
my @cols_header;
|
||||
my @cols_header_width;
|
||||
my $cols = 0;
|
||||
foreach my $cc (@cols_text) {
|
||||
if ( $cc eq 'rule_time' && !$times ) {
|
||||
$cols++;
|
||||
next;
|
||||
}
|
||||
if ( $cc eq 'rules_desc' && !$config{'show_desc'} ) {
|
||||
$cols++;
|
||||
next;
|
||||
}
|
||||
if ( $cc eq 'rules_move' && $rules_cnt <= 1 ) {
|
||||
$cols++;
|
||||
next;
|
||||
}
|
||||
push(@cols_header, $text{$cc});
|
||||
push(@cols_header_width, "width='".$CW[$cols]."'");
|
||||
$cols++;
|
||||
}
|
||||
print &ui_columns_start(\@cols_header, "100", undef, \@cols_header_width);
|
||||
|
||||
foreach my $r (@rules) {
|
||||
if ($r->{'sep'}){
|
||||
$Row_Color="bgcolor=\"$C_separator\" ";
|
||||
} elsif (!$r->{'enabled'}){
|
||||
@@ -57,93 +80,69 @@ if (@rules) {
|
||||
$Row_Color="";
|
||||
}
|
||||
|
||||
# case('accept') {}
|
||||
# case('allow') {}
|
||||
# case('drop') {}
|
||||
#case('reject') {}
|
||||
#case('ignore') {}
|
||||
|
||||
|
||||
|
||||
print "<tr $Row_Color $cb>\n";
|
||||
if ($r->{'sep'}) {
|
||||
# Actually a separator - just show it's description
|
||||
print "<td colspan=$cols><b><a href='edit_sep.cgi?idx=$r->{'index'}'>$r->{'desc'}</b></a></td>\n";
|
||||
print &ui_columns_row([ &ui_link("edit_sep.cgi?idx=".$r->{'index'},
|
||||
$r->{'desc'}, undef, "style='font-weight:bold;'") ],
|
||||
[ "colspan='".$cols."' ".$Row_Color ] );
|
||||
}
|
||||
else {
|
||||
# Show full rule details
|
||||
my @cols_row;
|
||||
my @cols_row_tag;
|
||||
my $link = &ui_link("edit_rule.cgi?idx=".$r->{'index'}, $r->{'num'});
|
||||
push(@cols_row, ( $edit ? &ui_checkbox("r", $r->{'index'}, " ").$link : $link ) );
|
||||
push(@cols_row, &group_names_link($r->{'source'}, 'rules') );
|
||||
push(@cols_row, &group_names_link($r->{'dest'}, 'rules', ( &allow_action($r) ? 'dest' : undef) ) );
|
||||
push(@cols_row, &protocol_names($r->{'service'},\@servs) );
|
||||
push(@cols_row, ($r->{'time'} eq '*' ? $text{'rule_anytime'} : $r->{'time'} ) ) if ($times);
|
||||
push(@cols_row, $text{'rule_'.$r->{'action'}}." ".($r->{'log'} ? " $text{'rules_log'}" : "") );
|
||||
push(@cols_row, ($r->{'enabled'} ? $text{'yes'} : "<font color=#ff0000>$text{'no'}</font>" ) );
|
||||
|
||||
if ($config{'show_desc'}) {
|
||||
push(@cols_row, ($r->{'desc'} eq "*" ? "" : $r->{'desc'} ) );
|
||||
}
|
||||
if ( $rules_cnt > 1 ) {
|
||||
$link = "";
|
||||
if ($r eq $rules[0] || !$edit) {
|
||||
$link = "<img src=images/gap.gif>";
|
||||
} else {
|
||||
$link = &ui_link("up.cgi?idx=".$r->{'index'}, "<img src=images/up.gif border=0>");
|
||||
}
|
||||
if ($r eq $rules[$#rules] || !$edit) {
|
||||
$link .= "<img src=images/gap.gif>";
|
||||
} else {
|
||||
$link .= &ui_link("down.cgi?idx=".$r->{'index'}, "<img src=images/down.gif border=0>");
|
||||
}
|
||||
push(@cols_row, $link ) if ( $link ne "" );
|
||||
}
|
||||
|
||||
|
||||
print "<td width=$CW[0]>";
|
||||
if ($edit) {
|
||||
print "<input type=checkbox name=r value=$r->{'index'}> ";
|
||||
}
|
||||
print "<a href='edit_rule.cgi?",
|
||||
"idx=$r->{'index'}'>$r->{'num'}</a></td>\n";
|
||||
print "<td width=$CW[1]>",
|
||||
&group_names_link($r->{'source'}, 'rules'),
|
||||
"</td>\n";
|
||||
print "<td width=$CW[2]>",
|
||||
&group_names_link($r->{'dest'}, 'rules',
|
||||
&allow_action($r) ? 'dest' : undef),
|
||||
"</td>\n";
|
||||
print "<td width=$CW[3]>",&protocol_names($r->{'service'},\@servs),"</td>\n";
|
||||
if ($times) {
|
||||
print "<td>",$r->{'time'} eq '*' ?
|
||||
$text{'rule_anytime'} :
|
||||
$r->{'time'},"</td>\n";
|
||||
}
|
||||
print "<td width=$CW[5]>",$text{'rule_'.$r->{'action'}},
|
||||
$r->{'log'} ? " $text{'rules_log'}" : "","</td>\n";
|
||||
print "<td width=$CW[6]>",$r->{'enabled'} ? $text{'yes'} :
|
||||
"<font color=#ff0000>$text{'no'}</font>",
|
||||
"</td>\n";
|
||||
if ($config{'show_desc'}) {
|
||||
print "<td width=$CW[7]>",$r->{'desc'} eq "*" ? "<br>"
|
||||
: $r->{'desc'},"</td>\n";
|
||||
}
|
||||
else {
|
||||
if ($r eq $rules[0] || !$edit) {
|
||||
print "<td><img src=images/gap.gif>\n";
|
||||
}
|
||||
else {
|
||||
print "<td><a href='up.cgi?idx=$r->{'index'}'>",
|
||||
"<img src=images/up.gif border=0></a>\n";
|
||||
}
|
||||
if ($r eq $rules[$#rules] || !$edit) {
|
||||
print "<img src=images/gap.gif></td>\n";
|
||||
}
|
||||
else {
|
||||
print "<a href='down.cgi?idx=$r->{'index'}'>",
|
||||
"<img src=images/down.gif border=0></a></td>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
foreach (@cols_row) {
|
||||
push(@cols_row_tag, $Row_Color );
|
||||
}
|
||||
print &ui_columns_row(\@cols_row, \@cols_row_tag);
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
print &ui_columns_end();
|
||||
}
|
||||
else {
|
||||
print "<b>$text{'rules_none'}</b><p>\n";
|
||||
}
|
||||
if ($edit) {
|
||||
print "<a href='edit_rule.cgi?new=1'>$text{'rules_add'}</a>\n";
|
||||
print " " x 2;
|
||||
print "<a href='edit_sep.cgi?new=1'>$text{'rules_sadd'}</a>\n";
|
||||
print &ui_links_row(\@links);
|
||||
print "<p>\n";
|
||||
}
|
||||
if ($edit && @rules) {
|
||||
print "<input type=submit name=enable value='$text{'rules_enable'}'>\n";
|
||||
print "<input type=submit name=disable value='$text{'rules_disable'}'>\n";
|
||||
|
||||
print &ui_submit($text{'rules_enable'}, "enable" );
|
||||
print &ui_submit($text{'rules_disable'}, "disable" );
|
||||
print " \n";
|
||||
print "<input type=submit name=logon value='$text{'rules_logon'}'>\n";
|
||||
print "<input type=submit name=logoff value='$text{'rules_logoff'}'>\n";
|
||||
print &ui_submit($text{'rules_logon'}, "logon" );
|
||||
print &ui_submit($text{'rules_logoff'}, "logoff" );
|
||||
print " \n";
|
||||
print "<input type=submit name=delete value='$text{'rules_delete'}'>\n";
|
||||
print "</form>\n";
|
||||
print &ui_submit($text{'rules_delete'}, "delete" );
|
||||
print &ui_form_end(undef,undef,1);
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
print &ui_hr();
|
||||
&footer("", $text{'index_return'});
|
||||
|
||||
|
||||
@@ -10,41 +10,42 @@ print "<hr>\n";
|
||||
|
||||
@services = &list_services();
|
||||
$edit = &can_edit("services");
|
||||
print "<a href='edit_service.cgi?new=1'>$text{'services_add'}</a><br>\n"
|
||||
if ($edit);
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$text{'service_name'}</b></td> ",
|
||||
"<td><b>$text{'service_ports'}</b></td> </tr>\n";
|
||||
|
||||
my $link = ( $edit ? &ui_link("edit_service.cgi?new=1",$text{'services_add'}) : "" );
|
||||
|
||||
print $link."<br>" if ( $link ne '' );
|
||||
|
||||
print &ui_columns_start([$text{'service_name'}, $text{'service_ports'}]);
|
||||
|
||||
if (!$services[0]->{'standard'}) {
|
||||
print "<tr $tb> <td colspan=3><b>$text{'services_header1'}</b></td> </tr>\n";
|
||||
print &ui_columns_header([$text{'services_header1'}],["colspan=2"]);
|
||||
}
|
||||
foreach $s (@services) {
|
||||
if ($s->{'standard'} && !$doneheader) {
|
||||
print "<tr $tb> <td colspan=3><b>$text{'services_header2'}</b></td> </tr>\n";
|
||||
print &ui_columns_header([$text{'services_header2'}],["colspan=2"]);
|
||||
$doneheader++;
|
||||
}
|
||||
print "<tr $cb>\n";
|
||||
my @cols;
|
||||
if ($s->{'standard'}) {
|
||||
print "<td>$s->{'name'}</td>\n";
|
||||
push(@cols, $s->{'name'} );
|
||||
}
|
||||
else {
|
||||
print "<td><a href='edit_service.cgi?idx=$s->{'index'}'>",
|
||||
"$s->{'name'}</a></td>\n";
|
||||
push(@cols, &ui_link("edit_service.cgi?idx=$s->{'index'}", $s->{'name'}) );
|
||||
}
|
||||
print "<td>";
|
||||
my $cl = "";
|
||||
for($i=0; $i<@{$s->{'protos'}}; $i++) {
|
||||
print &protocol_name($s->{'protos'}->[$i], $s->{'ports'}->[$i]);
|
||||
print "\n";
|
||||
$cl .= &protocol_name($s->{'protos'}->[$i], $s->{'ports'}->[$i])." ";
|
||||
}
|
||||
for($i=0; $i<@{$s->{'others'}}; $i++) {
|
||||
print "<b>$s->{'others'}->[$i]</b>\n";
|
||||
$cl .="<b>$s->{'others'}->[$i]</b> ";
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
push(@cols, $cl);
|
||||
print &ui_columns_row(\@cols);
|
||||
}
|
||||
print "</table>\n";
|
||||
print "<a href='edit_service.cgi?new=1'>$text{'services_add'}</a><p>\n"
|
||||
if ($edit);
|
||||
print &ui_columns_end();
|
||||
|
||||
print $link."<p>" if ( $link ne '' );
|
||||
print &ui_hr();
|
||||
|
||||
|
||||
print "<hr>\n";
|
||||
&footer("", $text{'index_return'});
|
||||
|
||||
Reference in New Issue
Block a user