Define New Attribute

Alexandre J. Correa (Onda) alexandre at onda.net.br
Wed Dec 5 13:53:05 CET 2012


Doesn´t work..

preacct {
     preproccess
     acct_unique
     suffix
     sql.authorize
}

accouting {


         if (Check-Quota == "1") {

                 if (Acct-Status-Type == "Start") {
                         onda_startquota
                 }
                 elsif (Acct-Status-Type == "Interim-Update") {
                         onda_updatequota
                 }
         }
}


Debug:

# Executing section post-auth from file 
/etc/freeradius/sites-enabled/default
Sending Access-Accept of id 128 to 192.168.2.200 port 38896
         Framed-Compression := Van-Jacobson-TCP-IP
         Framed-MTU := 1492
         Acct-Interim-Interval := 600
         Framed-Protocol := PPP
         Mikrotik-Rate-Limit := "64k/64k"
         Check-Quota := 1

Finished request 0.
Going to the next request
Waking up in 4.9 seconds.
rad_recv: Accounting-Request packet from host 192.168.2.200 port 55834, 
id=129, length=149
         Service-Type = Framed-User
         Framed-Protocol = PPP
         NAS-Port = 11
         NAS-Port-Type = Ethernet
         User-Name = "xande"
         Calling-Station-Id = "1C:75:08:21:91:30"
         Called-Station-Id = "pppoe-main"
         NAS-Port-Id = "ether2"
         Acct-Session-Id = "81400005"
         Framed-IP-Address = 10.55.0.255
         Acct-Authentic = RADIUS
         Event-Timestamp = "Dec  5 2012 10:45:52 BRST"
         Acct-Status-Type = Start
         NAS-Identifier = "PPPOE-TESTE"
         Acct-Delay-Time = 0
         NAS-IP-Address = 192.168.2.200

# Executing section preacct from file /etc/freeradius/sites-enabled/default
+- entering group preacct {...}
++[preprocess] returns ok
...
...
++[sql.authorize] returns ok
++? if (Check-Quota == "1")
     (Attribute Check-Quota was not found)
? Evaluating (Check-Quota == "1") -> FALSE
++? if (Check-Quota == "1") -> FALSE
Sending Accounting-Response of id 129 to 192.168.2.200 port 55834
         Framed-Compression := Van-Jacobson-TCP-IP
         Framed-MTU := 1492
         Acct-Interim-Interval := 60
         Framed-Protocol := PPP
         Mikrotik-Rate-Limit := "64k/64k"
         Check-Quota := 1
Finished request 1.


i tried putting 'sql.authorize' into accouting { }, but same 'problem' .


My radgroupreply:

GroupName     Attribute             Value    op        prio
ondaX                Check-Quota        1            :=        0


any suggestion ?


On 04/12/2012 19:36, Arran Cudbard-Bell wrote:
> On 4 Dec 2012, at 20:50, "Alexandre J. Correa (Onda)" <alexandre at onda.net.br> wrote:
>
>> Hello,
>>
>> I need to track some type of 'user group'. i´m doing this to not overload my database servers.
>>
>> into the radgroupreply table i need to 'create' one attribute like:
>>
>> Check-Bandwidth := [0,1]
>>
>> i added this attribute in groupreply, in my dictionary file and i can see this attribute in the 'authorization' section.
>>
>> How i can pass it to 'accouting' section ? maybe setting global variable for this session ?
>
> Call sql.authorize in preacct.
>
> -Arran
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>


-- 
Sds.

Alexandre Jeronimo Correa
Sócio-Administrador

Office: +55 34 3351 3077

Onda Internet
www.onda.net.br



More information about the Freeradius-Users mailing list