(RADIATOR) RADONLINE cleanup script

Ayotunde Itayemi aitayemi at metrong.com
Tue Jun 10 03:43:31 CDT 2003


HI Ingvar,

I assume this script will work with an Oracle DB.
My question is do all NASes send alive packets - even Windows 2000 servers
using RADIUS authentication?

A related question: I have a couple of Windows 2000 servers with multiple IP
addresses. I have noticed that I
have to manually delete a lot of stale session records using the radwho.cgi
scripts regularly. I suspect this is due
to the NAS discarding packets from the radius server (with multiple IPs
too!) or vice versa. Any ideas?

The client config on my radius server has all the IP addresses of the
windows boxes listed.
As far as I know I dont think windows gracefully falls back to an
alternative radius server in the case of a
failure of the primary radius server listed in RRAS config - your opinions
please.

Regards,
Tunde Itayemi.


----- Original Message -----
From: "Ingvar Bjarnason" <ingvarbj at centrum.is>
To: <radiator at open.com.au>
Sent: Friday, June 06, 2003 4:21 PM
Subject: (RADIATOR) RADONLINE cleanup script


Hi all,

    Just wanted to share a little perl script we are using to clean stale
sessions from our session database (nb. this is a temporary fix, the long
term plan is to ask the access servers which has proven to be rather
involved).   This script basically finds entries older than 3 hours (no
alive packet for 3 hours usually means the session is dead), deletes them
and free´s up the corresponding ip from a dynamic IP pool also in sql.
This script is run from cron every hour.   (nb. this version is boiled down,
the actual script also does reporting via email of any deletions etc.)
Hope someone finds this useful.

    Best regards,
                                Ingvar

----
Ingvar Bjarnason
Engineer/Data Division
Iceland Telecom

**************************************
#!/usr/bin/perl
use DBI;
use strict;

my $username = 'username';
my $password = 'password';
my $hostname = 'localhost';

my $dbh = DBI->connect("DBI:mysql:radius:$hostname", $username, $password)
|| die "Cannot connect to DB\n";
my ($sth, $sth1);

my $sql;
my $sql2;

# Remove entries older than 3 hrs
my $currdate = `date +%s` - 10800;

$sql = "select USERNAME from RADONLINE where TIME_STAMP < $currdate";

$sth = $dbh->prepare($sql);
$sth->execute;
my $rowcnts = $sth->rows;

if( $rowcnts ) {
   $sql = "delete from RADONLINE where TIME_STAMP < $currdate";
   $sth1 = $dbh->prepare($sql);
   $sth1->execute;
   $sth1->finish;

   while (my @data = $sth->fetchrow_array) {
     $sql = "update RADPOOL set STATE=0 where USERNAME='$data[0]'";
     $sth1 = $dbh->prepare($sql);
     $sth1->execute;
     $sth1->finish;
   }
}

$sth->finish;
$dbh->disconnect;
********************************

===
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.

===
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