Acct-Type   [plain text]

FreeRADIUS supports the Acct-Type attribute to select between
accounting methods based on arbitrary attribute/value pairs contained
in an accounting packet. Its use follows the same general configuration
syntax as Auth-Type and Autz-Type. The main difference in configuration
between Acct-Type and Auth/Autz-Type lies in where the Acct-Type
method is assigned. With Auth/Autz-Type, the method is typically
assigned in the 'users' file. The 'users' file, naturally, is not
processed during the handling of the accounting {} section. However,
part of the default files {} module is the 'acct_users' file, which
serves the same purpose as the 'users' file, but applies to accounting

For example, a server administrator is responsible for handling the
accounting data for two different realms, and, and
wishes to use different instances of the SQL module for each. In
addition, there is one RADIUS client sending accounting data that is
to be logged only to a specific detail file. Everything else should
use a third SQL instance.

The acct_users file would look something like this:

DEFAULT Realm == "", Acct-Type := "SQLFOO"

DEFAULT Realm == "", Acct-Type := "SQLBAR"

DEFAULT Client-IP-Address == "", Acct-Type := "OTHERNAS"

And in radiusd.conf:
$INCLUDE  ${confdir}/sql0.conf # Instance named 'sql0'.
$INCLUDE  ${confdir}/sql1.conf # Instance named 'sql1'.
$INCLUDE  ${confdir}/sql2.conf # Instance named 'sql2'.

detail othernas {
        detailfile = ${radacctdir}/

preacct {
        suffix # Add the Realm A/V pair.
        files  # Add the Acct-Type A/V pair based on the Realm A/V pair.

accounting {

        # If Acct-Type is SQLFOO use the 'sql1' instance of the SQL module.

        Acct-Type SQLFOO {

        # If Acct-Type is SQLBAR, use the 'sql2' instance of the SQL module.

        Acct-Type SQLBAR {

        # If Acct-Type is OTHERNAS, use the 'othernas' instance of the detail
        # module

        Acct-Type OTHERNAS {

        # If we've made it this far, we haven't matched an Acct-Type, so use
        # the sql0 instance.