72facea9897457a8356689f766f151f0ddc6fb6b
[radsecproxy.git] / radsecproxy.conf.5.xml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"
2 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
3 <refentry>
4   <refentryinfo>
5     <date>2011-04-04</date>
6   </refentryinfo>
7   <refmeta>
8     <refentrytitle>
9       <application>radsecproxy.conf</application>
10     </refentrytitle>
11     <manvolnum>5</manvolnum>
12     <refmiscinfo>radsecproxy 1.5-dev</refmiscinfo>
13   </refmeta>
14   <refnamediv>
15     <refname>
16       <application>radsecproxy.conf</application>
17     </refname>
18     <refpurpose>Radsec proxy configuration file</refpurpose>
19   </refnamediv>
20   <refsect1>
21     <title>Description</title>
22     <para>
23       When the proxy server starts, it will first check the command
24       line arguments, and then read the configuration file. Normally
25       radsecproxy will read the configuration file
26       <filename>/etc/radsecproxy.conf</filename>. The command line
27       <option>-c</option> option can be used to instead read an
28       alternate file (see
29       <citerefentry>
30         <refentrytitle>radsecproxy</refentrytitle><manvolnum>1</manvolnum>
31       </citerefentry>
32       for details).
33     </para>
34     <para>
35     If the configuration file can not be found, the proxy will exit
36     with an error message. Note that there is also an include facility
37     so that any configuration file may include other configuration
38     files. The proxy will also exit on configuration errors.
39     </para>
40   </refsect1>
41   <refsect1>
42     <title>Configuration Syntax</title>
43     <para>
44       When the configuration file is processed, whitespace (spaces and
45       tabs) are generally ignored. For each line, leading and trailing
46       whitespace are ignored.  A line is ignored if it is empty, only
47       consists of whitespace, or if the first non-whitespace character
48       is a <literal>#</literal>. The configuration is generally case
49       insensitive, but in some cases the option values (see below) are
50       not.
51     </para>
52     <para>
53       There are two types of configuration structures than can be
54       used. The first and simplest are lines on the format
55       <emphasis>option value</emphasis>. That is, an option name, see
56       below for a list of valid options, followed by whitespace (at
57       least one space or tab character), followed by a value. Note
58       that if the value contains whitespace, then it must be quoted
59       using <literal>""</literal> or <literal>''</literal>. Any
60       whitespace in front of the option or after the value will be
61       ignored.
62     </para>
63     <para>
64       The other type of structure is a block. A block spans at least
65       two lines, and has the format:
66       <blockquote><literallayout>
67 blocktype name {
68     option value
69     option value
70     ...
71 }
72       </literallayout></blockquote>
73       That is, some blocktype, see below for a list of the different
74       block types, and then enclosed in braces you have zero or more
75       lines that each have the previously described <emphasis>option
76       value</emphasis> format. Different block types have different
77       rules for which options can be specified, they are listed
78       below. The rules regarding white space, comments and quotes are
79       as above. Hence you may do things like:
80       <blockquote><literallayout>
81 blocktype name {
82 #    option value
83     option "value with space"
84     ...
85 }
86       </literallayout></blockquote>
87     </para>
88     <para>
89       Option value characters can also be written in hex. This is done
90       by writing the character <literal>%</literal> followed by two
91       hexadecimal digits. If a <literal>%</literal> is used without
92       two following hexadecimal digits, the <literal>%</literal> and
93       the following characters are used as written. If you want to
94       write a <literal>%</literal> and not use this decoding, you may
95       of course write <literal>%</literal> in hex; i.e.,
96       <literal>%25</literal>.
97     </para>
98     <para>
99       There is one special option that can be used both as a basic
100       option and inside all blocks. That is the option
101       <literal>include</literal> where the value specifies files to be
102       included. The value can be a single file, or it can use normal
103       shell globbing to specify multiple files, e.g.:
104       <blockquote>
105         <para>
106           include /etc/radsecproxy.conf.d/*.conf
107         </para>
108       </blockquote>
109       The files are sorted alphabetically. Included files are read in
110       the order they are specified, when reaching the end of a file,
111       the next file is read. When reaching the end of the last
112       included file, the proxy returns to read the next line following
113       the <literal>include</literal> option. Included files may again
114       include other files.
115     </para>
116   </refsect1>
117   <refsect1>
118     <title>Basic Options</title>
119     <para>
120       The following basic options may be specified in the
121       configuration file. Note that blocktypes and options inside
122       blocks are discussed later. Note that none of these options are
123       required, and indeed in many cases they are not needed.  Note
124       that you should specify each at most once. The behaviour with
125       multiple occurences is undefined.
126     </para>
127     <variablelist>
128       <varlistentry>
129         <term><literal>LogLevel</literal></term>
130         <listitem>
131           <para>
132             This option specifies the debug level. It must be set to
133             1, 2, 3, 4 or 5, where 1 logs only serious errors, and 5
134             logs everything. The default is 2 which logs errors,
135             warnings and a few informational messages. Note that the
136             command line option <option>-d</option> overrides this.
137           </para>
138         </listitem>
139       </varlistentry>
140       <varlistentry>
141         <term><literal>LogDestination</literal></term>
142         <listitem>
143           <para>
144             This specifies where the log messages should go. By
145             default the messages go to syslog with facility
146             <literal>LOG_DAEMON</literal>. Using this option you can
147             specify another syslog facility, or you may specify that
148             logging should be to a particular file, not using
149             syslog. The value must be either a file or syslog URL. The
150             file URL is the standard one, specifying a local file that
151             should be used. For syslog, you must use the syntax:
152             <literal>x-syslog:///FACILITY</literal> where
153             <literal>FACILITY</literal> must be one of
154             <literal>LOG_DAEMON</literal>,
155             <literal>LOG_MAIL</literal>, <literal>LOG_USER</literal>,
156             <literal>LOG_LOCAL0</literal>,
157             <literal>LOG_LOCAL1</literal>,
158             <literal>LOG_LOCAL2</literal>,
159             <literal>LOG_LOCAL3</literal>,
160             <literal>LOG_LOCAL4</literal>,
161             <literal>LOG_LOCAL5</literal>,
162             <literal>LOG_LOCAL6</literal> or
163             <literal>LOG_LOCAL7</literal>. You may omit the facility
164             from the URL to specify logging to the default facility,
165             but this is not very useful since this is the default log
166             destination. Note that this option is ignored if
167             <option>-f</option> is specified on the command line.
168           </para>
169         </listitem>
170       </varlistentry>
171       <varlistentry>
172         <term><literal>ListenUDP</literal></term>
173         <listitem>
174           <para>
175             Normally the proxy will listen to the standard RADIUS UDP
176             port <literal>1812</literal> if configured to handle UDP
177             clients. On most systems it will do this for all of the
178             system's IP addresses (both IPv4 and IPv6). On some
179             systems however, it may respond to only IPv4 or only
180             IPv6. To specify an alternate port you may use a value on
181             the form <literal>*:port</literal> where port is any valid
182             port number. If you also want to specify a specific
183             address you can do
184             e.g. <literal>192.168.1.1:1812</literal> or
185             <literal>[2001:db8::1]:1812</literal>. The port may be
186             omitted if you want the default one (like in these
187             examples). These examples are equivalent to
188             <literal>192.168.1.1</literal> and
189             <literal>2001:db8::1</literal>. Note that you must use
190             brackets around the IPv6 address.  This option may be
191             specified multiple times to listen to multiple addresses
192             and/or ports.
193           </para>
194         </listitem>
195       </varlistentry>
196       <varlistentry>
197         <term><literal>ListenTCP</literal></term>
198         <listitem>
199           <para>
200             This option is similar to the <literal>listenUDP</literal>
201             option, except that it is used for receiving connections
202             from TCP clients. The default port number is
203             <literal>1812</literal>.
204           </para>
205         </listitem>
206       </varlistentry>
207       <varlistentry>
208         <term><literal>ListenTLS</literal></term>
209         <listitem>
210           <para>
211             This is similar to the <literal>listenUDP</literal>
212             option, except that it is used for receiving connections
213             from TLS clients. The default port number is
214             <literal>2083</literal>. Note that this option was
215             previously called <literal>listenTCP</literal>.
216           </para>
217         </listitem>
218       </varlistentry>
219       <varlistentry>
220         <term><literal>ListenDTLS</literal></term>
221         <listitem>
222           <para>
223             This is similar to the <literal>listenUDP</literal>
224             option, except that it is used for receiving connections
225             from DTLS clients. The default port number is
226             <literal>2083</literal>.
227           </para>
228         </listitem>
229       </varlistentry>
230       <varlistentry>
231         <term><literal>SourceUDP</literal></term>
232         <listitem>
233           <para>
234             This can be used to specify source address and/or source
235             port that the proxy will use for sending UDP client
236             messages (e.g. Access Request).
237           </para>
238         </listitem>
239       </varlistentry>
240       <varlistentry>
241         <term><literal>SourceTCP</literal></term>
242         <listitem>
243           <para>
244             This can be used to specify source address and/or source
245             port that the proxy will use for TCP connections.
246           </para>
247         </listitem>
248       </varlistentry>
249       <varlistentry>
250         <term><literal>SourceTLS</literal></term>
251         <listitem>
252           <para>
253             This can be used to specify source address and/or source
254             port that the proxy will use for TLS connections.
255           </para>
256         </listitem>
257       </varlistentry>
258       <varlistentry>
259         <term><literal>SourceDTLS</literal></term>
260         <listitem>
261           <para>
262             This can be used to specify source address and/or source
263             port that the proxy will use for DTLS connections.
264           </para>
265         </listitem>
266       </varlistentry>
267       <varlistentry>
268         <term><literal>TTLAttribute</literal></term>
269         <listitem>
270           <para>
271             This can be used to change the default TTL attribute. Only
272             change this if you know what you are doing. The syntax is
273             either a numerical value denoting the TTL attribute, or
274             two numerical values separated by column specifying a
275             vendor attribute,
276             i.e. <literal>vendorid:attribute</literal>.
277           </para>
278         </listitem>
279       </varlistentry>
280       <varlistentry>
281         <term><literal>AddTTL</literal></term>
282         <listitem>
283           <para>
284             If a TTL attribute is present, the proxy will decrement
285             the value and discard the message if zero. Normally the
286             proxy does nothing if no TTL attribute is present. If you
287             use the addTTL option with a value 1-255, the proxy will
288             when forwarding a message with no TTL attribute, add one
289             with the specified value. Note that this option can also
290             be specified for a client/server. It will then override
291             this setting when forwarding a message to that
292             client/server.
293           </para>
294         </listitem>
295       </varlistentry>
296       <varlistentry>
297         <term><literal>LoopPrevention</literal></term>
298         <listitem>
299           <para>
300             This can be set to <literal>on</literal> or
301             <literal>off</literal> with <literal>off</literal> being
302             the default. When this is enabled, a request will never be
303             sent to a server named the same as the client it was
304             received from. I.e., the names of the client block and the
305             server block are compared.  Note that this only gives
306             limited protection against loops.  It can be used as a
307             basic option and inside server blocks where it overrides
308             the basic setting.
309           </para>
310         </listitem>
311       </varlistentry>
312       <varlistentry>
313         <term><literal>Include</literal></term>
314         <listitem>
315           <para>
316             This is not a normal configuration option; it can be
317             specified multiple times.  It can both be used as a basic
318             option and inside blocks. For the full description, see
319             the configuration syntax section above.
320           </para>
321         </listitem>
322       </varlistentry>
323     </variablelist>
324   </refsect1>
325   <refsect1>
326     <title>Blocks</title>
327     <para>
328       There are five types of blocks, they are
329       <literal>client</literal>, <literal>server</literal>,
330       <literal>realm</literal>, <literal>tls</literal> and
331       <literal>rewrite</literal>. At least one instance of each of
332       <literal>client</literal> and <literal>realm</literal> is
333       required. This is necessary for the proxy to do anything useful,
334       and it will exit if not. The <literal>tls</literal> block is
335       required if at least one TLS/DTLS client or server is
336       configured. Note that there can be multiple blocks for each
337       type.  For each type, the block names should be unique. The
338       behaviour with multiple occurences of the same name for the same
339       block type is undefined. Also note that some block option values
340       may reference a block by name, in which case the block name must
341       be previously defined. Hence the order of the blocks may be
342       significant.
343     </para>
344   </refsect1>
345   <refsect1>
346     <title>Client Block</title>
347     <para>
348       The client block is used to configure a client. That is, tell
349       the proxy about a client, and what parameters should be used for
350       that client. The name of the client block must (with one
351       exception, see below) be either the IP address (IPv4 or IPv6) of
352       the client, an IP prefix (IPv4 or IPv6) on the form
353       IpAddress/PrefixLength, or a domain name (FQDN). Note that
354       literal IPv6 addresses must be enclosed in brackets.
355     </para>
356     <para>
357       If a domain name is specified, then this will be resolved
358       immediately to all the addresses associated with the name, and
359       the proxy will not care about any possible DNS changes that
360       might occur later. Hence there is no dependency on DNS after
361       startup.
362     </para>
363     <para>
364       When some client later sends a request to the proxy, the proxy
365       will look at the IP address the request comes from, and then go
366       through all the addresses of each of the configured clients (in
367       the order they are defined), to determine which (if any) of the
368       clients this is.
369     </para>
370     <para>
371       In the case of TLS/DTLS, the name of the client must match the
372       FQDN or IP address in the client certificate. Note that this is
373       not required when the client name is an IP prefix.
374     </para>
375     <para>
376       Alternatively one may use the <literal>host</literal> option
377       inside a client block. In that case, the value of the
378       <literal>host</literal> option is used as above, while the name
379       of the block is only used as a descriptive name for the
380       administrator. The host option may be used multiple times, and
381       can be a mix of addresses, FQDNs and prefixes.
382     </para>
383     <para>
384       The allowed options in a client block are
385       <literal>host</literal>, <literal>type</literal>,
386       <literal>secret</literal>, <literal>tls</literal>,
387       <literal>certificateNameCheck</literal>,
388       <literal>matchCertificateAttribute</literal>,
389       <literal>duplicateInterval</literal>, <literal>addTTL</literal>,
390       <literal>rewrite</literal>, <literal>rewriteIn</literal>,
391       <literal>rewriteOut</literal> and
392       <literal>rewriteAttribute</literal>.
393
394       We already discussed the <literal>host</literal> option. The
395       value of <literal>type</literal> must be one of
396       <literal>udp</literal>, <literal>tcp</literal>,
397       <literal>tls</literal> or <literal>dtls</literal>. The value of
398       <literal>secret</literal> is the shared RADIUS key used with
399       this client. If the secret contains whitespace, the value must
400       be quoted. This option is optional for TLS/DTLS.
401     </para>
402     <para>
403       For a TLS/DTLS client you may also specify the
404       <literal>tls</literal> option.  The option value must be the
405       name of a previously defined TLS block. If this option is not
406       specified, the TLS block with the name
407       <literal>defaultClient</literal> will be used if defined. If not
408       defined, it will try to use the TLS block named
409       <literal>default</literal>. If the specified TLS block name does
410       not exist, or the option is not specified and none of the
411       defaults exist, the proxy will exit with an error.
412     </para>
413     <para>
414       For a TLS/DTLS client, the option
415       <literal>certificateNameCheck</literal> can be set to
416       <literal>off</literal>, to disable the default behaviour of
417       matching CN or SubjectAltName against the specified hostname or
418       IP address.
419     </para>
420     <para>
421       Additional validation of certificate attributes can be done by
422       use of the <literal>matchCertificateAttribute</literal>
423       option. Currently one can only do some matching of CN and
424       SubjectAltName. For regexp matching on CN, one can use the value
425       <literal>CN:/regexp/</literal>. For SubjectAltName one can only
426       do regexp matching of the URI, this is specified as
427       <literal>SubjectAltName:URI:/regexp/</literal>. Note that
428       currently this option can only be specified once in a client
429       block.
430     </para>
431     <para>
432       The <literal>duplicateInterval</literal> option can be used to
433       specify for how many seconds duplicate checking should be
434       done. If a proxy receives a new request within a few seconds of
435       a previous one, it may be treated the same if from the same
436       client, with the same authenticator etc. The proxy will then
437       ignore the new request (if it is still processing the previous
438       one), or returned a copy of the previous reply.
439     </para>
440     <para>
441       The <literal>addTTL</literal> option is similar to the
442       <literal>addTTL</literal> option used in the basic config. See
443       that for details. Any value configured here overrides the basic
444       one when sending messages to this client.
445     </para>
446     <para>
447       The <literal>rewrite</literal> option is deprecated. Use
448       <literal>rewriteIn</literal> instead.
449     </para>
450     <para>
451       The <literal>rewriteIn</literal> option can be used to refer to
452       a rewrite block that specifies certain rewrite operations that
453       should be performed on incoming messages from the client. The
454       rewriting is done before other processing.  For details, see the
455       rewrite block text below. Similarly to <literal>tls</literal>
456       discussed above, if this option is not used, there is a fallback
457       to using the <literal>rewrite</literal> block named
458       <literal>defaultClient</literal> if it exists; and if not, a
459       fallback to a block named <literal>default</literal>.
460     </para>
461     <para>
462       The <literal>rewriteOut</literal> option is used in the same way
463       as <literal>rewriteIn</literal>, except that it specifies
464       rewrite operations that should be performed on outgoing messages
465       to the client. The rewriting is done after other
466       processing. Also, there is no rewrite fallback if this option is
467       not used.
468     </para>
469     <para>
470       The <literal>rewriteAttribute</literal> option currently makes
471       it possible to specify that the User-Name attribute in a client
472       request shall be rewritten in the request sent by the proxy. The
473       User-Name attribute is written back to the original value if a
474       matching response is later sent back to the client. The value
475       must be on the form User-Name:/regexpmatch/replacement/. Example
476       usage:
477       <blockquote>
478         <para>
479           rewriteAttribute User-Name:/^(.*)@local$/\1@example.com/
480         </para>
481       </blockquote>
482     </para>
483   </refsect1>
484   <refsect1>
485     <title>Server Block</title>
486     <para>
487       The server block is used to configure a server. That is, tell
488       the proxy about a server, and what parameters should be used
489       when communicating with that server.  The name of the server
490       block must (with one exception, see below) be either the IP
491       address (IPv4 or IPv6) of the server, or a domain name
492       (FQDN). If a domain name is specified, then this will be
493       resolved immediately to all the addresses associated with the
494       name, and the proxy will not care about any possible DNS changes
495       that might occur later. Hence there is no dependency on DNS
496       after startup. If the domain name resolves to multiple
497       addresses, then for UDP/DTLS the first address is used. For
498       TCP/TLS, the proxy will loop through the addresses until it can
499       connect to one of them. In the case of TLS/DTLS, the name of the
500       server must match the FQDN or IP address in the server
501       certificate.
502     </para>
503     <para>
504       Alternatively one may use the <literal>host</literal> option
505       inside a server block. In that case, the value of the
506       <literal>host</literal> option is used as above, while the name
507       of the block is only used as a descriptive name for the
508       administrator. Note that multiple host options may be used. This
509       will then be treated as multiple names/addresses for the same
510       server. When initiating a TCP/TLS connection, all addresses of
511       all names may be attempted, but there is no failover between the
512       different host values. For failover one must use separate server
513       blocks.
514     </para>
515     <para>
516       Note that the name of the block, or values of host options may
517       include a port number (separated with a column). This port
518       number will then override the default port or a port option in
519       the server block. Also note that literal IPv6 addresses must be
520       enclosed in brackets.
521     </para>
522     <para>
523       The allowed options in a server block are
524       <literal>host</literal>, <literal>port</literal>,
525       <literal>type</literal>, <literal>secret</literal>,
526       <literal>tls</literal>, <literal>certificateNameCheck</literal>,
527       <literal>matchCertificateAttribute</literal>,
528       <literal>addTTL</literal>, <literal>rewrite</literal>,
529       <literal>rewriteIn</literal>, <literal>rewriteOut</literal>,
530       <literal>statusServer</literal>, <literal>retryCount</literal>,
531       <literal>retryInterval</literal>,
532       <literal>dynamicLookupCommand</literal> and
533       <literal>loopPrevention</literal>.
534     </para>
535     <para>
536       We already discussed the <literal>host</literal> option. The
537       <literal>port</literal> option allows you to specify which port
538       number the server uses. The usage of <literal>type</literal>,
539       <literal>secret</literal>, <literal>tls</literal>,
540       <literal>certificateNameCheck</literal>,
541       <literal>matchCertificateAttribute</literal>,
542       <literal>addTTL</literal>, <literal>rewrite</literal>,
543       <literal>rewriteIn</literal> and <literal>rewriteOut</literal>
544       are just as specified for the <literal>client block</literal>
545       above, except that <literal>defaultServer</literal> (and not
546       <literal>defaultClient</literal>) is the fallback for the
547       <literal>tls</literal>, <literal>rewrite</literal> and
548       <literal>rewriteIn</literal> options.
549     </para>
550     <para>
551       <literal>statusServer</literal> can be specified to enable the
552       use of status-server messages for this server. The value must be
553       either <literal>on</literal> or <literal>off</literal>. The
554       default when not specified, is <literal>off</literal>. If
555       statusserver is enabled, the proxy will during idle periods send
556       regular status-server messages to the server to verify that it
557       is alive. This should only be enabled if the server supports it.
558     </para>
559     <para>
560       The options <literal>retryCount</literal> and
561       <literal>retryInterval</literal> can be used to specify how many
562       times the proxy should retry sending a request and how long it
563       should wait between each retry. The defaults are 2 retries and
564       an interval of 5s.
565     </para>
566     <para>
567       The option <literal>dynamicLookupCommand</literal> can be used
568       to specify a command that should be executed to dynamically
569       configure and use a server.  The use of this feature will be
570       documented separately/later.
571     </para>
572     <para>
573       Using the <literal>loopPrevention</literal> option here
574       overrides any basic setting of this option.  See section
575       <literal>BASIC OPTIONS</literal> for details on this option.
576     </para>
577   </refsect1>
578   <refsect1>
579     <title>Realm Block</title>
580     <para>
581       When the proxy receives an Access-Request it needs to figure out
582       to which server it should be forwarded. This is done by looking
583       at the Username attribute in the request, and matching that
584       against the names of the defined realm blocks.  The proxy will
585       match against the blocks in the order they are specified, using
586       the first match if any. If no realm matches, the proxy will
587       simply ignore the request. Each realm block specifies what the
588       server should do when a match is found. A realm block may
589       contain none, one or multiple <literal>server</literal> options,
590       and similarly <literal>accountingServer</literal> options. There
591       are also <literal>replyMessage</literal> and
592       <literal>accountingResponse</literal> options. We will discuss
593       these later.
594     </para>
595     <refsect2>
596       <title>Realm block names and matching</title>
597       <para>
598         In the general case the proxy will look for a
599         <literal>@</literal> in the username attribute, and try to do
600         an exact case insensitive match between what comes after the
601         <literal>@</literal> and the name of the realm block. So if
602         you get a request with the attribute value
603         <literal>anonymous@example.com</literal>, the proxy will go
604         through the realm names in the order they are specified,
605         looking for a realm block named
606         <literal>example.com</literal>.
607       </para>
608       <para>
609         There are two exceptions to this, one is the realm name
610         <literal>*</literal> which means match everything. Hence if
611         you have a realm block named <literal>*</literal>, then it
612         will always match. This should then be the last realm block
613         defined, since any blocks after this would never be
614         checked. This is useful for having a default.
615       </para>
616       <para>
617         The other exception is regular expression matching. If the
618         realm name starts with a <literal>/</literal>, the name is
619         treated as an regular expression. A case insensitive regexp
620         match will then be done using this regexp on the value of the
621         entire Username attribute. Optionally you may also have a
622         trailing <literal>/</literal> after the regexp. So as an
623         example, if you want to use regexp matching the domain
624         <literal>example.com</literal> you could have a realm block
625         named <literal>/@example\\.com$</literal>. Optinally this can
626         also be written <literal>/@example\\.com$/</literal>. If you
627         want to match all domains under the <literal>.com</literal>
628         top domain, you could do <literal>/@.*\\.com$</literal>. Note
629         that since the matching is done on the entire attribute value,
630         you can also use rules like
631         <literal>/^[a-k].*@example\\.com$/</literal> to get some of
632         the users in this domain to use one server, while other users
633         could be matched by another realm block and use another
634         server.
635     </para>
636     </refsect2>
637     <refsect2>
638       <title>Realm block options</title>
639       <para>
640         A realm block may contain none, one or multiple
641         <literal>server</literal> options. If defined, the values of
642         the <literal>server</literal> options must be the names of
643         previously defined server blocks. Normally requests will be
644         forwarded to the first server option defined. If there are
645         multiple server options, the proxy will do fail-over and use
646         the second server if the first is down. If the two first are
647         down, it will try the third etc. If say the first server comes
648         back up, it will go back to using that one. Currently
649         detection of servers being up or down is based on the use of
650         StatusServer (if enabled), and that TCP/TLS/DTLS connections
651         are up.
652       </para>
653       <para>
654         A realm block may also contain none, one or multiple
655         <literal>accountingServer</literal> options. This is used
656         exactly like the <literal>server</literal> option, except that
657         it is used for specifying where to send matching accounting
658         requests. The values must be the names of previously defined
659         server blocks. When multiple accounting servers are defined,
660         there is a failover mechanism similar to the one for the
661         <literal>server</literal> option.
662       </para>
663       <para>
664         If there is no <literal>server</literal> option, the proxy
665         will if <literal>replyMessage</literal> is specified, reply
666         back to the client with an Access Reject message. The message
667         contains a replyMessage attribute with the value as specified
668         by the <literal>replyMessage</literal> option. Note that this
669         is different from having no match since then the request is
670         simply ignored. You may wonder why this is useful. One example
671         is if you handle say all domains under say
672         <literal>.bv</literal>. Then you may have several realm blocks
673         matching the domains that exists, while for other domains
674         under <literal>.bv</literal> you want to send a reject. At the
675         same time you might want to send all other requests to some
676         default server. After the realms for the subdomains, you would
677         then have two realm definitions. One with the name
678         <literal>/@.*\\.bv$</literal> with no servers, followed by one
679         with the name <literal>*</literal> with the default server
680         defined. This may also be useful for blocking particular
681         usernames.
682       </para>
683       <para>
684         If there is no <literal>accountingServer</literal> option, the
685         proxy will normally do nothing, ignoring accounting
686         requests. There is however an option called
687         <literal>accountingResponse</literal>. If this is set to
688         <literal>on</literal>, the proxy will log some of the
689         accounting information and send an Accounting-Response
690         back. This is useful if you do not care much about accounting,
691         but want to stop clients from retransmitting accounting
692         requests. By default this option is set to
693         <literal>off</literal>.
694       </para>
695     </refsect2>
696   </refsect1>
697   <refsect1>
698     <title>TLS Block</title>
699     <para>
700       The TLS block specifies TLS configuration options and you need
701       at least one of these if you have clients or servers using
702       TLS/DTLS. As discussed in the client and server block
703       descriptions, a client or server block may reference a
704       particular TLS block by name. There are also however the special
705       TLS block names <literal>default</literal>,
706       <literal>defaultClient</literal> and
707       <literal>defaultServer</literal> which are used as defaults if
708       the client or server block does not reference a TLS block. Also
709       note that a TLS block must be defined before the client or
710       server block that would use it. If you want the same TLS
711       configuration for all TLS/DTLS clients and servers, you need
712       just a single tls block named <literal>default</literal>, and
713       the client and servers need not refer to it. If you want all
714       TLS/DTLS clients to use one config, and all TLS/DTLS servers to
715       use another, then you would be fine only defining two TLS blocks
716       named <literal>defaultClient</literal> and
717       <literal>defaultServer</literal>. If you want different clients
718       (or different servers) to have different TLS parameters, then
719       you may need to create other TLS blocks with other names, and
720       reference those from the client or server definitions. Note that
721       you could also have say a client block refer to a default, even
722       <literal>defaultServer</literal> if you really want to.
723     </para>
724     <para>
725       The available TLS block options are
726       <literal>CACertificateFile</literal>,
727       <literal>CACertificatePath</literal>,
728       <literal>certificateFile</literal>,
729       <literal>certificateKeyFile</literal>,
730       <literal>certificateKeyPassword</literal>,
731       <literal>cacheExpiry</literal>, <literal>CRLCheck</literal> and
732       <literal>policyOID</literal>.  When doing RADIUS over TLS/DTLS,
733       both the client and the server present certificates, and they
734       are both verified by the peer. Hence you must always specify
735       <literal>certificateFile</literal> and
736       <literal>certificateKeyFile</literal> options, as well as
737       <literal>certificateKeyPassword</literal> if a password is
738       needed to decrypt the private key. Note that
739       <literal>CACertificateFile</literal> may be a certificate
740       chain. In order to verify certificates, or send a chain of
741       certificates to a peer, you also always need to specify
742       <literal>CACertificateFile</literal> or
743       <literal>CACertificatePath</literal>.  Note that you may specify
744       both, in which case the certificates in
745       <literal>CACertificateFile</literal> are checked first. By
746       default CRLs are not checked. This can be changed by setting
747       <literal>CRLCheck</literal> to <literal>on</literal>. One can
748       require peer certificates to adhere to certain policies by
749       specifying one or multiple policyOIDs using one or multiple
750       <literal>policyOID</literal> options.
751     </para>
752     <para>
753       CA certificates and CRLs are normally cached permanently. That
754       is, once a CA or CRL has been read, the proxy will never attempt
755       to re-read it. CRLs may change relatively often and the proxy
756       should ideally always use the latest CRLs. Rather than
757       restarting the proxy, there is an option
758       <literal>cacheExpiry</literal> that specifies how many seconds
759       the CA and CRL information should be cached. Reasonable values
760       might be say 3600 (1 hour) or 86400 (24 hours), depending on how
761       frequently CRLs are updated and how critical it is to be up to
762       date. This option may be set to zero to disable caching.
763     </para>
764   </refsect1>
765   <refsect1>
766     <title>Rewrite Block</title>
767     <para>
768       The rewrite block specifies rules that may rewrite RADIUS
769       messages. It can be used to add, remove and modify specific
770       attributes from messages received from and sent to clients and
771       servers. As discussed in the client and server block
772       descriptions, a client or server block may reference a
773       particular rewrite block by name. There are however also the
774       special rewrite block names <literal>default</literal>,
775       <literal>defaultClient</literal> and
776       <literal>defaultServer</literal> which are used as defaults if
777       the client or server block does not reference a block. Also note
778       that a rewrite block must be defined before the client or server
779       block that would use it. If you want the same rewrite rules for
780       input from all clients and servers, you need just a single
781       rewrite block named <literal>default</literal>, and the client
782       and servers need not refer to it. If you want all clients to use
783       one config, and all servers to use another, then you would be
784       fine only defining two rewrite blocks named
785       <literal>defaultClient</literal> and
786       <literal>defaultServer</literal>. Note that these defaults are
787       only used for rewrite on input. No rewriting is done on output
788       unless explicitly specifed using the
789       <literal>rewriteOut</literal> option.
790     </para>
791     <para>
792       The available rewrite block options are
793       <literal>addAttribute</literal>,
794       <literal>addVendorAttribute</literal>,
795       <literal>removeAttribute</literal>,
796       <literal>removeVendorAttribute</literal> and
797       <literal>modifyAttribute</literal>. They can all be specified
798       none, one or multiple times.
799     </para>
800     <para>
801       <literal>addAttribute</literal> is used to add attributes to a
802       message. The option value must be on the form
803       <literal>attribute:value</literal> where attribute is a
804       numerical value specifying the attribute.  Simliarly, the
805       <literal>addVendorAttribute</literal> is used to specify a
806       vendor attribute to be added.  The option value must be on the
807       form <literal>vendor:subattribute:value</literal>, where vendor
808       and subattribute are numerical values.
809     </para>
810     <para>
811       The <literal>removeAttribute</literal> option is used to specify
812       an attribute that should be removed from received messages. The
813       option value must be a numerical value specifying which
814       attribute is to be removed.  Similarly,
815       <literal>removeVendorAttribute</literal> is used to specify a
816       vendor attribute that is to be removed. The value can be a
817       numerical value for removing all attributes from a given vendor,
818       or on the form <literal>vendor:subattribute</literal>, where
819       vendor and subattribute are numerical values, for removing a
820       specific subattribute for a specific vendor.
821     </para>
822     <para>
823       <literal>modifyAttribute</literal> is used to specify
824       modification of attributes. The value must be on the form
825       <literal>attribute:/regexpmatch/replacement/</literal> where
826       attribute is a numerical attribute type, regexpmatch is regexp
827       matching rule and replacement specifies how to replace the
828       matching regexp. Example usage:
829       <blockquote>
830         <para>
831           modifyAttribute 1:/^(.*)@local$/\1@example.com/
832         </para>
833       </blockquote>
834     </para>
835   </refsect1>
836   <refsect1>
837     <title>See Also</title>
838     <para>
839       <citerefentry>
840         <refentrytitle>radsecproxy</refentrytitle><manvolnum>1</manvolnum>
841       </citerefentry>,
842       <ulink url="http://tools.ietf.org/html/draft-ietf-radext-radsec">
843         <citetitle>RadSec internet draft</citetitle>
844       </ulink>
845     </para>
846   </refsect1>
847 </refentry>