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