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