Bug#344553: [Logcheck-devel] Bug#344553: logcheck: Fails silently to read config file

Markus Peuhkuri puhuri at iki.fi
Sat Dec 31 16:32:51 UTC 2005


Maximilian Attems wrote:
>>> if [ -r $CONFFILE ]; then

> i'm less then sure that this the right way to go,
> we shouldn't need the $CONFFILE?
> 
> what was the error message you were seeing?

The problem is that logcheck fails silently, if there is some problem
with config file; either typo or some problem with permissions.

Maybe a good alternative would be checking if $CONFIGFILE is set, like
below:

if [ -r $CONFFILE ]; then
      . $CONFFILE
elif [ ! -z "$CONFFILE" ]; then
     error "Config file $CONFFILE not exists or readable"
fi

Now, if CONFFILE is not set, then no error is printed, but if CONFFILE
is set but the file is not readable (or exists) then an error is printed.

The reason I suggested this was that I spent a good time wondering why
my changes did not change reporting while testing for #307585.  The
problem was that my temporary config file was mode 600 with my userid
and when run with "sudo -u logcheck logcheck -t -c newconfig", the
logcheck uid was unable to read it but did not report any error.

-- 
Markus Peuhkuri | http://www.iki.fi/puhuri/







More information about the Logcheck-devel mailing list