New build path variable
[freeradius.git] / doc / Acct-Type.rst
1 Acct-Type
2 =========
3
4 FreeRADIUS supports the Acct-Type attribute to select between
5 accounting methods based on arbitrary attribute/value pairs contained
6 in an accounting packet. Its use follows the same general configuration
7 syntax as Auth-Type and Autz-Type. The main difference in configuration
8 between Acct-Type and Auth/Autz-Type lies in where the Acct-Type
9 method is assigned. With Auth/Autz-Type, the method is typically
10 assigned in the 'users' file. The 'users' file, naturally, is not
11 processed during the handling of the accounting {} section. However,
12 part of the default files {} module is the 'acct_users' file, which
13 serves the same purpose as the 'users' file, but applies to accounting
14 packets.
15
16 For example, a server administrator is responsible for handling the
17 accounting data for two different realms, foo.com and bar.com, and
18 wishes to use different instances of the SQL module for each. In
19 addition, there is one RADIUS client sending accounting data that is
20 to be logged only to a specific detail file. Everything else should
21 use a third SQL instance.
22
23 The acct_users file would look something like this::
24
25   DEFAULT Realm == "foo.com", Acct-Type := "SQLFOO"
26   
27   DEFAULT Realm == "bar.com", Acct-Type := "SQLBAR"
28
29   DEFAULT Client-IP-Address == "10.0.0.1", Acct-Type := "OTHERNAS"
30
31 And in radiusd.conf::
32
33   $INCLUDE  ${confdir}/sql0.conf # Instance named 'sql0'.
34   $INCLUDE  ${confdir}/sql1.conf # Instance named 'sql1'.
35   $INCLUDE  ${confdir}/sql2.conf # Instance named 'sql2'.
36   
37   detail othernas {
38         detailfile = ${radacctdir}/10.0.0.1/detail-%Y%m%d
39   }
40   
41   preacct {
42         suffix # Add the Realm A/V pair.
43         files  # Add the Acct-Type A/V pair based on the Realm A/V pair.
44   }
45   
46   accounting {
47   
48         # If Acct-Type is SQLFOO use the 'sql1' instance of the SQL module.
49   
50         Acct-Type SQLFOO {
51                 sql1
52         }
53   
54         # If Acct-Type is SQLBAR, use the 'sql2' instance of the SQL module.
55   
56         Acct-Type SQLBAR {
57                 sql2
58         }
59   
60         # If Acct-Type is OTHERNAS, use the 'othernas' instance of the detail
61         # module
62   
63         Acct-Type OTHERNAS {
64                 othernas
65         }
66   
67         # If we've made it this far, we haven't matched an Acct-Type, so use
68         # the sql0 instance.
69   
70         sql0
71   }