3 # Display logcheck configuration menu
5 require './sentry-lib.pl';
7 # Check if logcheck is installed
8 if (!-x $config{'logcheck'}) {
9 &ui_print_header(undef, $text{'logcheck_title'}, "");
10 print "<p>",&text('logcheck_ecommand',
11 "<tt>$config{'logcheck'}</tt>",
12 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
13 &ui_print_footer("", $text{'index_return'});
17 # Check if it is the right version
18 $conf = &get_logcheck_config();
19 $hacking = &find_value("HACKING_FILE", $conf, 1);
20 $hacking = &find_value("CRACKING_FILE", $conf, 1) if (!$hacking);
22 &ui_print_header(undef, $text{'logcheck_title'}, "");
23 print "<p>",&text('logcheck_eversion',
24 "<tt>$config{'logcheck'}</tt>"),"<p>\n";
25 &ui_print_footer("", $text{'index_return'});
29 &ui_print_header(undef, $text{'logcheck_title'}, "", "logcheck", 0, 0, undef,
30 &help_search_link("logcheck", "man", "doc"));
32 # Show configuration form
33 print "<form action=save_logcheck.cgi method=post>\n";
34 print "<table border width=100%>\n";
35 print "<tr $tb> <td><b>$text{'logcheck_header'}</b></td> </tr>\n";
36 print "<tr $cb> <td><table width=100%>\n";
38 $to = &find_value("SYSADMIN", $conf, 1);
39 print "<tr> <td><b>$text{'logcheck_to'}</b></td>\n";
40 printf "<td colspan=2><input name=to size=50 value='%s'></td> </tr>\n", $to;
42 print "<tr> <td width=33% valign=top><b>$text{'logcheck_hacking'}</b><br>\n";
43 print "<textarea name=hacking rows=20 cols=30>";
44 open(HACKING, $hacking);
47 print &html_escape($_),"\n";
50 print "</textarea></td>\n";
52 $violations = &find_value("VIOLATIONS_FILE", $conf, 1);
53 print "<td width=33% valign=top><b>$text{'logcheck_violations'}</b><br>\n";
54 print "<textarea name=violations rows=10 cols=30>";
55 open(VIOLATIONS, $violations);
58 print &html_escape($_),"\n";
61 print "</textarea><br>\n";
62 $violations_ign = &find_value("VIOLATIONS_IGNORE_FILE", $conf, 1);
63 print "<b>$text{'logcheck_violations_ign'}</b><br>\n";
64 print "<textarea name=violations_ign rows=7 cols=30>";
65 open(IGNORE, $violations_ign);
68 print &html_escape($_),"\n";
71 print "</textarea></td>\n";
73 $ignore = &find_value("IGNORE_FILE", $conf, 1);
74 print "<td width=33% valign=top><b>$text{'logcheck_ignore'}</b><br>\n";
75 print "<textarea name=ignore rows=20 cols=20>";
76 open(IGNORE, $ignore);
79 print &html_escape($_),"\n";
82 print "</textarea></td> </tr>\n";
84 # Display files being monitored
85 open(CHECK, $config{'logcheck'});
89 if (/^\s*(\$LOGTAIL|\S*logtail)\s+(\S+)/) {
95 print "<tr> <td valign=top><b>$text{'logcheck_files'}</b></td>\n";
96 print "<td colspan=2>",join(" ",
97 map { "<tt>$_</tt>" } @logfiles),"</td> </tr>\n";
100 # Display run times for logcheck
101 &foreign_require("cron", "cron-lib.pl");
102 @jobs = &cron::list_cron_jobs();
103 JOB: foreach $j (@jobs) {
105 if ($j->{'command'} =~ /$config{'logcheck'}/) {
109 elsif ($rpd = &cron::is_run_parts($j->{'command'})) {
110 local @exp = &cron::expand_run_parts($rpd);
112 if ($e =~ /logcheck/) {
113 # Cannot change this :(
121 print "<tr> <td colspan=3>",&text('logcheck_runparts',
122 "<tt>$runparts</tt>"),"</td> </tr>\n";
123 print "<input type=hidden name=runparts value='1'>\n";
126 print "<input type=hidden name=job value='$job->{'index'}'>\n"
128 print "<tr> <td colspan=3>\n";
129 $job = { 'mins' => 0,
133 'weekdays' => '*' } if (!$job);
134 printf "<input type=radio name=active value=0 %s> %s\n",
135 $job->{'active'} ? "" : "checked", $text{'logcheck_disabled'};
136 printf "<input type=radio name=active value=1 %s> %s<br>\n",
137 $job->{'active'} ? "checked" : "", $text{'logcheck_enabled'};
138 print "<table border width=100%>\n";
139 &cron::show_times_input($job);
140 print "</table></td> </tr>\n";
143 print "</table></td></tr></table><br>\n";
144 print "<input type=submit value='$text{'logcheck_save'}'></form>\n";
146 &ui_print_footer("", $text{'index_return'});