update detail reader documentation
[freeradius.git] / raddb / sites-available / copy-acct-to-home-server
1 # -*- text -*-
2 ######################################################################
3 #
4 #       In 2.0.0, radrelay functionality is integrated into the
5 #       server core.  This virtual server gives an example of
6 #       using radrelay functionality inside of the server.
7 #
8 #       In this example, the detail file is read, and the packets
9 #       are proxied to a home server.  You will have to configure
10 #       realms, home_server_pool, and home_server in proxy.conf
11 #       for this to work.
12 #
13 #       The purpose of this virtual server is to enable duplication
14 #       of information across a load-balanced, or fail-over set of
15 #       servers.  For example, if a group of clients lists two
16 #       home servers (primary, secondary), then RADIUS accounting
17 #       messages will go only to one server at a time.  This file
18 #       configures a server (primary, secondary) to send copies of
19 #       the accounting information to each other.
20 #
21 #       That way, each server has the same set of information, and
22 #       can make the same decision about the user.
23 #
24 #       $Id$
25 #
26 ######################################################################
27
28 server copy-acct-to-home-server {
29         listen {
30                 type = detail
31
32                 #
33                 #  See sites-available/buffered-sql for more details on
34                 #  all the options available for the detail reader.
35                 #
36
37                 ######################################################
38                 #
39                 #  !!!! WARNING !!!!
40                 #
41                 #  The detail file reader acts just like a NAS.
42                 #
43                 #  This means that if accounting fails, the packet
44                 #  is re-tried FOREVER.  It is YOUR responsibility
45                 #  to write an accounting policy that returns "ok"
46                 #  if the packet was processed properly, "fail" on
47                 #  a database error, AND "ok" if you want to ignore
48                 #  the packet (e.g. no Acct-Status-Type).
49                 #
50                 #  Neither the detail file write OR the detail file
51                 #  reader look at the contents of the packets.  They
52                 #  just either dump the packet verbatim to the file,
53                 #  or read it verbatim from the file and pass it to
54                 #  the server.
55                 #
56                 ######################################################
57
58
59                 #  The location where the detail file is located.
60                 #  This should be on local disk, and NOT on an NFS
61                 #  mounted location!
62                 #
63                 #  On most systems, this should support file globbing
64                 #  e.g. "${radacctdir}/detail-*:*"
65                 #  This lets you write many smaller detail files as in
66                 #  the example in radiusd.conf: ".../detail-%Y%m%d:%H"
67                 #  Writing many small files is often better than writing
68                 #  one large file.  File globbing also means that with
69                 #  a common naming scheme for detail files, then you can
70                 #  have many detail file writers, and only one reader.
71                 #
72                 filename = ${radacctdir}/detail
73
74                 #
75                 #  The server can read accounting packets from the
76                 #  detail file much more quickly than those packets
77                 #  can be written to a database.  If the database is
78                 #  overloaded, then bad things can happen.
79                 #
80                 #  The server will keep track of how long it takes to
81                 #  process an entry from the detail file.  It will
82                 #  then pause between handling entries.  This pause
83                 #  allows databases to "catch up", and gives the
84                 #  server time to notice that other packets may have
85                 #  arrived.
86                 #
87                 #  The pause is calculated dynamically, to ensure that
88                 #  the load due to reading the detail files is limited
89                 #  to a small percentage of CPU time.  The
90                 #  "load_factor" configuration item is a number
91                 #  between 1 and 100.  The server will try to keep the
92                 #  percentage of time taken by "detail" file entries
93                 #  to "load_factor" percentage of the CPU time.
94                 #
95                 #  If the "load_factor" is set to 100, then the server
96                 #  will read packets as fast as it can, usually
97                 #  causing databases to go into overload.
98                 #
99                 load_factor = 10
100
101                 #
102                 #  Track progress through the detail file.  When the detail
103                 #  file is large, and the server is re-started, it will
104                 #  read from the START of the file.
105                 #
106                 #  Setting "track = yes" means it will skip packets which
107                 #  have already been processed.  The default is "no".
108                 #
109         #       track = yes
110
111         }
112
113         #
114         #  Pre-accounting.  Decide which accounting type to use.
115         #
116         preacct {
117                 preprocess
118
119                 # Since we're just proxying, we don't need acct_unique.
120
121                 #
122                 #  Look for IPASS-style 'realm/', and if not found, look for
123                 #  '@realm', and decide whether or not to proxy, based on
124                 #  that.
125                 #
126                 #  Accounting requests are generally proxied to the same
127                 #  home server as authentication requests.
128         #       IPASS
129                 suffix
130         #       ntdomain
131
132                 #
133                 #  Read the 'acct_users' file.  This isn't always
134                 #  necessary, and can be deleted if you do not use it.
135                 files
136         }
137
138         #
139         #  Accounting.  Log the accounting data.
140         #
141         accounting {
142                    #
143                    # Since we're proxying, we don't log anything
144                    # locally.  Ensure that the accounting section
145                    # "succeeds" by forcing an "ok" return.
146                    ok
147         }
148
149
150         #
151         #  When the server decides to proxy a request to a home server,
152         #  the proxied request is first passed through the pre-proxy
153         #  stage.  This stage can re-write the request, or decide to
154         #  cancel the proxy.
155         #
156         #  Only a few modules currently have this method.
157         #
158         pre-proxy {
159
160                 #  If you want to have a log of packets proxied to a home
161                 #  server, un-comment the following line, and the
162                 #  'detail pre_proxy_log' section in radiusd.conf.
163         #       pre_proxy_log
164         }
165
166         #
167         #  When the server receives a reply to a request it proxied
168         #  to a home server, the request may be massaged here, in the
169         #  post-proxy stage.
170         #
171         post-proxy {
172                 #
173
174                 #  If you want to have a log of replies from a home
175                 #  server, un-comment the following line, and the
176                 #  'detail post_proxy_log' section in radiusd.conf.
177         #       post_proxy_log
178
179
180                 #  Uncomment the following line if you want to filter
181                 #  replies from remote proxies based on the rules
182                 #  defined in the 'attrs' file.
183
184         #       attr_filter
185         }
186 }