Filtering accounting messages

liran kessel lirankessel at gmail.com
Sun Jul 14 14:02:36 CEST 2019


Hi,

I am receiving accounting messages from the network and storing them to the radacct table. 
Currently in order to filter I have changed the INSERT/UPDATE commands with a where statement to only insert rows for subscribers I am managing.
This is working fine but as my network grows it is creating a lot of overhead to execute SQL commands that don’t do anything and so I am trying to move the filtering to the FreeRADIUS code.
I have added the preacct to the attr_filter file:


attr_filter attr_filter.preacct {
        key = "%{User-Name}"
        filename = ${modconfdir}/${.:name}/preacct
}


And have this preacct file to try and currently filter only 1 number from being inserted to the DB.


#
#       Configuration file for the rlm_attr_filter module.
#       Please see rlm_attr_filter(5) manpage for more information.
#
#
#       This configuration file is used to remove almost all of the attributes
#       From an Accounting-Response message.  The RFC's say that an
#       Accounting-Response packet can contain only a few attributes.
#       We enforce that here.
#
DEFAULT
        Vendor-Specific =* ANY,
        Message-Authenticator =* ANY,
        Error-Cause =* ANY,
        Proxy-State =* ANY,
        Calling-Station-Id == ‘XXXXXXXX'


However it seems that the filter is being ignored and all lines are inserted to the DB.
Can you please assist in understanding why it isn’t filtering?
In addition if I have a list of about 100K subscribers that I do want to store their accounting data to the DB is there a way to manage this list without adding it 1 by 1 to the filter file?


I am running Freeradius 3.0.13 with PostgreSQL.


Thanks
Liran Kessel


More information about the Freeradius-Users mailing list