I am using freeradius in order to authenticate users to access the internet over a mikrotik routerboard.

I would like to set up a maximum time limit in a default period of time in the mysql database. For instance I would like to accept a user to have a total connection time of 7 hours over a week period of time. What values and in which field of the database should I alternate.

The reference guide that I used for my implementation is here

I have tried playing around with various Variables in the group reply table of the database, and I got the reply on the test, but probably I am using wrong variables, for instance the Session-Time = 60 just resets the session every 60 seconds (just for testing) and not disconnecting the user.

  • I tried to add a group reply for the session time. But this just renews the session time every 60 seconds. (60 seconds was just for testing). – Vagelism22678 Jan 7 '15 at 19:39
  • Could you edit to include that? – Tim Jan 7 '15 at 19:42
  • Done just edited the question. – Vagelism22678 Jan 7 '15 at 19:45

A Session-Time will set the maximum time a session may take. This does not account for other rules like a maximum time over a day or a week. You need more logic for this than an attribute in your RADIUS reply.

A stateful storage is needed to keep track of the used time for a user. RADIUS accounting is sufficient for this purpose. For example, when storing accounting data in MySQL you can query the already used session time for a period to calculate a new Session-Time for the upcoming session.

FreeRADIUS has modules for this purpose: sqlcounter and counter. The documentation covers examples of implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.