3 # Display hostsentry options
5 require './sentry-lib.pl';
6 &ui_print_header(undef, $text{'hostsentry_title'}, "", "hostsentry", 0, 0, undef,
7 &help_search_link("hostsentry", "man", "doc"));
9 if (!-r $config{'hostsentry'}) {
10 print "<p>",&text('hostsentry_ecommand',
11 "<tt>$config{'hostsentry'}</tt>",
12 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
13 &ui_print_footer("", $text{'index_return'});
17 # Show configuration form
18 $conf = &get_hostsentry_config();
20 print "<form action=save_hostsentry.cgi method=post>\n";
21 print "<table border width=100%>\n";
22 print "<tr $tb> <td><b>$text{'hostsentry_header'}</b></td> </tr>\n";
23 print "<tr $cb> <td><table width=100%>\n";
26 print "<tr> <td><b>$text{'hostsentry_wtmp'}</b></td>\n";
27 printf "<td colspan=3><input name=wtmp size=50 value='%s'> %s</td> </tr>\n",
28 &find_value("WTMP_FILE", $conf),
29 &file_chooser_button("wtmp");
31 # Show users to ignore
32 $ign = &find_value("IGNORE_FILE", $conf);
33 print "<tr> <td valign=top><b>$text{'hostsentry_ignore'}</b></td>\n";
34 print "<td colspan=3><textarea name=ignore rows=5 cols=40>";
39 print &html_escape($_),"\n" if (/\S/);
42 print "</textarea></td> </tr>\n";
44 # Show configured modules
45 $mods = &find_value("MODULE_FILE", $conf);
50 push(@mods, $_) if (/\S/);
53 @allmods = &list_hostsentry_modules($conf);
54 print "<tr> <td valign=top><b>$text{'hostsentry_mods'}</b></td>\n";
55 print "<td colspan=3 nowrap>\n";
56 for($i=0; $i<@allmods || $i<@mods; $i++) {
58 print "<select name=mod_$i>\n";
59 printf "<option value='' %s>%s\n",
60 $mods[$i] ? "" : "selected", " ";
61 foreach $a (@allmods) {
62 local $t = $text{'mod_'.$a};
63 printf "<option value=%s %s>%s\n",
64 $a, $mods[$i] eq $a ? "selected" : "",
67 print "<option selected>$mods[$i]\n"
68 if ($mods[$i] && &indexof($mods[$i], @allmods) < 0);
70 print "<br>\n" if ($i%2);
71 print " " if (!($i%2));
73 print "</td> </tr>\n";
75 # Show module-specific options
76 print "</table><table width=100%>\n";
78 $basedir = &get_hostsentry_dir();
79 if (&indexof("moduleForeignDomain", @mods) >= 0) {
80 print "<td valign=top colspan=2 width=50%><b>$text{'hostsentry_foreign'}</b><br>\n";
81 print "<textarea name=foreign rows=5 cols=30>";
82 open(FOREIGN, "$basedir/moduleForeignDomain.allow");
86 print &html_escape($_),"\n" if (/\S/);
89 print "</textarea></td>\n";
91 if (&indexof("moduleMultipleLogins", @mods) >= 0) {
92 print "<td valign=top colspan=2 width=50%><b>$text{'hostsentry_multiple'}</b><br>\n";
93 print "<textarea name=multiple rows=5 cols=30>";
94 open(MULTIPLE, "$basedir/moduleMultipleLogins.allow");
98 print &html_escape($_),"\n" if (/\S/);
101 print "</textarea></td>\n";
105 print "</table></td></tr></table>\n";
107 $pid = &get_hostsentry_pid();
109 print "<input type=submit name=apply value='$text{'hostsentry_save'}'></form>\n";
112 print "<input type=submit value='$text{'save'}'></form>\n";
115 # Show start/stop buttons
117 print "<table width=100%>\n";
118 $cmd = &hostsentry_start_cmd();
120 # Running .. offer to stop
121 print "<form action=stop_hostsentry.cgi>\n";
122 print "<tr> <td><input type=submit ",
123 "value='$text{'hostsentry_stop'}'></td>\n";
124 print "<td>$text{'hostsentry_stopdesc'}</td> </tr>\n";
128 # Not running .. offer to start
129 print "<form action=start_hostsentry.cgi>\n";
130 print "<tr> <td><input type=submit ",
131 "value='$text{'hostsentry_start'}'></td>\n";
132 print "<td>",&text('hostsentry_startdesc', "<tt>$cmd</tt>"),
133 "</td> </tr> </form>\n";
137 &ui_print_footer("", $text{'index_return'});