(RADIATOR) Patch: Allow AuthLog SYSLOG and Log SYSLOG use different facilities

Heikki Vatiainen hvn at archred.com
Tue May 18 13:53:30 CDT 2004


Currently Radiator supports logging authentication success and failure
events and other messages via syslog. What we tried to do was to configure
different facilities for both types of messages. Our configuration was
similar to this:

<Log SYSLOG>
    Facility local2
    Trace 4
</Log>
<AuthLog SYSLOG>
    Facility local1
    LogSuccess 1
    LogFailure 1
</AuthLog>

What happened was that all the messages were logged with syslog facility
local1. If the order of the blocks was reversed, all messages were still
logged but this time with facility local2.

A quick look showed that when the configuration is read, openlog() is
called for both blocks and the block that is the last to use logging via
syslog determines which facility is used for all messages that are sent
to syslog.

The patch below explicitly sets the facility every time a message is
logged and makes it possible to separate authentication messages from
the rest of the messages.

Please consider this patch for the future versions of Radiator.

This changes the existing behaviour in the case that someone is using
the Facility keyword only once and both Log and AuthLog configuration
blocks are specified. In this case the block that does not specify the
facility will use the default which is 'user'.



--- 3.9_2004-05-11.orig/Radius/AuthLogSYSLOG.pm	2003-08-01 04:42:28.000000000 +0300
+++ 3.9_2004-05-11.archred.log.facility/Radius/AuthLogSYSLOG.pm	2004-05-17 23:36:58.000000000 +0300
@@ -100,7 +100,7 @@
     }
 
     # syslog can die:
-    eval {syslog($self->{Priority}, $str)};
+    eval {syslog("$self->{Facility}|$self->{Priority}", $str)};
     &main::log($main::LOG_ERR, "Error while doing AuthLog SYSLOG: $@")
 	if $@;
 }
--- 3.9_2004-05-11.orig/Radius/LogSYSLOG.pm	2003-09-23 02:31:33.000000000 +0300
+++ 3.9_2004-05-11.archred.log.facility/Radius/LogSYSLOG.pm	2004-05-17 23:46:57.000000000 +0300
@@ -68,7 +68,7 @@
 
     if ($self->willLog($priority, $p))
     {
-	eval {syslog($priorityToSyslog[$priority], $s)};
+	eval {syslog("$self->{Facility}|$priorityToSyslog[$priority]", $s)};
 	&main::log($main::LOG_ERR, "Error while doing Log SYSLOG: $@")
 	    if $@;
     }


-- 
Heikki Vatiainen
Arch Red Oy, Tampere, Finland

--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list