Do the following


STEP 1:

nano counters.conf

sqlcounter dailycounter {

                counter-name = "Daily-Session-Time"

                check-name = "Max-Daily-Session"

                reply-name = "Session-Timeout"

                sqlmod-inst = "sql"

                key = "User-Name"

                reset = "daily"

                cache-size = 5000

                query = "SELECT SUM(acctsessiontime) FROM radacct WHERE username = '%{%k}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"

}


STEP 2:

nano radiusd.conf

instantiate {

        dailycounter

}


STEP 3: 

nano sites-available/default

authorize {

 dailycounter

}


STEP 4: 

accounting {

sql

}

STEP 5: LOOK, THIS MUST BE CHECK & REPLY ITEM NOT CHECK ONLY. BOB IS ALLOWED FOR 60 MINUTES, VALUE IS IN SECONDS. 

Max-Daily-Session := 3600


STEP 6: Restart Radius Daemon

RM --


On Mon, May 12, 2014 at 11:28 AM, * <zhex900@gmail.com> wrote:

Hi,

I have to follow this tutorial to get the the session limit working. But looking at the debug output it seems the sql counter is not executed. No Session-Timeout is sent to NAS as well.

Accounting is working fine. I can see all the accounting information radacct time.

Here is my configuration. Please let me know if I should provide more information.

Jake He

FreeRADIUS V. 3

mods-enabled/sqlcounter

sqlcounter noresetcounter {
        sql_module_instance = sql
        #dialect = ${sql_module_instance}.dialect
        dialect = mysql
        counter_name = Daily-Session-Time
        check_name = Max-Daily-Session
        reply_name = Session-Timeout
        key = User-Name
        reset = never
        query = “SELECT SUM(AcctSessionTime) FROM radacct where UserName=’%{%k}’”

sites-enabled/default:

authorize {

preprocess
chap
mschap
suffix
eap
files
sql
pap
noresetcounter
}

radcheck:
Max-Daily-Session:=60 for the user bob


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