[ previous ] [ next ] [ threads ]
 From:  "Jonathan De Graeve" <Jonathan dot De dot Graeve at imelda dot be>
 To:  <pixsell at gmail dot com>
 Cc:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  RE: [m0n0wall] maximum download size per day
 Date:  Sat, 10 Sep 2005 13:29:00 +0200
This is a what I did:




sqlcounter volumelimit {                 

                counter-name = Octets-Total

                check-name = Max-Octets

                sqlmod-inst = sql                

                key = User-Name

                reset = monthly


                # This query will calculate the total volume used

                query = "SELECT (SUM(AcctInputOctets)
+SUM(AcctInputGigawords * 2147483648) +SUM(AcctOutputOctets)

gawords * 2147483648)) / 1048576 FROM radacct WHERE UserName = '%{%k}'
AND AcctStartTime > FROM_UNIXTIME('%b')"




If you want daily resets, just use reset = daily instead of monthly


In your radiusd.conf put: 


$INCLUDE ${confdir}/sqlcounter.conf


And in your authorize section put: volumelimit.




echo "ATTRIBUTE       Max-Octets              3000    integer" >>


The Max-Octets are in MB (to workaround the limit of a signed integer)


The attribute can be set in the radreply or radgroupreply


Be aware that you need the experimental modules to be compiled in. If
you run debian I have precompiled packages


Kind Regards


Jonathan De Graeve
Network/System Administrator
Imelda vzw
Informatica Dienst