(RADIATOR) radiator hooks

Hugh Irvine hugh at open.com.au
Thu Jun 2 20:16:25 CDT 2005


Hello Jason -

This is quite simple to do with a single AcctSQLStatement - see  
"goodies/prepaid.cfg" for an example.

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.

regards

Hugh


On 3 Jun 2005, at 10:28, Jason Stechschulte wrote:

> On Fri, Jun 03, 2005 at 09:44:14AM +1000, Hugh Irvine wrote:
>
>> What exactly are you trying to do with the Stop record? If it is just
>> to update an SQL table you can use an AcctSQLStatement directly in
>> your AuthBy SQL clause.
>>
>
> We are allowing people to purchase time.  If someone purchases 4  
> hours,
> but logs out after using 2, we want to calculate how much time they
> used, and subtract it from their remaining time.  Basically, the  
> plan is
> to set Session-Timeout to however much time they purchased, and update
> that when the stop record is received.  If they used all of their  
> time,
> we will set Expiration to the previous day so that they can't login
> anymore until purchasing more time.  I don't think an AcctSQLStatement
> will work since I think this will involve multiple queries and
> calculations.  I could be wrong though.
>
>
>> If you do want to use a hook, you should  realise that there are two
>> different things happening with the radius  protocol - the first is
>> authentication and the second is accounting.  You will want your hook
>> code to check that it is in fact dealing with  a Stop
>> (Acct-Status-Type = Stop) and then do whatever you wish.
>>
>
> I am aware of that, but I can't seem to check the Acct-Status- 
> Type.  So
> far, I haven't been able to access anything from the request.  Using
> your example, I get the request variable and dereference it using:
>
> my $p = ${$_[0]};
>
> Then I try to just see if I can get the identifier using:
>
> my $identifier = $p->{Client}->{Identifier};
>
> Then I print it using:
>
> print "********\nJason's Client Identifier = $identifier\n********\n";
>
> When I run radiusd from the command line as you recommended, I see the
> following for the different requests:
>
> ********
> Jason's Client Identifier =
> ********
>
>
>> I wrote most of the example hooks so if you have any questions please
>> ask.
>>
>
> If you see anything blatantly wrong with the above, I would appreciate
> some help with it.  I'll look at the Radiator source as you mentioned
> and look at some more examples to see if I can find out what I'm
> missing.  Thanks for the help.
>
>
> -- 
> 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