freeradius 1.1.6 / syslog problems
Andreas Wetzel
mickey242 at gmx.net
Tue Jul 3 04:58:10 CEST 2007
Jay Banks wrote:
> Here is the same problem, found in the archives for this list, which was
> posted back in January of 2004:
>
> BUG?? Couldn't open syslog/radius.log for logging: Not a directory
>
> Problem Summary: radiusd: radiusd: Couldn't open syslog/radius.log for
> logging: Not a directory
>
> Problem Detials: It appears that freeradius is attempting to log to a file
> when asked to to log to the syslog. Listed below is the config settings and
> init script to confirm correct settings. In looking at the source, it
> appears that RADLOG_SYSLOG is never defined and as such has a null value
> when being evaluated in the following code snippets:
>
> *************radiusd.c**********************
>
> #if HAVE_SYSLOG_H
> /*
> * If they asked for syslog, then give it to them.
> * Also, initialize the logging facility with the
> * configuration that they asked for.
> */
> if (strcmp(radlog_dir, "syslog") == 0) {
> openlog(progname, LOG_PID, syslog_facility);
> radlog_dest = RADLOG_SYSLOG;
> }
> /* Do you want a warning if -g is used without a -l to activate it?
> */
> #endif
> if (strcmp(radlog_dir, "stdout") == 0) {
> radlog_dest = RADLOG_STDOUT;
> } else if (strcmp(radlog_dir, "stderr") == 0) {
> radlog_dest = RADLOG_STDERR;
> }
RADLOG_SYSLOG is defined, at least in 1.1.6. The problem is that 'radlog_dest'
has a default setting of:
radlog_dest_t radlog_dest = RADLOG_FILES;
And the above processing of the special 'syslog/stdout/stderr' keywords in
'radlog_dir' which changes 'radlog_deest' to RADLOG_SYSLOG, does not take
place until after the config file(s) have been read and modules have been
setup by setup_modules().
This means if anything calls radlog()/vradlog() before, then radlog_dest will
contain RADLOG_FILES, and the value from 'radlog_dir' will be suffixed with
the default log file name, which gives 'syslog/radius.log'.
A simple solution to this problem would be to change the default setting of
'radlog_dest' to RADLOG_SYSLOG and recompile. But then you wont be able to
ever log to a file again, which might be ok if you intent on using syslog only
anyway.
The better way is probably moving the code block, that calls setup_modules()
after the block that sets up 'radlog_dest' according to the special values
from radlog_dir. So the radlog_dest variable would already been set correctly
when setup_modules() runs.
Anyway, the best solution would be to have a separate commandline switch,
whose sole purpose is to set the log destination, and which is made effective
immediately when commandline option processing occurs. i.e.
radiusd -g files (*default*)
radiusd -g syslog at daemon
radiusd -g stdout
radiusd -g stderr
The current '-g' commandline option, which only sets the syslog facility is
BTW not documented in the program usage output.
best regard, Andreas
--
Keep it icy man.
I don't want to end up a corpse before my time because you were daydreaming.
More information about the Freeradius-Users
mailing list