FTicks loging changes
[libradsec.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-10-08</date>
6   </refentryinfo>
7   <refmeta>
8     <refentrytitle>
9       <application>radsecproxy.conf</application>
10     </refentrytitle>
11     <manvolnum>5</manvolnum>
12     <refmiscinfo>radsecproxy 1.5</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
172       <varlistentry>
173         <term><literal>FTicksReporting</literal></term>
174         <listitem>
175           <para>
176             The FTicksReporting option is used to enable F-Ticks
177             logging and can be set to <literal>None</literal>,
178             <literal>Basic</literal> or <literal>Full</literal>.  Its
179             default value is <literal>None</literal>.  If
180             FTicksReporting is set to anything other than
181             <literal>None</literal>, note that the default value for
182             FTicksMAC is <literal>VendorKeyHashed</literal> which
183             needs FTicksKey to be set.
184           </para>
185           <para>
186             See <literal>radsecproxy.conf-example</literal> for
187             details.  Note that radsecproxy has to be configured with
188             F-Ticks support (<literal>--enable-fticks</literal>) for
189             this option to have any effect.
190           </para>
191         </listitem>
192       </varlistentry>
193
194       <varlistentry>
195         <term><literal>FTicksMAC</literal></term>
196         <listitem>
197           <para>
198             The FTicksMAC option can be used to control if and how
199             Calling-Station-Id (the users Ethernet MAC address) is
200             being logged.  It can be set to one of
201             <literal>Static</literal>, <literal>Original</literal>,
202             <literal>VendorHashed</literal>,
203             <literal>VendorKeyHashed</literal>,
204             <literal>FullyHashed</literal> or
205             <literal>FullyKeyHashed</literal>.
206           </para>
207           <para>
208             The default value for FTicksMAC is
209             <literal>VendorKeyHashed</literal>.  This means that
210             FTicksKey has to be set.
211           <para>
212             Before chosing any of <literal>Original</literal>,
213             <literal>FullyHashed</literal> or
214             <literal>VendorHashed</literal>, consider the implications
215             for user privacy when MAC addresses are collected.  How
216             will the logs be stored, transferred and accessed?
217           </para>
218           </para>
219           <para>
220             See <literal>radsecproxy.conf-example</literal> for
221             details.  Note that radsecproxy has to be configured with
222             F-Ticks support (<literal>--enable-fticks</literal>) for
223             this option to have any effect.
224           </para>
225         </listitem>
226       </varlistentry>
227
228       <varlistentry>
229         <term><literal>FTicksKey</literal></term>
230         <listitem>
231           <para>
232             The FTicksKey option is used to specify the key to use
233             when producing HMAC's as an effect of specifying
234             VendorKeyHashed or FullyKeyHashed for the FTicksMAC
235             option.
236           </para>
237           <para>
238             Note that radsecproxy has to be configured with F-Ticks
239             support (<literal>--enable-fticks</literal>) for this
240             option to have any effect.
241           </para>
242         </listitem>
243       </varlistentry>
244
245       <varlistentry>
246         <term><literal>FTicksSyslogFacility</literal></term>
247         <listitem>
248           <para>
249             The FTicksSyslogFacility option is used to specify 
250             a dedicated syslog facility for F-Ticks messages.
251             This allows easy filtering of F-Ticks messages.
252             By default, if FTicksSyslogFacility is not given,
253             F-Ticks messages are written to the LogDestination. 
254           </para>
255           <para>
256             Note that FTicksSyslogFacility value specifying a file 
257             (via file:/// prefix) is ignored.
258           </para>
259         </listitem>
260       </varlistentry>
261
262       <varlistentry>
263         <term><literal>ListenUDP</literal></term>
264         <listitem>
265           <para>
266             Normally the proxy will listen to the standard RADIUS UDP
267             port <literal>1812</literal> if configured to handle UDP
268             clients. On most systems it will do this for all of the
269             system's IP addresses (both IPv4 and IPv6). On some
270             systems however, it may respond to only IPv4 or only
271             IPv6. To specify an alternate port you may use a value on
272             the form <literal>*:port</literal> where port is any valid
273             port number. If you also want to specify a specific
274             address you can do
275             e.g. <literal>192.168.1.1:1812</literal> or
276             <literal>[2001:db8::1]:1812</literal>. The port may be
277             omitted if you want the default one (like in these
278             examples). These examples are equivalent to
279             <literal>192.168.1.1</literal> and
280             <literal>2001:db8::1</literal>. Note that you must use
281             brackets around the IPv6 address.  This option may be
282             specified multiple times to listen to multiple addresses
283             and/or ports.
284           </para>
285         </listitem>
286       </varlistentry>
287       <varlistentry>
288         <term><literal>ListenTCP</literal></term>
289         <listitem>
290           <para>
291             This option is similar to the <literal>ListenUDP</literal>
292             option, except that it is used for receiving connections
293             from TCP clients. The default port number is
294             <literal>1812</literal>.
295           </para>
296         </listitem>
297       </varlistentry>
298       <varlistentry>
299         <term><literal>ListenTLS</literal></term>
300         <listitem>
301           <para>
302             This is similar to the <literal>ListenUDP</literal>
303             option, except that it is used for receiving connections
304             from TLS clients. The default port number is
305             <literal>2083</literal>. Note that this option was
306             previously called <literal>ListenTCP</literal>.
307           </para>
308         </listitem>
309       </varlistentry>
310       <varlistentry>
311         <term><literal>ListenDTLS</literal></term>
312         <listitem>
313           <para>
314             This is similar to the <literal>ListenUDP</literal>
315             option, except that it is used for receiving connections
316             from DTLS clients. The default port number is
317             <literal>2083</literal>.
318           </para>
319         </listitem>
320       </varlistentry>
321       <varlistentry>
322         <term><literal>SourceUDP</literal></term>
323         <listitem>
324           <para>
325             This can be used to specify source address and/or source
326             port that the proxy will use for sending UDP client
327             messages (e.g. Access Request).
328           </para>
329         </listitem>
330       </varlistentry>
331       <varlistentry>
332         <term><literal>SourceTCP</literal></term>
333         <listitem>
334           <para>
335             This can be used to specify source address and/or source
336             port that the proxy will use for TCP connections.
337           </para>
338         </listitem>
339       </varlistentry>
340       <varlistentry>
341         <term><literal>SourceTLS</literal></term>
342         <listitem>
343           <para>
344             This can be used to specify source address and/or source
345             port that the proxy will use for TLS connections.
346           </para>
347         </listitem>
348       </varlistentry>
349       <varlistentry>
350         <term><literal>SourceDTLS</literal></term>
351         <listitem>
352           <para>
353             This can be used to specify source address and/or source
354             port that the proxy will use for DTLS connections.
355           </para>
356         </listitem>
357       </varlistentry>
358       <varlistentry>
359         <term><literal>TTLAttribute</literal></term>
360         <listitem>
361           <para>
362             This can be used to change the default TTL attribute. Only
363             change this if you know what you are doing. The syntax is
364             either a numerical value denoting the TTL attribute, or
365             two numerical values separated by column specifying a
366             vendor attribute,
367             i.e. <literal>vendorid:attribute</literal>.
368           </para>
369         </listitem>
370       </varlistentry>
371       <varlistentry>
372         <term><literal>AddTTL</literal></term>
373         <listitem>
374           <para>
375             If a TTL attribute is present, the proxy will decrement
376             the value and discard the message if zero. Normally the
377             proxy does nothing if no TTL attribute is present. If you
378             use the AddTTL option with a value 1-255, the proxy will
379             when forwarding a message with no TTL attribute, add one
380             with the specified value. Note that this option can also
381             be specified for a client/server. It will then override
382             this setting when forwarding a message to that
383             client/server.
384           </para>
385         </listitem>
386       </varlistentry>
387       <varlistentry>
388         <term><literal>LoopPrevention</literal></term>
389         <listitem>
390           <para>
391             This can be set to <literal>on</literal> or
392             <literal>off</literal> with <literal>off</literal> being
393             the default. When this is enabled, a request will never be
394             sent to a server named the same as the client it was
395             received from. I.e., the names of the client block and the
396             server block are compared.  Note that this only gives
397             limited protection against loops.  It can be used as a
398             basic option and inside server blocks where it overrides
399             the basic setting.
400           </para>
401         </listitem>
402       </varlistentry>
403       <varlistentry>
404         <term><literal>Include</literal></term>
405         <listitem>
406           <para>
407             This is not a normal configuration option; it can be
408             specified multiple times.  It can both be used as a basic
409             option and inside blocks. For the full description, see
410             the configuration syntax section above.
411           </para>
412         </listitem>
413       </varlistentry>
414     </variablelist>
415   </refsect1>
416   <refsect1>
417     <title>Blocks</title>
418     <para>
419       There are five types of blocks, they are
420       <literal>client</literal>, <literal>server</literal>,
421       <literal>realm</literal>, <literal>tls</literal> and
422       <literal>rewrite</literal>. At least one instance of each of
423       <literal>client</literal> and <literal>realm</literal> is
424       required. This is necessary for the proxy to do anything useful,
425       and it will exit if not. The <literal>tls</literal> block is
426       required if at least one TLS/DTLS client or server is
427       configured. Note that there can be multiple blocks for each
428       type.  For each type, the block names should be unique. The
429       behaviour with multiple occurences of the same name for the same
430       block type is undefined. Also note that some block option values
431       may reference a block by name, in which case the block name must
432       be previously defined. Hence the order of the blocks may be
433       significant.
434     </para>
435   </refsect1>
436   <refsect1>
437     <title>Client Block</title>
438     <para>
439       The client block is used to configure a client. That is, tell
440       the proxy about a client, and what parameters should be used for
441       that client. The name of the client block must (with one
442       exception, see below) be either the IP address (IPv4 or IPv6) of
443       the client, an IP prefix (IPv4 or IPv6) on the form
444       IpAddress/PrefixLength, or a domain name (FQDN). Note that
445       literal IPv6 addresses must be enclosed in brackets.
446     </para>
447     <para>
448       If a domain name is specified, then this will be resolved
449       immediately to all the addresses associated with the name, and
450       the proxy will not care about any possible DNS changes that
451       might occur later. Hence there is no dependency on DNS after
452       startup.
453     </para>
454     <para>
455       When some client later sends a request to the proxy, the proxy
456       will look at the IP address the request comes from, and then go
457       through all the addresses of each of the configured clients (in
458       the order they are defined), to determine which (if any) of the
459       clients this is.
460     </para>
461     <para>
462       In the case of TLS/DTLS, the name of the client must match the
463       FQDN or IP address in the client certificate. Note that this is
464       not required when the client name is an IP prefix.
465     </para>
466     <para>
467       Alternatively one may use the <literal>host</literal> option
468       inside a client block. In that case, the value of the
469       <literal>host</literal> option is used as above, while the name
470       of the block is only used as a descriptive name for the
471       administrator. The host option may be used multiple times, and
472       can be a mix of addresses, FQDNs and prefixes.
473     </para>
474     <para>
475       The allowed options in a client block are
476       <literal>host</literal>, <literal>type</literal>,
477       <literal>secret</literal>, <literal>tls</literal>,
478       <literal>certificateNameCheck</literal>,
479       <literal>matchCertificateAttribute</literal>,
480       <literal>duplicateInterval</literal>, <literal>AddTTL</literal>,
481       <literal>fticksVISCOUNTRY</literal>, <literal>rewrite</literal>,
482       <literal>rewriteIn</literal>, <literal>rewriteOut</literal>, and
483       <literal>rewriteAttribute</literal>.
484
485       We already discussed the <literal>host</literal> option. The
486       value of <literal>type</literal> must be one of
487       <literal>udp</literal>, <literal>tcp</literal>,
488       <literal>tls</literal> or <literal>dtls</literal>. The value of
489       <literal>secret</literal> is the shared RADIUS key used with
490       this client. If the secret contains whitespace, the value must
491       be quoted. This option is optional for TLS/DTLS and if omitted
492       will default to "mysecret".  Note that the default value of
493       <literal>secret</literal> will change in an upcoming release.
494     </para>
495     <para>
496       For a TLS/DTLS client you may also specify the
497       <literal>tls</literal> option.  The option value must be the
498       name of a previously defined TLS block. If this option is not
499       specified, the TLS block with the name
500       <literal>defaultClient</literal> will be used if defined. If not
501       defined, it will try to use the TLS block named
502       <literal>default</literal>. If the specified TLS block name does
503       not exist, or the option is not specified and none of the
504       defaults exist, the proxy will exit with an error.
505     </para>
506     <para>
507       For a TLS/DTLS client, the option
508       <literal>certificateNameCheck</literal> can be set to
509       <literal>off</literal>, to disable the default behaviour of
510       matching CN or SubjectAltName against the specified hostname or
511       IP address.
512     </para>
513     <para>
514       Additional validation of certificate attributes can be done by
515       use of the <literal>matchCertificateAttribute</literal>
516       option. Currently one can only do some matching of CN and
517       SubjectAltName. For regexp matching on CN, one can use the value
518       <literal>CN:/regexp/</literal>. For SubjectAltName one can only
519       do regexp matching of the URI, this is specified as
520       <literal>SubjectAltName:URI:/regexp/</literal>. Note that
521       currently this option can only be specified once in a client
522       block.
523     </para>
524     <para>
525       The <literal>duplicateInterval</literal> option can be used to
526       specify for how many seconds duplicate checking should be
527       done. If a proxy receives a new request within a few seconds of
528       a previous one, it may be treated the same if from the same
529       client, with the same authenticator etc. The proxy will then
530       ignore the new request (if it is still processing the previous
531       one), or returned a copy of the previous reply.
532     </para>
533     <para>
534       The <literal>AddTTL</literal> option is similar to the
535       <literal>AddTTL</literal> option used in the basic config. See
536       that for details. Any value configured here overrides the basic
537       one when sending messages to this client.
538     </para>
539     <para>
540       The <literal>fticksVISCOUNTRY</literal> option configures
541       clients eligible to F-Ticks logging as defined by the
542       <literal>FTicksReporting</literal> basic option.
543     </para>
544     <para>
545       The <literal>rewrite</literal> option is deprecated. Use
546       <literal>rewriteIn</literal> instead.
547     </para>
548     <para>
549       The <literal>rewriteIn</literal> option can be used to refer to
550       a rewrite block that specifies certain rewrite operations that
551       should be performed on incoming messages from the client. The
552       rewriting is done before other processing.  For details, see the
553       rewrite block text below. Similarly to <literal>tls</literal>
554       discussed above, if this option is not used, there is a fallback
555       to using the <literal>rewrite</literal> block named
556       <literal>defaultClient</literal> if it exists; and if not, a
557       fallback to a block named <literal>default</literal>.
558     </para>
559     <para>
560       The <literal>rewriteOut</literal> option is used in the same way
561       as <literal>rewriteIn</literal>, except that it specifies
562       rewrite operations that should be performed on outgoing messages
563       to the client. The rewriting is done after other
564       processing. Also, there is no rewrite fallback if this option is
565       not used.
566     </para>
567     <para>
568       The <literal>rewriteAttribute</literal> option currently makes
569       it possible to specify that the User-Name attribute in a client
570       request shall be rewritten in the request sent by the proxy. The
571       User-Name attribute is written back to the original value if a
572       matching response is later sent back to the client. The value
573       must be on the form User-Name:/regexpmatch/replacement/. Example
574       usage:
575       <blockquote>
576         <para>
577           rewriteAttribute User-Name:/^(.*)@local$/\1@example.com/
578         </para>
579       </blockquote>
580     </para>
581   </refsect1>
582   <refsect1>
583     <title>Server Block</title>
584     <para>
585       The server block is used to configure a server. That is, tell
586       the proxy about a server, and what parameters should be used
587       when communicating with that server.  The name of the server
588       block must (with one exception, see below) be either the IP
589       address (IPv4 or IPv6) of the server, or a domain name
590       (FQDN). If a domain name is specified, then this will be
591       resolved immediately to all the addresses associated with the
592       name, and the proxy will not care about any possible DNS changes
593       that might occur later. Hence there is no dependency on DNS
594       after startup. If the domain name resolves to multiple
595       addresses, then for UDP/DTLS the first address is used. For
596       TCP/TLS, the proxy will loop through the addresses until it can
597       connect to one of them. In the case of TLS/DTLS, the name of the
598       server must match the FQDN or IP address in the server
599       certificate.
600     </para>
601     <para>
602       Alternatively one may use the <literal>host</literal> option
603       inside a server block. In that case, the value of the
604       <literal>host</literal> option is used as above, while the name
605       of the block is only used as a descriptive name for the
606       administrator. Note that multiple host options may be used. This
607       will then be treated as multiple names/addresses for the same
608       server. When initiating a TCP/TLS connection, all addresses of
609       all names may be attempted, but there is no failover between the
610       different host values. For failover one must use separate server
611       blocks.
612     </para>
613     <para>
614       Note that the name of the block, or values of host options may
615       include a port number (separated with a column). This port
616       number will then override the default port or a port option in
617       the server block. Also note that literal IPv6 addresses must be
618       enclosed in brackets.
619     </para>
620     <para>
621       The allowed options in a server block are
622       <literal>host</literal>, <literal>port</literal>,
623       <literal>type</literal>, <literal>secret</literal>,
624       <literal>tls</literal>, <literal>certificateNameCheck</literal>,
625       <literal>matchCertificateAttribute</literal>,
626       <literal>AddTTL</literal>, <literal>rewrite</literal>,
627       <literal>rewriteIn</literal>, <literal>rewriteOut</literal>,
628       <literal>statusServer</literal>, <literal>retryCount</literal>,
629       <literal>retryInterval</literal>,
630       <literal>dynamicLookupCommand</literal> and
631       <literal>LoopPrevention</literal>.
632     </para>
633     <para>
634       We already discussed the <literal>host</literal> option. The
635       <literal>port</literal> option allows you to specify which port
636       number the server uses. The usage of <literal>type</literal>,
637       <literal>secret</literal>, <literal>tls</literal>,
638       <literal>certificateNameCheck</literal>,
639       <literal>matchCertificateAttribute</literal>,
640       <literal>AddTTL</literal>, <literal>rewrite</literal>,
641       <literal>rewriteIn</literal> and <literal>rewriteOut</literal>
642       are just as specified for the <literal>client block</literal>
643       above, except that <literal>defaultServer</literal> (and not
644       <literal>defaultClient</literal>) is the fallback for the
645       <literal>tls</literal>, <literal>rewrite</literal> and
646       <literal>rewriteIn</literal> options.
647     </para>
648     <para>
649       <literal>statusServer</literal> can be specified to enable the
650       use of status-server messages for this server. The value must be
651       either <literal>on</literal> or <literal>off</literal>. The
652       default when not specified, is <literal>off</literal>. If
653       statusserver is enabled, the proxy will during idle periods send
654       regular status-server messages to the server to verify that it
655       is alive. This should only be enabled if the server supports it.
656     </para>
657     <para>
658       The options <literal>retryCount</literal> and
659       <literal>retryInterval</literal> can be used to specify how many
660       times the proxy should retry sending a request and how long it
661       should wait between each retry. The defaults are 2 retries and
662       an interval of 5s.
663     </para>
664     <para>
665       The option <literal>dynamicLookupCommand</literal> can be used
666       to specify a command that should be executed to dynamically
667       configure and use a server.  The use of this feature will be
668       documented separately/later.
669     </para>
670     <para>
671       Using the <literal>LoopPrevention</literal> option here
672       overrides any basic setting of this option.  See section
673       <literal>BASIC OPTIONS</literal> for details on this option.
674     </para>
675   </refsect1>
676   <refsect1>
677     <title>Realm Block</title>
678     <para>
679       When the proxy receives an Access-Request it needs to figure out
680       to which server it should be forwarded. This is done by looking
681       at the Username attribute in the request, and matching that
682       against the names of the defined realm blocks.  The proxy will
683       match against the blocks in the order they are specified, using
684       the first match if any. If no realm matches, the proxy will
685       simply ignore the request. Each realm block specifies what the
686       server should do when a match is found. A realm block may
687       contain none, one or multiple <literal>server</literal> options,
688       and similarly <literal>accountingServer</literal> options. There
689       are also <literal>replyMessage</literal> and
690       <literal>accountingResponse</literal> options. We will discuss
691       these later.
692     </para>
693     <refsect2>
694       <title>Realm block names and matching</title>
695       <para>
696         In the general case the proxy will look for a
697         <literal>@</literal> in the username attribute, and try to do
698         an exact case insensitive match between what comes after the
699         <literal>@</literal> and the name of the realm block. So if
700         you get a request with the attribute value
701         <literal>anonymous@example.com</literal>, the proxy will go
702         through the realm names in the order they are specified,
703         looking for a realm block named
704         <literal>example.com</literal>.
705       </para>
706       <para>
707         There are two exceptions to this, one is the realm name
708         <literal>*</literal> which means match everything. Hence if
709         you have a realm block named <literal>*</literal>, then it
710         will always match. This should then be the last realm block
711         defined, since any blocks after this would never be
712         checked. This is useful for having a default.
713       </para>
714       <para>
715         The other exception is regular expression matching. If the
716         realm name starts with a <literal>/</literal>, the name is
717         treated as an regular expression. A case insensitive regexp
718         match will then be done using this regexp on the value of the
719         entire Username attribute. Optionally you may also have a
720         trailing <literal>/</literal> after the regexp. So as an
721         example, if you want to use regexp matching the domain
722         <literal>example.com</literal> you could have a realm block
723         named <literal>/@example\\.com$</literal>. Optinally this can
724         also be written <literal>/@example\\.com$/</literal>. If you
725         want to match all domains under the <literal>.com</literal>
726         top domain, you could do <literal>/@.*\\.com$</literal>. Note
727         that since the matching is done on the entire attribute value,
728         you can also use rules like
729         <literal>/^[a-k].*@example\\.com$/</literal> to get some of
730         the users in this domain to use one server, while other users
731         could be matched by another realm block and use another
732         server.
733       </para>
734     </refsect2>
735     <refsect2>
736       <title>Realm block options</title>
737       <para>
738         A realm block may contain none, one or multiple
739         <literal>server</literal> options. If defined, the values of
740         the <literal>server</literal> options must be the names of
741         previously defined server blocks. Normally requests will be
742         forwarded to the first server option defined. If there are
743         multiple server options, the proxy will do fail-over and use
744         the second server if the first is down. If the two first are
745         down, it will try the third etc. If say the first server comes
746         back up, it will go back to using that one. Currently
747         detection of servers being up or down is based on the use of
748         StatusServer (if enabled), and that TCP/TLS/DTLS connections
749         are up.
750       </para>
751       <para>
752         A realm block may also contain none, one or multiple
753         <literal>accountingServer</literal> options. This is used
754         exactly like the <literal>server</literal> option, except that
755         it is used for specifying where to send matching accounting
756         requests. The values must be the names of previously defined
757         server blocks. When multiple accounting servers are defined,
758         there is a failover mechanism similar to the one for the
759         <literal>server</literal> option.
760       </para>
761       <para>
762         If there is no <literal>server</literal> option, the proxy
763         will if <literal>replyMessage</literal> is specified, reply
764         back to the client with an Access Reject message. The message
765         contains a replyMessage attribute with the value as specified
766         by the <literal>replyMessage</literal> option. Note that this
767         is different from having no match since then the request is
768         simply ignored. You may wonder why this is useful. One example
769         is if you handle say all domains under say
770         <literal>.bv</literal>. Then you may have several realm blocks
771         matching the domains that exists, while for other domains
772         under <literal>.bv</literal> you want to send a reject. At the
773         same time you might want to send all other requests to some
774         default server. After the realms for the subdomains, you would
775         then have two realm definitions. One with the name
776         <literal>/@.*\\.bv$</literal> with no servers, followed by one
777         with the name <literal>*</literal> with the default server
778         defined. This may also be useful for blocking particular
779         usernames.
780       </para>
781       <para>
782         If there is no <literal>accountingServer</literal> option, the
783         proxy will normally do nothing, ignoring accounting
784         requests. There is however an option called
785         <literal>accountingResponse</literal>. If this is set to
786         <literal>on</literal>, the proxy will log some of the
787         accounting information and send an Accounting-Response
788         back. This is useful if you do not care much about accounting,
789         but want to stop clients from retransmitting accounting
790         requests. By default this option is set to
791         <literal>off</literal>.
792       </para>
793     </refsect2>
794   </refsect1>
795   <refsect1>
796     <title>TLS Block</title>
797     <para>
798       The TLS block specifies TLS configuration options and you need
799       at least one of these if you have clients or servers using
800       TLS/DTLS. As discussed in the client and server block
801       descriptions, a client or server block may reference a
802       particular TLS block by name. There are also however the special
803       TLS block names <literal>default</literal>,
804       <literal>defaultClient</literal> and
805       <literal>defaultServer</literal> which are used as defaults if
806       the client or server block does not reference a TLS block. Also
807       note that a TLS block must be defined before the client or
808       server block that would use it. If you want the same TLS
809       configuration for all TLS/DTLS clients and servers, you need
810       just a single tls block named <literal>default</literal>, and
811       the client and servers need not refer to it. If you want all
812       TLS/DTLS clients to use one config, and all TLS/DTLS servers to
813       use another, then you would be fine only defining two TLS blocks
814       named <literal>defaultClient</literal> and
815       <literal>defaultServer</literal>. If you want different clients
816       (or different servers) to have different TLS parameters, then
817       you may need to create other TLS blocks with other names, and
818       reference those from the client or server definitions. Note that
819       you could also have say a client block refer to a default, even
820       <literal>defaultServer</literal> if you really want to.
821     </para>
822     <para>
823       The available TLS block options are
824       <literal>CACertificateFile</literal>,
825       <literal>CACertificatePath</literal>,
826       <literal>certificateFile</literal>,
827       <literal>certificateKeyFile</literal>,
828       <literal>certificateKeyPassword</literal>,
829       <literal>cacheExpiry</literal>, <literal>CRLCheck</literal> and
830       <literal>policyOID</literal>.  When doing RADIUS over TLS/DTLS,
831       both the client and the server present certificates, and they
832       are both verified by the peer. Hence you must always specify
833       <literal>certificateFile</literal> and
834       <literal>certificateKeyFile</literal> options, as well as
835       <literal>certificateKeyPassword</literal> if a password is
836       needed to decrypt the private key. Note that
837       <literal>CACertificateFile</literal> may be a certificate
838       chain. In order to verify certificates, or send a chain of
839       certificates to a peer, you also always need to specify
840       <literal>CACertificateFile</literal> or
841       <literal>CACertificatePath</literal>.  Note that you may specify
842       both, in which case the certificates in
843       <literal>CACertificateFile</literal> are checked first. By
844       default CRLs are not checked. This can be changed by setting
845       <literal>CRLCheck</literal> to <literal>on</literal>. One can
846       require peer certificates to adhere to certain policies by
847       specifying one or multiple policyOIDs using one or multiple
848       <literal>policyOID</literal> options.
849     </para>
850     <para>
851       CA certificates and CRLs are normally cached permanently. That
852       is, once a CA or CRL has been read, the proxy will never attempt
853       to re-read it. CRLs may change relatively often and the proxy
854       should ideally always use the latest CRLs. Rather than
855       restarting the proxy, there is an option
856       <literal>cacheExpiry</literal> that specifies how many seconds
857       the CA and CRL information should be cached. Reasonable values
858       might be say 3600 (1 hour) or 86400 (24 hours), depending on how
859       frequently CRLs are updated and how critical it is to be up to
860       date. This option may be set to zero to disable caching.
861     </para>
862   </refsect1>
863   <refsect1>
864     <title>Rewrite Block</title>
865     <para>
866       The rewrite block specifies rules that may rewrite RADIUS
867       messages. It can be used to add, remove and modify specific
868       attributes from messages received from and sent to clients and
869       servers. As discussed in the client and server block
870       descriptions, a client or server block may reference a
871       particular rewrite block by name. There are however also the
872       special rewrite block names <literal>default</literal>,
873       <literal>defaultClient</literal> and
874       <literal>defaultServer</literal> which are used as defaults if
875       the client or server block does not reference a block. Also note
876       that a rewrite block must be defined before the client or server
877       block that would use it. If you want the same rewrite rules for
878       input from all clients and servers, you need just a single
879       rewrite block named <literal>default</literal>, and the client
880       and servers need not refer to it. If you want all clients to use
881       one config, and all servers to use another, then you would be
882       fine only defining two rewrite blocks named
883       <literal>defaultClient</literal> and
884       <literal>defaultServer</literal>. Note that these defaults are
885       only used for rewrite on input. No rewriting is done on output
886       unless explicitly specifed using the
887       <literal>rewriteOut</literal> option.
888     </para>
889     <para>
890       The available rewrite block options are
891       <literal>addAttribute</literal>,
892       <literal>addVendorAttribute</literal>,
893       <literal>removeAttribute</literal>,
894       <literal>removeVendorAttribute</literal> and
895       <literal>modifyAttribute</literal>. They can all be specified
896       none, one or multiple times.
897     </para>
898     <para>
899       <literal>addAttribute</literal> is used to add attributes to a
900       message. The option value must be on the form
901       <literal>attribute:value</literal> where attribute is a
902       numerical value specifying the attribute.  Simliarly, the
903       <literal>addVendorAttribute</literal> is used to specify a
904       vendor attribute to be added.  The option value must be on the
905       form <literal>vendor:subattribute:value</literal>, where vendor
906       and subattribute are numerical values.
907     </para>
908     <para>
909       The <literal>removeAttribute</literal> option is used to specify
910       an attribute that should be removed from received messages. The
911       option value must be a numerical value specifying which
912       attribute is to be removed.  Similarly,
913       <literal>removeVendorAttribute</literal> is used to specify a
914       vendor attribute that is to be removed. The value can be a
915       numerical value for removing all attributes from a given vendor,
916       or on the form <literal>vendor:subattribute</literal>, where
917       vendor and subattribute are numerical values, for removing a
918       specific subattribute for a specific vendor.
919     </para>
920     <para>
921       <literal>modifyAttribute</literal> is used to specify
922       modification of attributes. The value must be on the form
923       <literal>attribute:/regexpmatch/replacement/</literal> where
924       attribute is a numerical attribute type, regexpmatch is regexp
925       matching rule and replacement specifies how to replace the
926       matching regexp. Example usage:
927       <blockquote>
928         <para>
929           modifyAttribute 1:/^(.*)@local$/\1@example.com/
930         </para>
931       </blockquote>
932     </para>
933   </refsect1>
934   <refsect1>
935     <title>See Also</title>
936     <para>
937       <citerefentry>
938         <refentrytitle>radsecproxy</refentrytitle><manvolnum>1</manvolnum>
939         </citerefentry>,
940         <ulink url="http://tools.ietf.org/html/draft-ietf-radext-radsec">
941           <citetitle>RadSec internet draft</citetitle>
942         </ulink>
943     </para>
944   </refsect1>
945 </refentry>