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

Thomas Kurian thomas at kccg.com
Mon Feb 11 05:07:18 CST 2013


Dear All,
I have rearranged the configuration as per your recommendation below 
(config is attached at end), i have removed realms and using only handlers:

/But the first thing you should do is to reorganise your configuration file:/
/1. Use just Handlers
2. Handlers can not be inside Realms
3. Order the Handlers correctly: first matching Handler is selected

Maybe something like this:

# Global options
# <Client ...> clauses

<Handler Acct-Status-Type = Stop>
   # Config to handle just the Stops
</Handler>

<Handler Request-Type = Accounting-Request>
   # Maybe the contents of <Realm DEFAULT> from below go here?
</Handler>

I think part of the problem is the requests are not processed by
Handlers and AuthBys as you are planning. The configuration
reorganisation should help with that.



/

// But when i defined "Handler Acct-Status-Type = Stop" first (before 
Handler Request-Type = Accounting-Request) in my configuration, entries 
to "ACCOUNTING" table stops logging. But when the configuration is like 
the below, "ACCOUNTING" table does get updated with real time entries. 
But the issue which i noticed is that ,the  configuration lines  under 
the section  "Handler Acct-Status-Type = Stop" is not  working at all in 
either cases./

/ Note that : Here the "quotacounter" table is a table which was created 
by myself (after field definition in mysql) but there are no updates to 
the quotacounter table.
  "monthlycounter" and "totalcounter" fields are not getting updated in 
"quotacounter table" as expected.

  Is there something to be added in mysql configuration or radiator 
config under the section handler acct-status-type=stop.

Help me out, i am getting totally stuck here. According to radiator 
docs,  your previous email and other info  on net, my config seems to be 
okay. But there is no results though because of the above 
explained.Please check the configuration and recommend solution.


Current Configuration
#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  xxx
         DupInterval 0
</Client>


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

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

<Handler Request-Type = Accounting-Request>
         <AuthBy SQL>

                 DBSource dbi:mysql:radius
                 DBUsername xxx
                 DBAuth xxx



                 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


</Handler>






#For strictly processing with Accounting Stop packets

<Handler Acct-Status-Type = Stop>

         <AuthBy SQL>
    #Identifier Block-Quota-SQL

            DBSource        dbi:mysql:radius
            DBUsername      xxx
            DBAuth          xxx

            AccountingStopsOnly
            AccountingTable   quotacounter



   AuthSelect select username, monthlycounter, totalcounter from 
quotacounter \
         where username='%n' \
         And type = 'Q'

    AuthColumnDef 0, User-Name, check

    AcctSQLStatement update quotacounter set monthlycounter = 
monthlycounter + 0%{Acct-Input-Octets} \
        where username='%n' \
         And Type = 'Q'

  AuthSelect select username, 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'

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

</AuthBy>

</Handler>

-- 
Thanks & 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/20130211/967a2691/attachment.html 


More information about the radiator mailing list