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