(RADIATOR) Hooks in Accounting only servers?
Cassidy B. Larson
butch at infowest.com
Thu Jan 10 18:21:16 CST 2002
I'm working on a new little feature that takes the 'Account-Output-Octets'
and 'Account-Input-Octets' within the Accounting Stop packet and
increments a particular users monthly record in a table I have created. If
there
is not a record for the month with this username it creates one with the
information.
My current setup is that I have separated my Authentication and Accounting
servers into two different config files while running two different Radiator
processes
each with its own config.
Can PostAuthHooks work within an accounting only radiator?
I'm getting these errors in my accounting-logfile upon restarting my radius:
ERR: Unknown keyword '...../raddb/datatransmit.hook' in
/usr/local/etc/radius-accounting.cfg line 0
Wierd I know...
Here's a snipit from my radius-accounting.cfg file...
<Handler Realm=infowest.com>
<AuthBy GROUP>
AuthByPolicy ContinueWhileReject
<AuthBy GROUP>
AuthByPolicy ContinueWhileAccept
AuthBy DefaultAuth
<AuthBy FILE>
Filename /data/radiator/raddb/users
</AuthBy>
PostAuthHook
file:"/data/radiator/raddb/datatransmit.hook"
The file above does exist. Here is is, if anybody cares.. It doesn't produce
any errors when
run directly with perl.
sub {
my $p = ${$_[0]};
my $identifier;
my $d;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time());
$year += 1900;
$mon += 1;
my $DATE = "'".$year."-".$mon."'";
my $username = $p->get_attr('Username');
my $class = $p->get_attr('Class');
my $IN = $p->get_attr('Acct-Input-Octets');
my $OUT = $p->get_attr('Acct-Output-Octets');
if (!$IN) { $IN = 0; }
if (!$OUT) { $OUT = 0; }
my $dbh =
DBI->connect("DBI:mysql:****:**********","radiusupdate","*********");
if (($d = $dbh->do("SELECT USERNAME from DATATRANSMIT where
USERNAME=if('$class' LIKE '%#IW', '
$username\@infowest.com',if('$class' LIKE
'%#NU','$username\@netutah.com','$username')) AND DATE=$DATE")) > 0) {
$dbh->do("UPDATE DATATRANSMIT SET
IN_TRANSFER=IN_TRANSFER+$IN,OUT_TRANSFER+$OUT where USERNAME=if('$class'
LIKE '%#IW', '$username\@infowest.com',if('$class' LIKE
'%#NU','$username\@netutah.
com','$username')) AND DATE=$DATE");
} else {
$dbh->do("INSERT INTO DATATRANSMIT
(USERNAME,DATE,IN_TRANSFER,OUT_TRANSFER) VALUES (if('$class' LIKE '%#IW',
'$username\@infowest.com',if('$class' LIKE
'%#NU','$username\@netutah.com','$username')),$DATE,$IN,$OUT)");
}
$dbh->disconnect || warn $dbh->errstr;
return;
}
Within the goodies/hooks.txt file that Hugh always refers people to, I see
this:
<Handler ....>
<AuthBy ....>
....
</AuthBy>
PostAuthHook file:"%D/replaceProfiles"
</Handler>
So I assume my syntax in my radius config is correct.. Problem being the
error in the logfile.
Ideas?
Cassidy
----
Cassidy B. Larson -- Network Operations Manager
InfoWest, Inc. * 596 E. Tabernacle * St. George, UT 84770
Voice: 435-674-0165 * FAX: 435-674-9654
butch at infowest.com
----
===
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