On Saturday 21 June 2003 3:52 am, Andrea Coppini wrote:
> I want to sell an amount of time (eg. 10 hours) which the users can use as
> much as they want from it whenever they want....
> I've tried using 'session-limit', which is ... counting down correctly, but
> when he/she logs out and logs back in, the time is reset to the original ...

the solution is to set up a "counter" with "reset=never".  I'm doing the same 
thing [wireless hotspot, pre-paid "one hour" cards, etc.] and for the most 
part the following seems to work for me:

[in modules]
        counter lifetime {
                filename        = ${raddbdir}/db.lifetime
                key             = User-Name
                count-attribute = Acct-Session-Time
                reset           = never
                counter-name    = lifetime-session-counter
                check-name      = lifetime-limit
                cache-size      = 5000
        }

[in instantiation]
        lifetime

[in authorize]
         ...
         sql
         lifetime
         ...

[in accounting]
         lifetime

[in the SQL database -- radgroupcheck]
     groupname: onehour
     attribute: lifetime-limit
     op:   :=
     value:   3600

[if you are using a "user file" instead of an SQL database, you would include 
"lifetime-limit = 3600" in the check items part of an entry, i.e., the first 
line of the entry]

users are associated with the "onehour" group via an entry in usergroup table, 
though for a one-element group check item, you could simply put that item 
into the radcheck table and not bother with a group...

BIG HUGE CAVEAT: the current production version (0.8.1) has a bug with 
"reset=never" -- it resets when the program restarts.  This is fixed in the 
CVS/development sources, so it should be in 0.9 [due to be released in like a 
couple weeks or less, from what I hear...]


-- 
Yet another Blog: http://osnut.homelinux.net

Attachment: pgp00000.pgp
Description: signature

Reply via email to