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