#!/usr/local/bin/perl # edit_logcheck.cgi # Display logcheck configuration menu require './sentry-lib.pl'; # Check if logcheck is installed if (!-x $config{'logcheck'}) { &ui_print_header(undef, $text{'logcheck_title'}, ""); print "

",&text('logcheck_ecommand', "$config{'logcheck'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } # Check if it is the right version $conf = &get_logcheck_config(); $hacking = &find_value("HACKING_FILE", $conf, 1); $hacking = &find_value("CRACKING_FILE", $conf, 1) if (!$hacking); if (!$hacking) { &ui_print_header(undef, $text{'logcheck_title'}, ""); print "

",&text('logcheck_eversion', "$config{'logcheck'}"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } &ui_print_header(undef, $text{'logcheck_title'}, "", "logcheck", 0, 0, undef, &help_search_link("logcheck", "man", "doc")); # Show configuration form print "

\n"; print "\n"; print "\n"; print "
$text{'logcheck_header'}
\n"; $to = &find_value("SYSADMIN", $conf, 1); print "\n"; printf "\n", $to; print "\n"; $violations = &find_value("VIOLATIONS_FILE", $conf, 1); print "\n"; $ignore = &find_value("IGNORE_FILE", $conf, 1); print "\n"; # Display files being monitored open(CHECK, $config{'logcheck'}); while() { s/\r|\n//g; s/#.*$//; if (/^\s*(\$LOGTAIL|\S*logtail)\s+(\S+)/) { push(@logfiles, $2); } } close(CHECK); if (@logfiles) { print "\n"; print "\n"; } # Display run times for logcheck &foreign_require("cron", "cron-lib.pl"); @jobs = &cron::list_cron_jobs(); JOB: foreach $j (@jobs) { local $rpd; if ($j->{'command'} =~ /$config{'logcheck'}/) { $job = $j; last; } elsif ($rpd = &cron::is_run_parts($j->{'command'})) { local @exp = &cron::expand_run_parts($rpd); foreach $e (@exp) { if ($e =~ /logcheck/) { # Cannot change this :( $runparts = $e; last JOB; } } } } if ($runparts) { print "\n"; print "\n"; } else { print "\n" if ($job); print "\n"; } print "
$text{'logcheck_to'}
$text{'logcheck_hacking'}
\n"; print "
$text{'logcheck_violations'}
\n"; print "
\n"; $violations_ign = &find_value("VIOLATIONS_IGNORE_FILE", $conf, 1); print "$text{'logcheck_violations_ign'}
\n"; print "
$text{'logcheck_ignore'}
\n"; print "
$text{'logcheck_files'}",join(" ", map { "$_" } @logfiles),"
",&text('logcheck_runparts', "$runparts"),"
\n"; $job = { 'mins' => 0, 'hours' => '*', 'days' => '*', 'months' => '*', 'weekdays' => '*' } if (!$job); printf " %s\n", $job->{'active'} ? "" : "checked", $text{'logcheck_disabled'}; printf " %s
\n", $job->{'active'} ? "checked" : "", $text{'logcheck_enabled'}; print "\n"; &cron::show_times_input($job); print "

\n"; print "
\n"; &ui_print_footer("", $text{'index_return'});