[RADIATOR] run perl hook after accounting start

Thomas Kurian thomas at kccg.com
Sat Mar 9 08:54:50 CST 2013


Hi Heikki,
Many thanks for your reply. But can you please help me with my following 
question.

Following is the scenario & my requirement:

On event of receiving an accounting start packet , I want to check sql 
table rows for matching entries ,for the condition where the values of 
the sql column names in sql table is matching with theses bracketed 
values(Switched=0,Type=Q,Qcounter is greater than or equal to Qmax). 
Please note that switched,type , quotacounter and quotamax are column 
names in an sql table named quotasubscribers. Only If these conditions 
are met, then only the perl script is to be run.

If the above conditions matches, only then a perl script is required to 
be run . How is the configuration made for checking these conditions in 
the sql table. Can this be done with Authselect sql command and a 
preprocessing hook? Please help me out on how this can be done. Please 
add the required config lines to my current config seen below. The hook 
should be run only if the sql conditions 
([Switched=0],[Type=Q],[Qcounter is greater than or equal to Qmax] in 
quotasubscribers sql table) are matching.


--------------
My current configuration

Authport 1812
AcctPort 1813
BindAddress 0.0.0.0

LogDir /var/log/radius
DbDir /etc/radiator



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


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

# Accept processing of other accounting requests of the genre stop


<Handler Request-Type = Accounting-Request>
PreProcessingHook file:"/etc/radiator/createavpairs.pl"
<AuthBy SQL>

DBSource dbi:ODBC:IRONMAN
DBUsername XXXXX
DBAuth XXXX


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

AcctSQLStatement update quotasubscribers set monthlycounter =
monthlycounter + 0%{Acct-Output-Octets}, totalcounter = totalcounter +
0%{Acct-Output-Octets}, timestamp = %{Event-Timestamp} \
where username='%n' \
And Type = 'Q'



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


</Handler>




<Handler Request-Type=Disconnect-Request>
<AuthBy RADIUS>

<Host 10.50.1.4>
Secret XXXX
</Host>
</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




More information about the radiator mailing list