(RADIATOR) Validation of multiple MSISDNs against one user name

Chris Patterson Chris.Patterson at transact.com.au
Tue Jul 13 17:47:05 CDT 2004


Hi Martin,
    I use a PostAuthHook to assign an IP address from the
DynamicAddressPool.  The nice part about this is that I initially setup
the pool in the radiator configuration file, and then after it had been
created, commented that part out.

I used the goodies/hooks.txt as a basis for my script.

Essentially: - check for the username - if it exists then assign that
address, and if it dosn't then assign the next "vacant" address.  

Only thing to watch out for is timeouts (if your dynamic pool is very
large), then indexing is going to be an issue... (I have the username
field indexed...)  

Hugh - feel free to add this into goodies if you wish (although it's
really only an extention of what is already there)

Cheers
Chris.

#!/usr/local/bin/perl
# -*- mode: Perl -*-
#
# AddressAllocation
#
# Reply hook to allocate IP Addresses to STB's
# when the STB successfully authenticates.
#
use strict;
sub {
  my $p = ${$_[0]};
  my $rp = ${$_[1]};
  my $result = ${$_[2]};
  my $code = $p->code;
  my $pool = $rp->get_attr('PoolHint');
  my $user = $p->get_attr('User-Name');
  my ($addr,$dbh,$sth);
  &main::log($main::LOG_DEBUG,"Calling PostAuthHook to obtain STB
IPAddress");
  &main::log($main::LOG_DEBUG,"code=$code,pool=$pool,UserName=$user");
  my $dbh=Radius::AuthGeneric::find('STB_Authentication');
  if ($code eq 'Access-Request' && $result eq $main::ACCEPT) {
    $rp->delete_attr('Framed-IP-Address');
    $rp->delete_attr('Framed-IP-Netmask');
    my $sth=$dbh->prepareAndExecute("select YIADDR from RADPOOL where
POOL=\'$pool\' and USERNAME=\'$user\' limit 1");
    my $rows=$sth->execute();
    &main::log($main::LOG_DEBUG,"found $rows instances of User: $user in
Pool: $pool");
    if ($rows eq 1) {
      $addr="@{$sth->fetch}";
      &main::log($main::LOG_INFO,"Framed-IP-Address obtained: \"$addr\"
for $user");
      $sth->finish;
    } else {
      $sth=$dbh->prepareAndExecute("select YIADDR from RADPOOL where
STATE=0 and POOL=\'$pool\' limit 1");
      $addr="@{$sth->fetch}";
      &main::log($main::LOG_INFO,"IP Address \"$addr\" for $user
assigned from pool: \"$pool\"");
      $sth->finish;
      $dbh->do("update RADPOOL set STATE=1, USERNAME=\'$user\' where
YIADDR=\'$addr\'") || die &main::log
              ($main::LOG_ERR,"Unable to update RADPOOL database
$DBI::errstr");
    }
    $rp->add_attr('Framed-IP-Address',$i3addr);
    $rp->delete_attr('PoolHint');
  } elsif ($code eq 'Accounting-Request') {
      $dbh->handle_request($p,$rp);
  }
  return;
}

-----Original Message-----
From: Cockerell Martin (UK) [mailto:Martin.Cockerell at O2.com]
Sent: Wednesday, 14 July 2004 2:39 AM
To: 'radiator at open.com.au'
Subject: (RADIATOR) Validation of multiple MSISDNs against one user name


I have been experimenting with using Radiator to assign a fixed IP
address to an incoming connection based on MSISDN; however, at present I
seem to need a full entry in the users file for each MSISDN (either a
separate username with Calling-Station-Id added as an extra check
parameter or substituting Calling-Station-Id for username as shown in
the MSISDN.hook goodies file).

Ideally what I would like to do is have a single username/password
combination for a group of users, with the allocated IP address being
determined by the individual MSISDN - this is to allow me to support
several large groups of users where the main requirement is to validate
an individual MSISDN and assign the same IP address every time.

I am hoping to pass maintenance of the MSISDN/IP address list to someone
less technical than my support team.  I'm beginning to think that the
most reliable way of handling this is with a simple SQL table (with some
form of web front-end) that Radiator uses to look-up the IP address.
Can anyone think of a better way?

Regards,
Martin Cockerell

ADE Trials and Architecture Manager
O2 Limited




========================================================
This electronic message contains information from the mmO2 plc Group 
which may be privileged or confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you are
not
the intended recipient be aware that any disclosure, copying
distribution or use of the contents of this information is prohibited.
If you
have received this electronic message in error, please notify us
by telephone or email (to the numbers or address above) immediately.
========================================================

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