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