[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gnu-radius] Best Radius is GNU Radius ?
From: |
Maurice Makaay |
Subject: |
Re: [Help-gnu-radius] Best Radius is GNU Radius ? |
Date: |
Wed, 12 Nov 2003 20:52:22 +0100 |
Hi,
> > With a database back end for the usernames/passwords scripting maintenance
> > should be a piece of cake. cron a script to clean out the database of the
> > users who have expired, or setup your mysql query in radius to check for
> > account age.
>
> thank you very much , im greatful , but do you have anyidea about how i can
> tell mysql when user active for first time ?
>
> you know , i sell internet cards , i cant start 30 day from day i have create
> them , maybe one of cards have been sale 5 mount after creation , what i
> solution about this ?
What you could do is use the radius accounting for that. If you have stored
your users into a database backend then things will be pretty easy. Simply
add two fields to the users table like "started" (some boolean kind of
field) and "startdate" (date field). Set the "started" field to a false
value and the "startdate" field to NULL.
What you now can do is enable SQL accounting in raddb/sqlserver. Change
the queries that handle accounting start-records to update the "started"
field of the user to a true value. You do not have to use the alive- and
stop-records.
Now use cron to update the "startdate" field for each user to now() which has
"started" set to a true value and "startdate" set to NULL. If you get as
far as this, you'll be able to have another cron cleanup users which have
gone beyond the 30 day usage period.
Of course you can also use the regular way of doing SQL-accounting, but
that will make the scripting somewhat more complicated. If the accounting
data would not have to be in the database backend (but only in the detail
accounting files), I would go for changing the sqlserver file to do a
simple update like I described above.
If you're hacking at the sqlserver file anyway, you could as well add a check
for due logins there (parallel to your cron which cleans up due users from
the database). Simply use an authentication SELECT statement where you include
something like "WHERE startdate < now()-30" to do a live check on the user
being due or not.
I hope this is useful to you.
Regards,
-- Maurice Makaay