radsecproxy.conf.5.xml 45.8 KB
Newer Older
1 2 3 4
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry>
  <refentryinfo>
5
    <date>2018-09-03</date>
6 7
  </refentryinfo>
  <refmeta>
8
    <refentrytitle>radsecproxy.conf</refentrytitle>
9
    <manvolnum>5</manvolnum>
10
    <refmiscinfo>radsecproxy 1.7.2</refmiscinfo>
11 12 13 14 15
  </refmeta>
  <refnamediv>
    <refname>
      <application>radsecproxy.conf</application>
    </refname>
16
    <refpurpose>Radsec proxy configuration file</refpurpose>
17 18 19 20
  </refnamediv>
  <refsect1>
    <title>Description</title>
    <para>
21 22 23
      When the proxy server starts, it will first check the command
      line arguments, and then read the configuration file. Normally
      radsecproxy will read the configuration file
24
      <filename>/usr/local/etc/radsecproxy.conf</filename>. The command line
25 26
      <option>-c</option> option can be used to instead read an
      alternate file (see
27
      <citerefentry>
28
        <refentrytitle>radsecproxy</refentrytitle><manvolnum>1</manvolnum>
29
      </citerefentry>
30
      for details).
31 32
    </para>
    <para>
33 34 35 36
      If the configuration file can not be found, the proxy will exit
      with an error message. Note that there is also an include facility
      so that any configuration file may include other configuration
      files. The proxy will also exit on configuration errors.
37 38 39 40 41
    </para>
  </refsect1>
  <refsect1>
    <title>Configuration Syntax</title>
    <para>
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
      When the configuration file is processed, whitespace (spaces and
      tabs) are generally ignored. For each line, leading and trailing
      whitespace are ignored.  A line is ignored if it is empty, only
      consists of whitespace, or if the first non-whitespace character
      is a <literal>#</literal>. The configuration is generally case
      insensitive, but in some cases the option values (see below) are
      not.
    </para>
    <para>
      There are two types of configuration structures than can be
      used. The first and simplest are lines on the format
      <emphasis>option value</emphasis>. That is, an option name, see
      below for a list of valid options, followed by whitespace (at
      least one space or tab character), followed by a value. Note
      that if the value contains whitespace, then it must be quoted
      using <literal>""</literal> or <literal>''</literal>. Any
      whitespace in front of the option or after the value will be
      ignored.
    </para>
    <para>
      The other type of structure is a block. A block spans at least
      two lines, and has the format:
      <blockquote><literallayout>
65 66 67 68 69
blocktype name {
    option value
    option value
    ...
}
70 71 72 73 74 75 76 77 78
      </literallayout></blockquote>
      That is, some blocktype, see below for a list of the different
      block types, and then enclosed in braces you have zero or more
      lines that each have the previously described <emphasis>option
      value</emphasis> format. Different block types have different
      rules for which options can be specified, they are listed
      below. The rules regarding white space, comments and quotes are
      as above. Hence you may do things like:
      <blockquote><literallayout>
79 80 81 82 83
blocktype name {
#    option value
    option "value with space"
    ...
}
84
      </literallayout></blockquote>
85 86
    </para>
    <para>
87 88 89 90 91 92 93 94
      Option value characters can also be written in hex. This is done
      by writing the character <literal>%</literal> followed by two
      hexadecimal digits. If a <literal>%</literal> is used without
      two following hexadecimal digits, the <literal>%</literal> and
      the following characters are used as written. If you want to
      write a <literal>%</literal> and not use this decoding, you may
      of course write <literal>%</literal> in hex; i.e.,
      <literal>%25</literal>.
95 96
    </para>
    <para>
97 98 99 100 101
      There is one special option that can be used both as a basic
      option and inside all blocks. That is the option
      <literal>Include</literal> where the value specifies files to be
      included. The value can be a single file, or it can use normal
      shell globbing to specify multiple files, e.g.:
102 103
      <blockquote>
        <para>
104
	  include /usr/local/etc/radsecproxy.conf.d/*.conf
105 106
        </para>
      </blockquote>
107 108 109 110 111 112
      The files are sorted alphabetically. Included files are read in
      the order they are specified, when reaching the end of a file,
      the next file is read. When reaching the end of the last
      included file, the proxy returns to read the next line following
      the <literal>Include</literal> option. Included files may again
      include other files.
113 114 115 116 117
    </para>
  </refsect1>
  <refsect1>
    <title>Basic Options</title>
    <para>
118 119 120 121 122
      The following basic options may be specified in the
      configuration file. Note that blocktypes and options inside
      blocks are discussed later. Note that none of these options are
      required, and indeed in many cases they are not needed.  Note
      that you should specify each at most once. The behaviour with
123
      multiple occurrences is undefined.
124 125
    </para>
    <variablelist>
126 127 128 129 130 131 132 133 134 135 136
      <varlistentry>
        <term><literal>PidFile</literal></term>
        <listitem>
	  <para>
            The PidFile option specifies the name of a file to which
            the process id (PID) will be written.  This is overridden
            by the <option>-i</option> command line option.  There is
            no default value for the PidFile option.
	  </para>
        </listitem>
      </varlistentry>
137
      <varlistentry>
138
        <term><literal>LogLevel</literal></term>
139 140
        <listitem>
	  <para>
141 142 143 144 145
	    This option specifies the debug level. It must be set to
	    1, 2, 3, 4 or 5, where 1 logs only serious errors, and 5
	    logs everything. The default is 2 which logs errors,
	    warnings and a few informational messages. Note that the
	    command line option <option>-d</option> overrides this.
146 147 148 149
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
150
        <term><literal>LogDestination</literal></term>
151 152
        <listitem>
	  <para>
153 154 155 156 157 158
	    This specifies where the log messages should go. By
	    default the messages go to syslog with facility
	    <literal>LOG_DAEMON</literal>. Using this option you can
	    specify another syslog facility, or you may specify that
	    logging should be to a particular file, not using
	    syslog. The value must be either a file or syslog URL. The
159 160
	    file URL is the standard one <literal>file:///var/log/radius.log
	    </literal>, specifying a local file that
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
	    should be used. For syslog, you must use the syntax:
	    <literal>x-syslog:///FACILITY</literal> where
	    <literal>FACILITY</literal> must be one of
	    <literal>LOG_DAEMON</literal>,
	    <literal>LOG_MAIL</literal>, <literal>LOG_USER</literal>,
	    <literal>LOG_LOCAL0</literal>,
	    <literal>LOG_LOCAL1</literal>,
	    <literal>LOG_LOCAL2</literal>,
	    <literal>LOG_LOCAL3</literal>,
	    <literal>LOG_LOCAL4</literal>,
	    <literal>LOG_LOCAL5</literal>,
	    <literal>LOG_LOCAL6</literal> or
	    <literal>LOG_LOCAL7</literal>. You may omit the facility
	    from the URL to specify logging to the default facility,
	    but this is not very useful since this is the default log
	    destination. Note that this option is ignored if
	    <option>-f</option> is specified on the command line.
178 179 180
	  </para>
        </listitem>
      </varlistentry>
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
	  <varlistentry>
        <term><literal>LogThreadId</literal></term>
        <listitem>
	  <para>
		This can be set to <literal>on</literal> to include the
		thread-id in the log messages (useful for debugging).
	  </para>
		</listitem>
	  </varlistentry>
	  <varlistentry>
		<term><literal>LogFullUsername</literal></term>
		<listitem>
	  <para>
	    This can be set to <literal>off</literal> to only log the
	    realm in Access-Accept/Reject log messages (for privacy).
	  </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
        <term><literal>LogMAC</literal></term>
        <listitem>
	  <para>
	    The LogMAC option can be used to control if and how
	    Calling-Station-Id (the users Ethernet MAC address) is
	    being logged.  It can be set to one of
	    <literal>Static</literal>, <literal>Original</literal>,
	    <literal>VendorHashed</literal>,
	    <literal>VendorKeyHashed</literal>,
	    <literal>FullyHashed</literal> or
	    <literal>FullyKeyHashed</literal>.
	    The default value for LogMAC is <literal>Original</literal>.
	</para>
	  <para>
	    See <literal>radsecproxy.conf-example</literal> for details.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><literal>LogKey</literal></term>
        <listitem>
	  <para>
	    The LogKey option is used to specify the key to use
	    when producing HMAC's as an effect of specifying
	    VendorKeyHashed or FullyKeyHashed for the LogMAC
	    option.
	  </para>
	</listitem>
      </varlistentry>

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245

      <varlistentry>
        <term><literal>FTicksReporting</literal></term>
        <listitem>
	  <para>
	    The FTicksReporting option is used to enable F-Ticks
	    logging and can be set to <literal>None</literal>,
	    <literal>Basic</literal> or <literal>Full</literal>.  Its
	    default value is <literal>None</literal>.  If
	    FTicksReporting is set to anything other than
	    <literal>None</literal>, note that the default value for
	    FTicksMAC is <literal>VendorKeyHashed</literal> which
	    needs FTicksKey to be set.
	  </para>
	  <para>
246
	    See <literal>radsecproxy.conf-example</literal> for details.
247 248 249 250
	  </para>
	</listitem>
      </varlistentry>

251
      <varlistentry>
252
        <term><literal>FTicksMAC</literal></term>
253 254
        <listitem>
	  <para>
255 256 257 258 259 260
	    The FTicksMAC option has the same function as LogMAC for FTicks.
		The default for FTicksMAC is <literal>VendorKeyHashed</literal> which
	    needs FTicksKey to be set.
	</para>
	<para>
	    Before choosing any of <literal>Original</literal>,
261 262 263 264 265 266 267 268 269 270 271 272
	    <literal>FullyHashed</literal> or
	    <literal>VendorHashed</literal>, consider the implications
	    for user privacy when MAC addresses are collected.  How
	    will the logs be stored, transferred and accessed?
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
        <term><literal>FTicksKey</literal></term>
        <listitem>
	  <para>
273
	    The FTicksKey option has the same function as LogKey for Fticks.
274 275 276 277
	  </para>
	</listitem>
      </varlistentry>

278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
      <varlistentry>
        <term><literal>FTicksSyslogFacility</literal></term>
        <listitem>
	  <para>
	    The FTicksSyslogFacility option is used to specify a
	    dedicated syslog facility for F-Ticks messages.  This
	    allows for easier filtering of F-Ticks messages.  If no
	    FTicksSyslogFacility option is given, F-Ticks messages are
	    written to what the LogDestination option specifies.
	  </para>
	  <para>
	    F-Ticks messages are always logged using the log level
	    LOG_DEBUG.  Note that specifying a file in
	    FTicksSyslogFacility (using the file:/// prefix) is
	    not supported.
	  </para>
	</listitem>
      </varlistentry>

297 298 299 300 301 302 303 304 305 306 307 308 309
	  <varlistentry>
	    <term><literal>FTicksPrefix</literal></term>
	    <listitem>
	  <para>
	    The FTicksPrefix option is used to set the prefix printed in
		F-Ticks messages.  This allows for use of F-Ticks messages in
		non-eduroam environments. If no FTicksPrefix option is given, it
		defaults to the prefix used for eduroam
		(<literal>F-TICKS/eduroam/1.0</literal>)
	  </para>
	  </listitem>
	  </varlistentry>

310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
      <varlistentry>
        <term><literal>ListenUDP</literal></term>
        <listitem>
	  <para>
	    Normally the proxy will listen to the standard RADIUS UDP
	    port <literal>1812</literal> if configured to handle UDP
	    clients. On most systems it will do this for all of the
	    system's IP addresses (both IPv4 and IPv6). On some
	    systems however, it may respond to only IPv4 or only
	    IPv6. To specify an alternate port you may use a value on
	    the form <literal>*:port</literal> where port is any valid
	    port number. If you also want to specify a specific
	    address you can do
	    e.g. <literal>192.168.1.1:1812</literal> or
	    <literal>[2001:db8::1]:1812</literal>. The port may be
	    omitted if you want the default one (like in these
	    examples). These examples are equivalent to
	    <literal>192.168.1.1</literal> and
	    <literal>2001:db8::1</literal>. Note that you must use
	    brackets around the IPv6 address.  This option may be
	    specified multiple times to listen to multiple addresses
	    and/or ports.
332 333 334 335
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
336
        <term><literal>ListenTCP</literal></term>
337 338
        <listitem>
	  <para>
339 340 341 342
	    This option is similar to the <literal>ListenUDP</literal>
	    option, except that it is used for receiving connections
	    from TCP clients. The default port number is
	    <literal>1812</literal>.
343 344 345 346
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
347
        <term><literal>ListenTLS</literal></term>
348 349
        <listitem>
	  <para>
350 351 352 353 354
	    This is similar to the <literal>ListenUDP</literal>
	    option, except that it is used for receiving connections
	    from TLS clients. The default port number is
	    <literal>2083</literal>. Note that this option was
	    previously called <literal>ListenTCP</literal>.
355 356 357 358
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
359
        <term><literal>ListenDTLS</literal></term>
360 361
        <listitem>
	  <para>
362 363 364 365
	    This is similar to the <literal>ListenUDP</literal>
	    option, except that it is used for receiving connections
	    from DTLS clients. The default port number is
	    <literal>2083</literal>.
366 367 368 369
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
370
        <term><literal>SourceUDP</literal></term>
371 372
        <listitem>
	  <para>
373 374 375
	    This can be used to specify source address and/or source
	    port that the proxy will use for sending UDP client
	    messages (e.g. Access Request).
376 377 378 379
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
380
        <term><literal>SourceTCP</literal></term>
381 382
        <listitem>
	  <para>
383 384
	    This can be used to specify source address and/or source
	    port that the proxy will use for TCP connections.
385 386 387 388
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
389
        <term><literal>SourceTLS</literal></term>
390 391
        <listitem>
	  <para>
392 393
	    This can be used to specify source address and/or source
	    port that the proxy will use for TLS connections.
394 395 396 397
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
398
        <term><literal>SourceDTLS</literal></term>
399 400
        <listitem>
	  <para>
401 402
	    This can be used to specify source address and/or source
	    port that the proxy will use for DTLS connections.
403 404 405 406 407 408 409
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term><literal>TTLAttribute</literal></term>
        <listitem>
	  <para>
410 411 412 413 414 415
	    This can be used to change the default TTL attribute. Only
	    change this if you know what you are doing. The syntax is
	    either a numerical value denoting the TTL attribute, or
	    two numerical values separated by column specifying a
	    vendor attribute,
	    i.e. <literal>vendorid:attribute</literal>.
416 417 418 419
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
420
        <term><literal>AddTTL  </literal></term>
421 422
        <listitem>
	  <para>
423 424 425 426 427 428 429 430 431
	    If a TTL attribute is present, the proxy will decrement
	    the value and discard the message if zero. Normally the
	    proxy does nothing if no TTL attribute is present. If you
	    use the AddTTL option with a value 1-255, the proxy will
	    when forwarding a message with no TTL attribute, add one
	    with the specified value. Note that this option can also
	    be specified for a client/server. It will then override
	    this setting when forwarding a message to that
	    client/server.
432 433 434 435
	  </para>
        </listitem>
      </varlistentry>
      <varlistentry>
436
        <term><literal>LoopPrevention</literal></term>
437 438
        <listitem>
	  <para>
439 440 441 442 443 444 445 446 447
	    This can be set to <literal>on</literal> or
	    <literal>off</literal> with <literal>off</literal> being
	    the default. When this is enabled, a request will never be
	    sent to a server named the same as the client it was
	    received from. I.e., the names of the client block and the
	    server block are compared.  Note that this only gives
	    limited protection against loops.  It can be used as a
	    basic option and inside server blocks where it overrides
	    the basic setting.
448 449 450
	  </para>
        </listitem>
      </varlistentry>
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
      <varlistentry>
        <term><literal>IPv4Only and IPv6Only</literal></term>
        <listitem>
	  <para>
            These can be set to <literal>on</literal> or
            <literal>off</literal> with <literal>off</literal> being
            the default.  At most one of <literal>IPv4Only</literal>
            and <literal>IPv6Only</literal> can be enabled.  Enabling
            <literal>IPv4Only</literal> or <literal>IPv6Only</literal>
            makes radsecproxy resolve DNS names to the corresponding
            address family only, and not the other.  This is done for
            both clients and servers.  Note that this can be
            overridden in <literal>client</literal> and
            <literal>server</literal> blocks, see below.
	  </para>
        </listitem>
      </varlistentry>
468
      <varlistentry>
469
        <term><literal>Include</literal></term>
470 471
        <listitem>
	  <para>
472 473 474 475
	    This is not a normal configuration option; it can be
	    specified multiple times.  It can both be used as a basic
	    option and inside blocks. For the full description, see
	    the configuration syntax section above.
476 477 478 479 480 481 482 483
	  </para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
  <refsect1>
    <title>Blocks</title>
    <para>
484 485 486 487 488 489 490 491 492 493
      There are five types of blocks, they are
      <literal>client</literal>, <literal>server</literal>,
      <literal>realm</literal>, <literal>tls</literal> and
      <literal>rewrite</literal>. At least one instance of each of
      <literal>client</literal> and <literal>realm</literal> is
      required. This is necessary for the proxy to do anything useful,
      and it will exit if not. The <literal>tls</literal> block is
      required if at least one TLS/DTLS client or server is
      configured. Note that there can be multiple blocks for each
      type.  For each type, the block names should be unique. The
494
      behaviour with multiple occurrences of the same name for the same
495 496 497 498
      block type is undefined. Also note that some block option values
      may reference a block by name, in which case the block name must
      be previously defined. Hence the order of the blocks may be
      significant.
499 500 501 502 503
    </para>
  </refsect1>
  <refsect1>
    <title>Client Block</title>
    <para>
504 505 506 507 508
      The client block is used to configure a client. That is, tell
      the proxy about a client, and what parameters should be used for
      that client. The name of the client block must (with one
      exception, see below) be either the IP address (IPv4 or IPv6) of
      the client, an IP prefix (IPv4 or IPv6) on the form
509 510 511 512 513
      IpAddress/PrefixLength, or a domain name (FQDN).  The way an
      FQDN is resolved into an IP address may be influenced by the use
      of the <literal>IPv4Only</literal> and
      <literal>IPv6Only</literal> options.  Note that literal IPv6
      addresses must be enclosed in brackets.
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
    </para>
    <para>
      If a domain name is specified, then this will be resolved
      immediately to all the addresses associated with the name, and
      the proxy will not care about any possible DNS changes that
      might occur later. Hence there is no dependency on DNS after
      startup.
    </para>
    <para>
      When some client later sends a request to the proxy, the proxy
      will look at the IP address the request comes from, and then go
      through all the addresses of each of the configured clients (in
      the order they are defined), to determine which (if any) of the
      clients this is.
    </para>
    <para>
      In the case of TLS/DTLS, the name of the client must match the
      FQDN or IP address in the client certificate. Note that this is
      not required when the client name is an IP prefix.
    </para>
    <para>
      Alternatively one may use the <literal>host</literal> option
      inside a client block. In that case, the value of the
      <literal>host</literal> option is used as above, while the name
      of the block is only used as a descriptive name for the
      administrator. The host option may be used multiple times, and
      can be a mix of addresses, FQDNs and prefixes.
    </para>
    <para>
      The allowed options in a client block are
544 545
      <literal>host</literal>, <literal>IPv4Only</literal>,
      <literal>IPv6Only</literal>, <literal>type</literal>,
546 547 548 549
      <literal>secret</literal>, <literal>tls</literal>,
      <literal>certificateNameCheck</literal>,
      <literal>matchCertificateAttribute</literal>,
      <literal>duplicateInterval</literal>, <literal>AddTTL</literal>,
550
      <literal>tcpKeepalive</literal>
551 552
      <literal>fticksVISCOUNTRY</literal>,
      <literal>fticksVISINST</literal>, <literal>rewrite</literal>,
553 554 555
      <literal>rewriteIn</literal>, <literal>rewriteOut</literal>, and
      <literal>rewriteAttribute</literal>.

556 557 558 559 560 561 562 563 564
      We already discussed the <literal>host</literal> option.  To
      specify how radsecproxy should resolve a <literal>host</literal>
      given as a DNS name, the <literal>IPv4Only</literal> or the
      <literal>IPv6Only</literal> can be set to <literal>on</literal>.
      At most one of these options can be enabled.  Enabling
      <literal>IPv4Only</literal> or <literal>IPv6Only</literal> here
      overrides any basic settings set at the top level.

      The value of <literal>type</literal> must be one of
565 566 567 568 569
      <literal>udp</literal>, <literal>tcp</literal>,
      <literal>tls</literal> or <literal>dtls</literal>. The value of
      <literal>secret</literal> is the shared RADIUS key used with
      this client. If the secret contains whitespace, the value must
      be quoted. This option is optional for TLS/DTLS and if omitted
570 571 572 573
      will default to "radsec". (Note that using a secret other than
      "radsec" for TLS is a violation of the standard (RFC 6614) and
      that the proposed standard for DTLS stipulates that the secret
      must be "radius/dtls".)
574 575 576 577 578 579 580 581 582 583 584
    </para>
    <para>
      For a TLS/DTLS client you may also specify the
      <literal>tls</literal> option.  The option value must be the
      name of a previously defined TLS block. If this option is not
      specified, the TLS block with the name
      <literal>defaultClient</literal> will be used if defined. If not
      defined, it will try to use the TLS block named
      <literal>default</literal>. If the specified TLS block name does
      not exist, or the option is not specified and none of the
      defaults exist, the proxy will exit with an error.
585 586 587 588 589 590 591 592 593

      NOTE: All versions of radsecproxy up to and including 1.6
      erroneously verify client certificate chains using the CA in the
      very first matching client block regardless of which block is
      used for the final decision. This was changed in version 1.6.1
      so that a client block with a different <literal>tls</literal>
      option than the first matching client block is no longer
      considered for verification of clients.

594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
    </para>
    <para>
      For a TLS/DTLS client, the option
      <literal>certificateNameCheck</literal> can be set to
      <literal>off</literal>, to disable the default behaviour of
      matching CN or SubjectAltName against the specified hostname or
      IP address.
    </para>
    <para>
      Additional validation of certificate attributes can be done by
      use of the <literal>matchCertificateAttribute</literal>
      option. Currently one can only do some matching of CN and
      SubjectAltName. For regexp matching on CN, one can use the value
      <literal>CN:/regexp/</literal>. For SubjectAltName one can only
      do regexp matching of the URI, this is specified as
      <literal>SubjectAltName:URI:/regexp/</literal>. Note that
      currently this option can only be specified once in a client
      block.
    </para>
    <para>
      The <literal>duplicateInterval</literal> option can be used to
      specify for how many seconds duplicate checking should be
      done. If a proxy receives a new request within a few seconds of
      a previous one, it may be treated the same if from the same
      client, with the same authenticator etc. The proxy will then
      ignore the new request (if it is still processing the previous
      one), or returned a copy of the previous reply.
    </para>
    <para>
      The <literal>AddTTL</literal> option is similar to the
      <literal>AddTTL</literal> option used in the basic config. See
      that for details. Any value configured here overrides the basic
      one when sending messages to this client.
    </para>
628 629 630 631 632
    <para>
      The <literal>tcpKeepalive</literal> option enables TCP keepalives. If
      keepalives are not answered within 30s the connection is considered
      lost.
    </para>
633 634 635 636 637
    <para>
      The <literal>fticksVISCOUNTRY</literal> option configures
      clients eligible to F-Ticks logging as defined by the
      <literal>FTicksReporting</literal> basic option.
    </para>
638 639 640 641 642
    <para>
      The <literal>fticksVISINST</literal> option overwrites
      the default <literal>VISINST</literal> value taken from the client
      block name.
    </para>
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673
    <para>
      The <literal>rewrite</literal> option is deprecated. Use
      <literal>rewriteIn</literal> instead.
    </para>
    <para>
      The <literal>rewriteIn</literal> option can be used to refer to
      a rewrite block that specifies certain rewrite operations that
      should be performed on incoming messages from the client. The
      rewriting is done before other processing.  For details, see the
      rewrite block text below. Similarly to <literal>tls</literal>
      discussed above, if this option is not used, there is a fallback
      to using the <literal>rewrite</literal> block named
      <literal>defaultClient</literal> if it exists; and if not, a
      fallback to a block named <literal>default</literal>.
    </para>
    <para>
      The <literal>rewriteOut</literal> option is used in the same way
      as <literal>rewriteIn</literal>, except that it specifies
      rewrite operations that should be performed on outgoing messages
      to the client. The rewriting is done after other
      processing. Also, there is no rewrite fallback if this option is
      not used.
    </para>
    <para>
      The <literal>rewriteAttribute</literal> option currently makes
      it possible to specify that the User-Name attribute in a client
      request shall be rewritten in the request sent by the proxy. The
      User-Name attribute is written back to the original value if a
      matching response is later sent back to the client. The value
      must be on the form User-Name:/regexpmatch/replacement/. Example
      usage:
674 675
      <blockquote>
        <para>
676
	  rewriteAttribute User-Name:/^(.*)@local$/\1@example.com/
677 678 679 680 681 682 683
        </para>
      </blockquote>
    </para>
  </refsect1>
  <refsect1>
    <title>Server Block</title>
    <para>
684 685 686 687 688 689 690 691 692 693 694 695
      The server block is used to configure a server. That is, tell
      the proxy about a server, and what parameters should be used
      when communicating with that server.  The name of the server
      block must (with one exception, see below) be either the IP
      address (IPv4 or IPv6) of the server, or a domain name
      (FQDN). If a domain name is specified, then this will be
      resolved immediately to all the addresses associated with the
      name, and the proxy will not care about any possible DNS changes
      that might occur later. Hence there is no dependency on DNS
      after startup. If the domain name resolves to multiple
      addresses, then for UDP/DTLS the first address is used. For
      TCP/TLS, the proxy will loop through the addresses until it can
696 697 698 699 700
      connect to one of them. The way an FQDN is resolved into an IP
      address may be influenced by the use of the
      <literal>IPv4Only</literal> and <literal>IPv6Only</literal>
      options. In the case of TLS/DTLS, the name of the server must
      match the FQDN or IP address in the server certificate.
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
    </para>
    <para>
      Alternatively one may use the <literal>host</literal> option
      inside a server block. In that case, the value of the
      <literal>host</literal> option is used as above, while the name
      of the block is only used as a descriptive name for the
      administrator. Note that multiple host options may be used. This
      will then be treated as multiple names/addresses for the same
      server. When initiating a TCP/TLS connection, all addresses of
      all names may be attempted, but there is no failover between the
      different host values. For failover one must use separate server
      blocks.
    </para>
    <para>
      Note that the name of the block, or values of host options may
      include a port number (separated with a column). This port
      number will then override the default port or a port option in
      the server block. Also note that literal IPv6 addresses must be
      enclosed in brackets.
    </para>
    <para>
      The allowed options in a server block are
      <literal>host</literal>, <literal>port</literal>,
724
      <literal>IPv4Only</literal>, <literal>IPv6Only</literal>,
725 726 727
      <literal>type</literal>, <literal>secret</literal>,
      <literal>tls</literal>, <literal>certificateNameCheck</literal>,
      <literal>matchCertificateAttribute</literal>,
728 729
      <literal>AddTTL</literal>, <literal>tcpKeepalive</literal>,
      <literal>rewrite</literal>,
730 731 732
      <literal>rewriteIn</literal>, <literal>rewriteOut</literal>,
      <literal>statusServer</literal>, <literal>retryCount</literal>,
      <literal>dynamicLookupCommand</literal> and
733
      <literal>retryInterval</literal> and
734 735 736
      <literal>LoopPrevention</literal>.
    </para>
    <para>
737 738 739 740 741 742 743 744 745 746 747 748 749

      We already discussed the <literal>host</literal> option.  To
      specify how radsecproxy should resolve a <literal>host</literal>
      given as a DNS name, the <literal>IPv4Only</literal> or the
      <literal>IPv6Only</literal> can be set to <literal>on</literal>.
      At most one of these options can be enabled.  Enabling
      <literal>IPv4Only</literal> or <literal>IPv6Only</literal> here
      overrides any basic settings set at the top level.

      The <literal>port</literal> option allows you to specify which
      port number the server uses. The usage of
      <literal>type</literal>, <literal>secret</literal>,
      <literal>tls</literal>, <literal>certificateNameCheck</literal>,
750
      <literal>matchCertificateAttribute</literal>,
751 752
      <literal>AddTTL</literal>, <literal>tcpKeepalive</literal>,
      <literal>rewrite</literal>,
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778
      <literal>rewriteIn</literal> and <literal>rewriteOut</literal>
      are just as specified for the <literal>client block</literal>
      above, except that <literal>defaultServer</literal> (and not
      <literal>defaultClient</literal>) is the fallback for the
      <literal>tls</literal>, <literal>rewrite</literal> and
      <literal>rewriteIn</literal> options.
    </para>
    <para>
      <literal>statusServer</literal> can be specified to enable the
      use of status-server messages for this server. The value must be
      either <literal>on</literal> or <literal>off</literal>. The
      default when not specified, is <literal>off</literal>. If
      statusserver is enabled, the proxy will during idle periods send
      regular status-server messages to the server to verify that it
      is alive. This should only be enabled if the server supports it.
    </para>
    <para>
      The options <literal>retryCount</literal> and
      <literal>retryInterval</literal> can be used to specify how many
      times the proxy should retry sending a request and how long it
      should wait between each retry. The defaults are 2 retries and
      an interval of 5s.
    </para>
    <para>
      The option <literal>dynamicLookupCommand</literal> can be used
      to specify a command that should be executed to dynamically
779 780 781 782 783 784 785 786 787 788 789
      configure a server.  The executable file should be given with
      full path and will be invoked with the name of the realm as its
      first and only argument.  It should either print a valid
      <literal>server</literal> option on stdout and exit with a code
      of 0 or print nothing and exit with a non-zero exit code.  An
      example of a shell script resolving the DNS NAPTR records for
      the realm and then the SRV records for each NAPTR matching
      'x-eduroam:radius.tls' is provided in
      <literal>tools/naptr-eduroam.sh</literal>.  This option was
      added in radsecproxy-1.3 but tends to crash radsecproxy versions
      earlier than 1.6.
790 791 792 793 794
    </para>
    <para>
      Using the <literal>LoopPrevention</literal> option here
      overrides any basic setting of this option.  See section
      <literal>BASIC OPTIONS</literal> for details on this option.
795 796 797 798 799
    </para>
  </refsect1>
  <refsect1>
    <title>Realm Block</title>
    <para>
800 801 802 803 804 805 806 807 808 809 810 811 812
      When the proxy receives an Access-Request it needs to figure out
      to which server it should be forwarded. This is done by looking
      at the Username attribute in the request, and matching that
      against the names of the defined realm blocks.  The proxy will
      match against the blocks in the order they are specified, using
      the first match if any. If no realm matches, the proxy will
      simply ignore the request. Each realm block specifies what the
      server should do when a match is found. A realm block may
      contain none, one or multiple <literal>server</literal> options,
      and similarly <literal>accountingServer</literal> options. There
      are also <literal>replyMessage</literal> and
      <literal>accountingResponse</literal> options. We will discuss
      these later.
813 814 815 816
    </para>
    <refsect2>
      <title>Realm block names and matching</title>
      <para>
817 818 819 820 821 822 823 824 825
	In the general case the proxy will look for a
	<literal>@</literal> in the username attribute, and try to do
	an exact case insensitive match between what comes after the
	<literal>@</literal> and the name of the realm block. So if
	you get a request with the attribute value
	<literal>anonymous@example.com</literal>, the proxy will go
	through the realm names in the order they are specified,
	looking for a realm block named
	<literal>example.com</literal>.
826 827
      </para>
      <para>
828 829 830 831 832 833
	There are two exceptions to this, one is the realm name
	<literal>*</literal> which means match everything. Hence if
	you have a realm block named <literal>*</literal>, then it
	will always match. This should then be the last realm block
	defined, since any blocks after this would never be
	checked. This is useful for having a default.
834 835
      </para>
      <para>
836 837 838 839 840 841 842 843
	The other exception is regular expression matching. If the
	realm name starts with a <literal>/</literal>, the name is
	treated as an regular expression. A case insensitive regexp
	match will then be done using this regexp on the value of the
	entire Username attribute. Optionally you may also have a
	trailing <literal>/</literal> after the regexp. So as an
	example, if you want to use regexp matching the domain
	<literal>example.com</literal> you could have a realm block
844 845
	named <literal>/@example\.com$</literal>. Optionally this can
	also be written <literal>/@example\.com$/</literal>. If you
846
	want to match all domains under the <literal>.com</literal>
847
	top domain, you could do <literal>/@.*\.com$</literal>. Note
848 849
	that since the matching is done on the entire attribute value,
	you can also use rules like
850
	<literal>/^[a-k].*@example\.com$/</literal> to get some of
851 852 853 854
	the users in this domain to use one server, while other users
	could be matched by another realm block and use another
	server.
      </para>
855 856 857 858
    </refsect2>
    <refsect2>
      <title>Realm block options</title>
      <para>
859 860 861 862 863 864 865 866 867 868 869 870
	A realm block may contain none, one or multiple
	<literal>server</literal> options. If defined, the values of
	the <literal>server</literal> options must be the names of
	previously defined server blocks. Normally requests will be
	forwarded to the first server option defined. If there are
	multiple server options, the proxy will do fail-over and use
	the second server if the first is down. If the two first are
	down, it will try the third etc. If say the first server comes
	back up, it will go back to using that one. Currently
	detection of servers being up or down is based on the use of
	StatusServer (if enabled), and that TCP/TLS/DTLS connections
	are up.
871 872
      </para>
      <para>
873 874 875 876 877 878 879 880
	A realm block may also contain none, one or multiple
	<literal>accountingServer</literal> options. This is used
	exactly like the <literal>server</literal> option, except that
	it is used for specifying where to send matching accounting
	requests. The values must be the names of previously defined
	server blocks. When multiple accounting servers are defined,
	there is a failover mechanism similar to the one for the
	<literal>server</literal> option.
881 882
      </para>
      <para>
883 884 885 886 887 888 889 890 891 892 893 894 895 896
	If there is no <literal>server</literal> option, the proxy
	will if <literal>replyMessage</literal> is specified, reply
	back to the client with an Access Reject message. The message
	contains a replyMessage attribute with the value as specified
	by the <literal>replyMessage</literal> option. Note that this
	is different from having no match since then the request is
	simply ignored. You may wonder why this is useful. One example
	is if you handle say all domains under say
	<literal>.bv</literal>. Then you may have several realm blocks
	matching the domains that exists, while for other domains
	under <literal>.bv</literal> you want to send a reject. At the
	same time you might want to send all other requests to some
	default server. After the realms for the subdomains, you would
	then have two realm definitions. One with the name
897
	<literal>/@.*\.bv$</literal> with no servers, followed by one
898 899 900
	with the name <literal>*</literal> with the default server
	defined. This may also be useful for blocking particular
	usernames.
901 902
      </para>
      <para>
903 904 905 906 907 908 909 910 911 912
	If there is no <literal>accountingServer</literal> option, the
	proxy will normally do nothing, ignoring accounting
	requests. There is however an option called
	<literal>accountingResponse</literal>. If this is set to
	<literal>on</literal>, the proxy will log some of the
	accounting information and send an Accounting-Response
	back. This is useful if you do not care much about accounting,
	but want to stop clients from retransmitting accounting
	requests. By default this option is set to
	<literal>off</literal>.
913 914 915 916 917 918
      </para>
    </refsect2>
  </refsect1>
  <refsect1>
    <title>TLS Block</title>
    <para>
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
      The TLS block specifies TLS configuration options and you need
      at least one of these if you have clients or servers using
      TLS/DTLS. As discussed in the client and server block
      descriptions, a client or server block may reference a
      particular TLS block by name. There are also however the special
      TLS block names <literal>default</literal>,
      <literal>defaultClient</literal> and
      <literal>defaultServer</literal> which are used as defaults if
      the client or server block does not reference a TLS block. Also
      note that a TLS block must be defined before the client or
      server block that would use it. If you want the same TLS
      configuration for all TLS/DTLS clients and servers, you need
      just a single tls block named <literal>default</literal>, and
      the client and servers need not refer to it. If you want all
      TLS/DTLS clients to use one config, and all TLS/DTLS servers to
      use another, then you would be fine only defining two TLS blocks
      named <literal>defaultClient</literal> and
      <literal>defaultServer</literal>. If you want different clients
      (or different servers) to have different TLS parameters, then
      you may need to create other TLS blocks with other names, and
      reference those from the client or server definitions. Note that
      you could also have say a client block refer to a default, even
      <literal>defaultServer</literal> if you really want to.
    </para>
    <para>
      The available TLS block options are
      <literal>CACertificateFile</literal>,
      <literal>CACertificatePath</literal>,
      <literal>certificateFile</literal>,
      <literal>certificateKeyFile</literal>,
      <literal>certificateKeyPassword</literal>,
      <literal>cacheExpiry</literal>, <literal>CRLCheck</literal> and
      <literal>policyOID</literal>.  When doing RADIUS over TLS/DTLS,
      both the client and the server present certificates, and they
      are both verified by the peer. Hence you must always specify
      <literal>certificateFile</literal> and
      <literal>certificateKeyFile</literal> options, as well as
      <literal>certificateKeyPassword</literal> if a password is
      needed to decrypt the private key. Note that
      <literal>CACertificateFile</literal> may be a certificate
      chain. In order to verify certificates, or send a chain of
      certificates to a peer, you also always need to specify
      <literal>CACertificateFile</literal> or
      <literal>CACertificatePath</literal>.  Note that you may specify
      both, in which case the certificates in
      <literal>CACertificateFile</literal> are checked first. By
      default CRLs are not checked. This can be changed by setting
      <literal>CRLCheck</literal> to <literal>on</literal>. One can
      require peer certificates to adhere to certain policies by
      specifying one or multiple policyOIDs using one or multiple
      <literal>policyOID</literal> options.
    </para>
    <para>
      CA certificates and CRLs are normally cached permanently. That
      is, once a CA or CRL has been read, the proxy will never attempt
      to re-read it. CRLs may change relatively often and the proxy
      should ideally always use the latest CRLs. Rather than
      restarting the proxy, there is an option
      <literal>cacheExpiry</literal> that specifies how many seconds
      the CA and CRL information should be cached. Reasonable values
      might be say 3600 (1 hour) or 86400 (24 hours), depending on how
      frequently CRLs are updated and how critical it is to be up to
      date. This option may be set to zero to disable caching.
982 983 984 985 986
    </para>
  </refsect1>
  <refsect1>
    <title>Rewrite Block</title>
    <para>
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
      The rewrite block specifies rules that may rewrite RADIUS
      messages. It can be used to add, remove and modify specific
      attributes from messages received from and sent to clients and
      servers. As discussed in the client and server block
      descriptions, a client or server block may reference a
      particular rewrite block by name. There are however also the
      special rewrite block names <literal>default</literal>,
      <literal>defaultClient</literal> and
      <literal>defaultServer</literal> which are used as defaults if
      the client or server block does not reference a block. Also note
      that a rewrite block must be defined before the client or server
      block that would use it. If you want the same rewrite rules for
      input from all clients and servers, you need just a single
      rewrite block named <literal>default</literal>, and the client
      and servers need not refer to it. If you want all clients to use
      one config, and all servers to use another, then you would be
      fine only defining two rewrite blocks named
      <literal>defaultClient</literal> and
      <literal>defaultServer</literal>. Note that these defaults are
      only used for rewrite on input. No rewriting is done on output
1007
      unless explicitly specified using the
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
      <literal>rewriteOut</literal> option.
    </para>
    <para>
      The available rewrite block options are
      <literal>addAttribute</literal>,
      <literal>addVendorAttribute</literal>,
      <literal>removeAttribute</literal>,
      <literal>removeVendorAttribute</literal> and
      <literal>modifyAttribute</literal>. They can all be specified
      none, one or multiple times.
    </para>
    <para>
      <literal>addAttribute</literal> is used to add attributes to a
      message. The option value must be on the form
      <literal>attribute:value</literal> where attribute is a
      numerical value specifying the attribute.  Simliarly, the
      <literal>addVendorAttribute</literal> is used to specify a
      vendor attribute to be added.  The option value must be on the
      form <literal>vendor:subattribute:value</literal>, where vendor
      and subattribute are numerical values.
    </para>
    <para>
      The <literal>removeAttribute</literal> option is used to specify
      an attribute that should be removed from received messages. The
      option value must be a numerical value specifying which
      attribute is to be removed.  Similarly,
      <literal>removeVendorAttribute</literal> is used to specify a
      vendor attribute that is to be removed. The value can be a
      numerical value for removing all attributes from a given vendor,
      or on the form <literal>vendor:subattribute</literal>, where
      vendor and subattribute are numerical values, for removing a
      specific subattribute for a specific vendor.
    </para>
    <para>
      <literal>modifyAttribute</literal> is used to specify
      modification of attributes. The value must be on the form
      <literal>attribute:/regexpmatch/replacement/</literal> where
      attribute is a numerical attribute type, regexpmatch is regexp
      matching rule and replacement specifies how to replace the
      matching regexp. Example usage:
1048 1049
      <blockquote>
        <para>
1050
	  modifyAttribute 1:/^(.*)@local$/\1@example.com/
1051 1052 1053 1054 1055 1056 1057 1058
        </para>
      </blockquote>
    </para>
  </refsect1>
  <refsect1>
    <title>See Also</title>
    <para>
      <citerefentry>
1059 1060
        <refentrytitle>radsecproxy</refentrytitle><manvolnum>1</manvolnum>
	</citerefentry>,
1061 1062
	<ulink url="https://tools.ietf.org/html/rfc6614">
	  <citetitle>Transport Layer Security (TLS) Encryption for RADIUS</citetitle>
1063
	</ulink>
1064 1065 1066
    </para>
  </refsect1>
</refentry>