(RADIATOR) radiator hooks

Hugh Irvine hugh at open.com.au
Thu Jun 2 21:33:07 CDT 2005


Hello Jason -

Here is an example PostAuthHook to check for Acct-Status-Type = Stop:

sub
{
     my $p = ${$_[0]};
     my $rp = ${$_[1]};
     my $result = ${$_[2]};

     my $acctstatus = $p->get_attr('Acct-Status-Type');

     if ($acctstatus eq 'Stop')
     {
         &main::log($main::LOG_DEBUG,"This is an accounting Stop");
      }
     return;
}

regards

Hugh


On 3 Jun 2005, at 11:59, Jason Stechschulte wrote:

> On Fri, Jun 03, 2005 at 11:16:25AM +1000, Hugh Irvine wrote:
>
>> This is quite simple to do with a single AcctSQLStatement - see
>> "goodies/prepaid.cfg" for an example.
>>
>
> Wow, I was making this *much* more difficult that it had to be.   
> This is
> actually pretty simple.  Thanks.  I'd still like to try to figure out
> these hooks for future reference though.
>
>
>> In answer to your question about your hook - I suspect you have not
>> set an "Identifier" in your Client clause.
>>
>> And you should have a look at a trace 4 debug to see what requests
>> you are actually receiving, as it sounds like you are not receiving
>> any accounting requests at all.
>>
>
> Well here is a trace 4 debug showing an accounting start record:
> Thu Jun  2 21:37:55 2005: DEBUG: Packet dump:
> *** Received from 65.17.128.37 port 33428 ....
> Code:       Accounting-Request
> Identifier: 141
> Authentic:  <189><167>B<215>W<175><178>(<178><5><231>Hr<226>Dh
> Attributes:
>         Acct-Status-Type = Start
>         Acct-Session-Id = "875"
>         User-Name = "sputniktest at wcoil.com"
>         NAS-Identifier = "info.wcoil.com"
>         Framed-IP-Address = 192.168.190.10
>         Called-Station-Id = "00:0e:9b:9a:30:09"
>
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 21:37:55 2005: DEBUG: Handling request with Handler
> 'Realm=wcoil.com'
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to sputniktest
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to sputniktest
> Thu Jun  2 21:37:55 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 21:37:55 2005: DEBUG: sessions Adding session for
> sputniktest at wcoil.com, 65.17.128.37,
> Thu Jun  2 21:37:55 2005: DEBUG: do query is: 'delete from RADONLINE
> where NASIDENTIFIER='65.17.128.37' and NASPORT=00':
>
> Thu Jun  2 21:37:55 2005: DEBUG: do query is: 'insert into RADONLINE
> (USERNAME, NASIDENTIFIER, NASPORT, ACCTSESSIONID, TIME_STAMP,
> FRAMEDIPADDRESS, NASPORTTYPE, SERVICETYPE) values
> ('sputniktest at wcoil.com', '65.17.128.37', 0, '875', 1117762675,
> '192.168.190.10', '', '')':
>
> Thu Jun  2 21:37:55 2005: DEBUG: Handling with Radius::AuthSQL
> Thu Jun  2 21:37:55 2005: DEBUG: Handling accounting with
> Radius::AuthSQL
> ************
> Jason's Client Identifier =
> ************
> Thu Jun  2 21:37:55 2005: DEBUG: Accounting accepted
>
>
> And here is a trace 4 debug showing an accounting stop record:
> Thu Jun  2 22:01:26 2005: DEBUG: Packet dump:
> *** Received from 65.17.128.37 port 33478 ....
> Code:       Accounting-Request
> Identifier: 186
> Authentic:  p'<153>w<167>N<180><141><150><230>6<158>3BZ<210>
> Attributes:
>         Acct-Status-Type = Stop
>         Acct-Session-Id = "875"
>         User-Name = "sputniktest at wcoil.com"
>         NAS-Identifier = "info.wcoil.com"
>         Framed-IP-Address = 192.168.190.10
>         Acct-Session-Time = 1411
>         Acct-Input-Octets = 1507933
>         Acct-Output-Octets = 373818
>         Acct-Input-Packets = 3105
>         Acct-Output-Packets = 4070
>
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 22:01:26 2005: DEBUG: Handling request with Handler
> 'Realm=wcoil.com'
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to sputniktest
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to sputniktest
> Thu Jun  2 22:01:26 2005: DEBUG: Rewrote user name to
> sputniktest at wcoil.com
> Thu Jun  2 22:01:26 2005: DEBUG: sessions Deleting session for
> sputniktest at wcoil.com, 65.17.128.37,
> Thu Jun  2 22:01:26 2005: DEBUG: do query is: 'delete from RADONLINE
> where NASIDENTIFIER='65.17.128.37' and NASPORT=0':
>
> Thu Jun  2 22:01:26 2005: DEBUG: Handling with Radius::AuthSQL
> Thu Jun  2 22:01:26 2005: DEBUG: Handling accounting with
> Radius::AuthSQL
> Thu Jun  2 22:01:26 2005: DEBUG: do query is: 'insert into
> acct_table
> (ACCTINPUTOCTETS,ACCTOUTPUTOCTETS,ACCTSESSIONID,ACCTSESSIONTIME,ACCTST 
> ATUSTYPE,FRAMEDIPADDRESS,USERNAME)
> values
> (1507933,373818,'875', 
> 1411,'Stop','192.168.190.10','sputniktest at wcoil.com')':
>
> ************
> Jason's Client Identifier =
> ************
> Thu Jun  2 22:01:26 2005: DEBUG: Accounting accepted
>
> -- 
> Jason Stechschulte
> Network Administrator
> West Central Ohio Internet Link
> Lima, OH USA
>
> --
> 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.
>


NB:

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/ 
radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.


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