Re: prepaid timeouts

2002-05-29 Thread

Hello Michael,

Wednesday, May 29, 2002, 12:00:09 PM, you wrote:



MB I would like to use freeradius to offer a prepaid service where users
MB can buy a certain number of days and will have unlimited use untill that
MB period is up.

MB I created a field in the database with the 'credit expires' date and
MB have authorize_reply_query() returning a value for Session-Timeout so that
MB the NAS can inform/disconnect the user.

MB How can I reject a login and provide a message to the NAS if the current
MB time is later than the 'credit expires' time in the database? Can
MB authorize_check_query() result in a message being sent back to the NAS?
MB Is there another way to do this? I want the NAS to knnow it's a problem
MB with credit and not simple a wrong password.

MB My first (ugly) attempt to return Session-Timeout uses the following:

MB   authorize_reply_query = SELECT id,UserID,'Session-Timeout',
MB paidtill-unix_timestamp() FROM user WHERE Userid = '%{SQL-User-Name}'

MB This stops me using any other radreply values. Is there a cleaner way to
MB get the number of seconds till the 'credit expires' date into Session-Timeout?

For that purposes I wrote functions in postgresql that are running
from sql querys of radiusd.
-- 
Best regards,
Dinar  mailto:[EMAIL PROTECTED]



- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: prepaid timeouts

2002-05-29 Thread Michael Bailey

On Wed, May 29, 2002 at 09:07:43AM -0500, Chris Parker wrote:
 At 08:00 AM 5/29/2002 +, Michael Bailey wrote:
 Hello,
 
 I would like to use freeradius to offer a prepaid service where users
 can buy a certain number of days and will have unlimited use untill that
 period is up.
 
 Use the 'rlm_counter' or 'rlm_sqlcounter' module.  This is exactly what
 they were created for.

I don't think running a counter be the correct approach for this task.

I want users to be able to connect for as many hours as they wish between
now and next Tuesday. It's the date, not the number of hours online, that
determines whether they can connect or not. So the only counter I need is
the system clock.

Does anyone have a neat way of doing this (and returning Session-Timeout)?
I have altered the authorize_reply_query to compare current date with
timeout date to calculate and  return Session-Timeout but this only allows
one reply value. Is there somewhere else I can insert reply values as well?

The rlm_sqlcounter should be useful for another task, implementing
bandwidth limits. It's only in the CVS version at the moment and I think
I'll wait for it to go into a release before putting it on production
systems.

cheers,

Mike

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html