freeradius 1.1.6 / syslog problems

Jay Banks jbanks at nalcomwireless.com
Sun Jul 1 17:25:42 CEST 2007


> Both error messages seem to originate from modules during their 
> initialization
> (rlm_eap_tls / rlm_passwd). After a quick look at the source, I would say,
> this is due to calling radlog()/vradlog() from the module initialization 
> or
> elsewhere, *before* the 'radlog_dest' variable is correctly set to
> RADLOG_SYSLOG in src/main/radiusd.c. After radlog_dest has been set up 
> there,
> no more such error messages appear, and log goes correctly to syslog as it
> should.
>
> Andreas

Yes, I think you are right. I did some research and see other people have
had the same problem.

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;
        }

*************log.c**********************

       if (radlog_dest == RADLOG_NULL) {
                return 0;
        }

        if (debug_flag
            || (radlog_dest == RADLOG_STDOUT)
            || (radlog_dir == NULL)) {
                msgfd = stdout;

        } else if (radlog_dest == RADLOG_STDERR) {
                msgfd = stderr;

        } else if (radlog_dest != RADLOG_SYSLOG) {
                /*
                 *      No log file set.  It must go to stdout.
                 */
                if (!mainconfig.log_file) {
                        msgfd = stdout;

                        /*
                         *      Else try to open the file.
                         */
                } else if ((msgfd = fopen(mainconfig.log_file, "a")) ==
NULL) {
                         fprintf(stderr, "%s: Couldn't open %s for logging:
%s\n",
                                 progname, mainconfig.log_file,
strerror(errno));

                         fprintf(stderr, "  (");
                         vfprintf(stderr, fmt, ap);  /* the message that
caused the log */
                         fprintf(stderr, ")\n");
                         return -1;
                }
        }

#if HAVE_SYSLOG_H
        if (radlog_dest == RADLOG_SYSLOG) {
                *buffer = '\0';
                len = 0;
        } else
#endif


*********CONFIGURATION FILE SETTINGS*************************

prefix = /usr/local
exec_prefix = ${prefix}
sysconfdir = ${prefix}/etc
localstatedir = ${prefix}/var
sbindir = ${exec_prefix}/sbin
#logdir = ${localstatedir}/log/radius
logdir = syslog
raddbdir = ${sysconfdir}/raddb
#radacctdir = ${logdir}/radacct
confdir = ${raddbdir}
run_dir = ${localstatedir}/run/radiusd
libdir = ${exec_prefix}/lib
pidfile = ${run_dir}/radiusd.pid
#user = nobody
#group = nobody
max_request_time = 30
delete_blocked_requests = no
cleanup_delay = 5
max_requests = 1024
bind_address = XX.XX.XX.XX
port = 0
hostname_lookups = no
allow_core_dumps = no
regular_expressions     = yes
extended_expressions    = yes
log_stripped_names = yes
log_auth = yes
log_auth_badpass = yes
log_auth_goodpass = no

*********INIT SCRIPT*************************

# Source function library.
. /etc/rc.d/init.d/functions

RADIUSD=/usr/local/sbin/radiusd
LOCKF=/var/lock/subsys/radiusd
CONFIG=/usr/local/etc/raddb/radiusd.conf

[ -f $RADIUSD ] || exit 0
[ -f $CONFIG ] || exit 0

RETVAL=0

case "$1" in
  start)
        echo -n $"Starting RADIUS server: "
        daemon $RADIUSD
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $LOCKF &&
            ln -s /var/run/radiusd/radiusd.pid /var/run/radiusd.pid
2>/dev/null
        ;;
  stop)




More information about the Freeradius-Users mailing list