[RADIATOR] quota counter updates on "quotacounter" mysql table

Thomas Kurian thomas at kccg.com
Thu Feb 7 05:54:07 CST 2013


Dear All,
At accounting stop, the table 'quotacounter' must be updated with 
incremented values of 'totalcounter' and 'monthlycounter'. This is 
'monthlycounter=monthlycounter+Acct-Input-Octets' and 
'totalcounter=totalcounter+Acct-Input-Octets' . Acct-input-octets 
attribute value is to be retrieved from the accounting stop packet sent 
from the cisco NAS ,for being incremented with the totalcounter and 
monthlycounter._

_The accounting table is getting updated but the is no updates in the 
quotacounter table.  I have added users in the username column of the 
quotacounter table and also set totalcounter and monthly counter to the 
value zero.I have also set type = Q.



Can you check the configuration below and advice me.


# radius.cfg


#Foreground
#LogStdout

AcctPort 1813
AuthPort 1812

BindAddress 0.0.0.0


LogDir          /var/log/radius
DbDir           /etc/radiator
# Use a low trace level in production systems. Increase
# it to 4 or 5 for debugging, or use the -trace flag to radiusd
Trace           4

# You will probably want to add other Clients to suit your work site,
# one for each NAS you want to work with


<Client DEFAULT>
         Secret  xxxxxxxx
         DupInterval 0
</Client>

#<Client 94.187.135.175>
  #       Secret  ciscowimd85
   #      DupInterval 0
    #     NasType Cisco
#</Client>

#<Client 94.187.135.222>
#       Secret  xxxxxxxx
#       DupInterval 0
#        NasType Cisco
#</Client>

<Client 10.50.1.4>
         Secret  xxxxxxxx
         DupInterval 0
         NasType Cisco
         IgnoreAcctSignature
</Client>

<Realm DEFAULT>
         <AuthBy SQL>

                 DBSource dbi:mysql:radius
                 DBUsername xxxxxxxx
                 DBAuth xxxxxxxx



                 AccountingTable ACCOUNTING
                 AcctColumnDef   USERNAME, User-Name
                 AcctColumnDef   ACCTSTATUSTYPE,Acct-Status-Type
                 AcctColumnDef   FRAMEDIPADDRESS,Framed-IP-Address
                 AcctColumnDef   ACCTINPUTOCTETS,Acct-Input-Octets
                 AcctColumnDef   ACCTOUTPUTOCTETS,Acct-Output-Octets
                 AcctColumnDef   TIME_STAMP,Event-Timestamp
                 AcctColumnDef   ACCTSESSIONTIME,Acct-Session-Time
                 AcctColumnDef   ACCTDELAYTIME,Acct-Delay-Time
                 AcctColumnDef   ACCTSESSIONID,Acct-Session-Id
                 AcctColumnDef ACCTTERMINATECAUSE,Acct-Terminate-Cause
                 AcctColumnDef   NASIDENTIFIER,NAS-Identifier
                 AcctColumnDef   NASPORT,NAS-Port
                 AcctColumnDef   ACCTSESSIONID,Acct-Session-Id

         </AuthBy>
         # Log accounting to a detail file
         AcctLogFileName %L/detail

#For strictly operating at accounting start

<Handler Acct-Status-Type = Start>

         PostAuthHook file:"%D/thomas.pl";

</Handler>


_#For strictly processing with Accounting Stop packets__
__
__<Handler Acct-Status-Type = Stop>__
__
__<AuthBy SQL>__
__    Identifier Block-Quota-SQL__
__
__    DBSource        dbi:mysql:radius__
__    DBUsername _xxxxxxxx_
__    DBAuth _xxxxxxxx_
__
__  AccountingStopsOnly__
__  AccountingTable   quotacouunter__
__                AuthColumnDef   username,User-Name,check__
__
__
__
__
__
__
__  AuthSelect select monthlycounter from quotacounter \__
__        where username='%n' \__
__        And type = 'Q'__
__    #AuthColumnDef 0, Session-Timeout, reply__
__
__    AcctSQLStatement update quotacounter set \__
__        monthlycounter=monthlycounter+0%{Acct-Input-Octets} \__
__        where username='%n' \__
__        And Type = 'Q'__
__
__ AuthSelect select totalcounter from quotacounter \__
__        where username='%n' \__
__        And Type = 'Q'__
__
__    AcctSQLStatement update quotacounter set \__
__        totalcounter=totalcounter+0%{Acct-Input-Octets} \__
__        where username='%n' \__
__        And Type = 'Q'__
__
__</AuthBy>__
__
__</Handler>__
_


# Accept processing of other accounting requests of the genre start and 
interim

  <Handler Request-Type = Accounting-Request>

         <AuthBy INTERNAL>
                 AcctResult ACCEPT
         </AuthBy>

  </Handler>



</Realm>

-- 
Best Regards,

Thomas Kurian
IT Security Engineer (B.Tech. -- Electrical)
Kuwaiti Canadian Consulting Group (www.kccg.com)
T: +965 22435566
F: +965 22415149
E: thomas at kccg.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open.com.au/pipermail/radiator/attachments/20130207/e0c683fd/attachment.html 


More information about the radiator mailing list