I learned this while integrating phpmyprepaid into my radius server.
The purpose of this configuration is to limit a user by the time he use our network.
Let say as example I want to limit a user only 1 hour per prepaid card.
So what I did is define a counter using sqlcounter module in the radius.conf file;
— snipped —
sqlcounter timelimit {
counter-name = Max-All-Session-Time
check-name = Max-All-Session
sqlmod-inst = sql
key = User-Name
reset = never
query = “SELECT SUM(AcctSessionTime) FROM radacct where UserName=’%{%k}’”
}
— snipped —
In the configuration I set the check-name as Max-All-Session, this will apply to the the radcheck table. You can choose other name, the same name should be use in the radcheck table. in the query part is the sql query we use to get the data for accounting. From the above query radius server will get the sum of session time of the user from radacct table. It will compare with Max-All-Session check item and terminate the session when the time is reached.
but the server does not do accounting yet, to enable accounting we must specify the module we define in authorize section in the radius.conf.
— snipped —
authorize {
preprocess
chap
mschap
suffix
eap
files
sql
pap
timelimit
}
— snipped —
Then we need to restart/reload the server to make the new configuration take effect.
To force the setting to the user we must insert the regarding attribute into the radcheck table:
as example:
+–+———–+—————–+—+———-+
| id | UserName| Attribute | op | Value |
+–+———–+—————–+—+———-+
| 1 | user | User-Password | := | p45sw0rd |
| 2 | user | Max-All-Session | := | 3600 |
+–+———–+—————–+—+———-+
Rabu, 19 September 2007
Langganan:
Posting Komentar (Atom)

Tidak ada komentar:
Posting Komentar