Newline at EOF
[freeradius.git] / raddb / proxy.conf
1 # -*- text -*-
2 ##
3 ## proxy.conf -- proxy radius and realm configuration directives
4 ##
5 ##      $Id$
6
7 #######################################################################
8 #
9 #  Proxy server configuration
10 #
11 #  This entry controls the servers behaviour towards ALL other servers
12 #  to which it sends proxy requests.
13 #
14 proxy server {
15         #
16         #  Note that as of 2.0, the "synchronous", "retry_delay",
17         #  "retry_count", and "dead_time" have all been deprecated.
18         #  For backwards compatibility, they are are still accepted
19         #  by the server, but they ONLY apply to the old-style realm
20         #  configuration.  i.e. realms with "authhost" and/or "accthost"
21         #  entries.
22         #
23         #  i.e. "retry_delay" and "retry_count" have been replaced
24         #  with per-home-server configuration.  See the "home_server"
25         #  example below for details.
26         #
27         #  i.e. "dead_time" has been replaced with a per-home-server
28         #  "revive_interval".  We strongly recommend that this not
29         #  be used, however.  The new method is much better.
30
31         #
32         #  In 2.0, the server is always "synchronous", and setting
33         #  "synchronous = no" is impossible.  This simplifies the
34         #  server and increases the stability of the network.
35         #
36         #  If you need to set "synchronous = no", please send a
37         #  message to the list <freeradius-users@lists.freeradius.org>
38         #  explaining why this feature is vital for your network.
39
40         #
41         #  If a realm exists, but there are no live home servers for
42         #  it, we can fall back to using the "DEFAULT" realm.  This is
43         #  most useful for accounting, where the server can proxy
44         #  accounting requests to home servers, but if they're down,
45         #  use a DEFAULT realm that is LOCAL (i.e. accthost = LOCAL),
46         #  and then store the packets in the "detail" file.  That data
47         #  can be later proxied to the home servers by radrelay, when
48         #  those home servers come back up again.       
49
50         #  Setting this to "yes" may have issues for authentication.
51         #  i.e. If you are proxying for two different ISP's, and then
52         #  act as a general dial-up for Gric.  If one of the first two
53         #  ISP's has their RADIUS server go down, you do NOT want to
54         #  proxy those requests to GRIC.  Instead, you probably want
55         #  to just drop the requests on the floor.  In that case, set
56         #  this value to 'no'.
57         #
58         #  allowed values: {yes, no}
59         #
60         default_fallback = no
61
62 }
63
64 #######################################################################
65 #
66 #  Configuration for the proxy realms.
67 #
68 #  As of 2.0. the old-style "realms" file is deprecated, and is not
69 #  used by FreeRADIUS.
70 #
71 #  As of 2.0, the "realm" configuration has changed.  Instead of
72 #  specifying "authhost" and "accthost" in a realm section, the home
73 #  servers are specified seperately in a "home_server" section.  For
74 #  backwards compatibility, you can still use the "authhost" and
75 #  "accthost" directives.  If you only have one home server for a
76 #  realm, it is easier to use the old-style configuration.
77 #
78 #  However, if you have multiple servers for a realm, we STRONGLY
79 #  suggest moving to the new-style configuration.
80 #
81 #
82 #  Load-balancing and failover between home servers is handled via
83 #  a "home_server_pool" section.
84 #
85 #  Finally, The "realm" section defines the realm, some options, and
86 #  indicates which server pool should be used for the realm.
87 #
88 #  This change means that simple configurations now require multiple
89 #  ssections to define a realm.  However, complex configurations
90 #  are much simpler than before, as multiple realms can share the same
91 #  server pool.
92 #
93 #  That is, realms point to server pools, and server pools point to
94 #  home servers.  Multiple realms can point to one server pool.  One
95 #  server pool can point to multiple home servers.  Each home server
96 #  can appear in one or more pools.
97 #
98
99 ######################################################################
100 #
101 #  This section defines a "Home Server" which is another RADIUS
102 #  server that gets sent proxied requests.  In earlier versions
103 #  of FreeRADIUS, home servers were defined in "realm" sections,
104 #  which was awkward.  In 2.0, they have been made independent
105 #  from realms, which is better for a number of reasons.
106 #
107 home_server localhost {
108         #
109         #  Home servers can be sent Access-Request packets
110         #  or Accounting-Request packets.
111         #
112         #  Allowed values are:
113         #       auth      - Handles Access-Request packets
114         #       acct      - Handles Accounting-Request packets
115         #       auth+acct - Handles Access-Request packets at "port",
116         #                   and Accounting-Request packets at "port + 1"
117         type = auth
118
119         #
120         #  Configure ONE OF the following entries:
121         #
122         #       IPv4 address
123         #
124         ipaddr = 127.0.0.1
125
126         #       OR IPv6 address
127         # ipv6addr = ::1
128
129         #       OR virtual server       
130         # virtual_server = foo
131
132         #       Note that while both ipaddr and ipv6addr will accept
133         #       both addresses and host names, we do NOT recommend
134         #       using host names.  When you specify a host name, the
135         #       server has to do a DNS lookup to find the IP address
136         #       of the home server.  If the DNS server is slow or
137         #       unresponsive, it means that FreeRADIUS will NOT be
138         #       able to determine the address, and will therefore NOT
139         #       start.
140         #
141         #       Also, the mapping of host name to address is done ONCE
142         #       when the server starts.  If DNS is later updated to
143         #       change the address, FreeRADIUS will NOT discover that
144         #       until after a re-start, or a HUP.
145         #
146         #       If you specify a virtual_server here, then requests
147         #       will be proxied internally to that virtual server.
148         #       These requests CANNOT be proxied again, however.  The
149         #       intent is to have the local server handle packets
150         #       when all home servers are dead.
151         #
152         #       Requests proxied to a virtual server will be passed
153         #       through the pre-proxy and post-proxy sections, just
154         #       like any other request.  See also the sample "realm"
155         #       configuration, below.
156         #
157         #       None of the rest of the home_server configuration is used
158         #       for the "virtual_server" configuration.
159
160         #
161         #  The port to which packets are sent.
162         #
163         #  Usually 1812 for type "auth", and  1813 for type "acct".
164         #  Older servers may use 1645 and 1646.
165         #
166         port = 1812
167
168         #
169         #  The shared secret use to "encrypt" and "sign" packets between
170         #  FreeRADIUS and the home server.
171         #
172         #  The secret can be any string, up to 8k characters in length.
173         #
174         #  Control codes can be entered vi octal encoding,
175         #       e.g. "\101\102" == "AB"
176         #  Quotation marks can be entered by escaping them,
177         #       e.g. "foo\"bar"
178         #  Spaces or other "special" characters can be entered
179         #  by putting quotes around the string.
180         #       e.g. "foo bar"
181         #            "foo;bar"
182         #
183         secret = testing123
184
185         ############################################################
186         #
187         #  The rest of the configuration items listed here are optional,
188         #  and do not have to appear in every home server definition.
189         #
190         ############################################################
191
192         #
193         #  If the home server doesn't respond to the request within
194         #  this time, this server will consider the request dead, and
195         #  respond to the NAS with an Access-Reject.
196         #
197         #  Useful range of values: 5 to 60
198         response_window = 20
199
200         #
201         #  If the home server does not respond to ANY packets for
202         #  a certain time, consider it dead.  This time period is
203         #  called the "zombie" period, because the server is neither
204         #  alive nor dead.
205         #
206         #  Useful range of values: 20 to 120
207         zombie_period = 40
208
209         ############################################################
210         #
211         #  As of 2.0, FreeRADIUS supports RADIUS layer "status
212         #  checks".  These are used by a proxy server to see if a home
213         #  server is alive.
214         #
215         #  These status packets are sent ONLY if the proxying server
216         #  believes that the home server is dead.  They are NOT sent
217         #  if the proxying server believes that the home server is
218         #  alive.  They are NOT sent if the proxying server is not
219         #  proxying packets.
220         #
221         #  If the home server responds to the status check packet,
222         #  then it is marked alive again, and is returned to use.
223         #
224         ############################################################
225
226         #
227         #  Some home servers do not support status checks via the
228         #  Status-Server packet.  Others may not have a "test" user
229         #  configured that can be used to query the server, to see if
230         #  it is alive.  For those servers, we have NO WAY of knowing
231         #  when it becomes alive again.  Therefore, after the server
232         #  has been marked dead, we wait a period of time, and mark
233         #  it alive again, in the hope that it has come back to
234         #  life.
235         #
236         #  If it has NOT come back to life, then FreeRADIUS will wait
237         #  for "zombie_period" before marking it dead again.  During
238         #  the "zombie_period", ALL AUTHENTICATIONS WILL FAIL, because
239         #  the home server is still dead.  There is NOTHING that can
240         #  be done about this, other than to enable the status checks,
241         #  as documented below.
242         #
243         #  e.g. if "zombie_period" is 40 seconds, and "revive_interval"
244         #  is 300 seconds, the for 40 seconds out of every 340, or about
245         #  10% of the time, all authentications will fail.
246         #
247         #  If the "zombie_period" and "revive_interval" configurations
248         #  are set smaller, than it is possible for up to 50% of
249         #  authentications to fail.
250         #
251         #  As a result, we recommend enabling status checks, and
252         #  we do NOT recommend using "revive_interval".
253         #
254         #  If the "status_check" entry below is not "none", then the
255         #  "revive_interval" entry can be deleted, as it will not be
256         #  used.
257         #
258         #  Useful range of values: 60 to 3600
259         revive_interval = 120
260
261         #
262         #  The proxying server (i.e. this one) can do periodic status
263         #  checks to see if a dead home server has come back alive.
264         #
265         #  If set to "none", then the other configuration items listed
266         #  below are not used, and the "revive_interval" time is used
267         #  instead.
268         #
269         #  If set to "status-server", the Status-Server packets are
270         #  sent.  Many RADIUS servers support Status-Server.  If a
271         #  server does not support it, please contact the server
272         #  vendor and request that they add it.
273         #
274         #  If set to "request", then Access-Request, or Accounting-Request
275         #  packets are sent, depending on the "type" entry above (auth/acct).
276         #  
277         #  Allowed values: none, status-server, request
278         status_check = status-server
279
280         #
281         #  If the home server does not support Status-Server packets,
282         #  then the server can still send Access-Request or
283         #  Accounting-Request packets, with a pre-defined user name.
284         #
285         #  This practice is NOT recommended, as it may potentially let
286         #  users gain network access by using these "test" accounts!
287         #
288         #  If it is used, we recommend that the home server ALWAYS
289         #  respond to these Access-Request status checks with
290         #  Access-Reject.  The status check just needs an answer, it
291         #  does not need an Access-Accept.
292         #
293         #  For Accounting-Request status checks, only the username
294         #  needs to be set.  The rest of the accounting attribute are
295         #  set to default values.  The home server that receives these
296         #  accounting packets SHOULD NOT treat them like normal user
297         #  accounting packets.  i.e It should probably NOT log them to
298         #  a database.
299         #
300         # username = "test_user_please_reject_me"
301         # password = "this is really secret"
302
303         #
304         #  Configure the interval between sending status check packets.
305         #
306         #  Setting it too low increases the probability of spurious
307         #  fail-over and fallback attempts.
308         #
309         #  Useful range of values: 6 to 120
310         check_interval = 30
311
312         #
313         #  Configure the number of status checks in a row that the
314         #  home server needs to respond to before it is marked alive.
315         #
316         #  If you want to mark a home server as alive after a short
317         #  time period of being responsive, it is best to use a small
318         #  "check_interval", and a large value for
319         #  "num_answers_to_alive".  Using a long "check_interval" and
320         #  a small number for "num_answers_to_alive" increases the
321         #  probability of spurious fail-over and fallback attempts.
322         #
323         #  Useful range of values: 3 to 10
324         num_answers_to_alive = 3
325 }
326
327 # Sample virtual home server.
328 home_server virtual.example.com {
329             virtual_server = virtual.example.com
330 }
331
332 ######################################################################
333 #
334 #  This section defines a pool of home servers that is used
335 #  for fail-over and load-balancing.  In earlier versions of
336 #  FreeRADIUS, fail-over and load-balancing were defined per-realm.
337 #  As a result, if a server had 5 home servers, each of which served
338 #  the same 10 realms, you would need 50 "realm" entries.
339 #
340 #  In version 2.0, you would need 5 "home_server" sections,
341 #  10 'realm" sections, and one "home_server_pool" section to tie the
342 #  two together.
343 #
344 home_server_pool my_auth_failover {
345         #
346         #  The type of this pool controls how home servers are chosen.
347         #
348         #  fail-over - the request is sent to the first live
349         #       home server in the list.  i.e. If the first home server
350         #       is marked "dead", the second one is chosen, etc.
351         #
352         #  load-balance - the least busy home server is chosen,
353         #       where "least busy" is counted by taking the number of
354         #       requests sent to that home server, and subtracting the
355         #       number of responses received from that home server.
356         #
357         #       If there are two or more servers with the same low
358         #       load, then one of those servers is chosen at random.
359         #       This configuration is most similar to the old
360         #       "round-robin" method, though it is not exactly the same.
361         #
362         #       Note that load balancing does not work well with EAP,
363         #       as EAP requires packets for an EAP conversation to be
364         #       sent to the same home server.  The load balancing method
365         #       does not keep state in between packets, meaning that
366         #       EAP packets for the same conversation may be sent to
367         #       different home servers.  This will prevent EAP from
368         #       working.
369         #
370         #       For non-EAP authentication methods, and for accounting
371         #       packets, we recommend using "load-balance".  It will
372         #       ensure the highest availability for your network.
373         #
374         #  client-balance - the home server is chosen by hashing the
375         #       source IP address of the packet.  If that home server
376         #       is down, the next one in the list is used, just as
377         #       with "fail-over".
378         #
379         #       There is no way of predicting which source IP will map
380         #       to which home server.
381         #
382         #       This configuration is most useful to do simple load
383         #       balancing for EAP sessions, as the EAP session will
384         #       always be sent to the same home server.
385         #
386         #  client-port-balance - the home server is chosen by hashing
387         #       the source IP address and source port of the packet.
388         #       If that home server is down, the next one in the list
389         #       is used, just as with "fail-over".
390         #
391         #       This method provides slightly better load balancing
392         #       for EAP sessions than "client-balance".  However, it
393         #       also means that authentication and accounting packets
394         #       for the same session MAY go to different home servers.
395         #
396         #  keyed-balance - the home server is chosen by hashing (FNV)
397         #       the contents of the Load-Balance-Key attribute from the
398         #       control items.  The  request is then sent to home server
399         #       chosen by taking:
400         #
401         #               server = (hash % num_servers_in_pool).
402         #
403         #       If there is no Load-Balance-Key in the control items,
404         #       the load balancing method is identical to "load-balance".
405         #
406         #
407         #  The default type is fail-over.
408         type = fail-over
409
410         #
411         #  A virtual_server may be specified here.  If so, the
412         #  "pre-proxy" and "post-proxy" sections are called when
413         #  the request is proxied, and when a response is received.
414         #
415         #  This lets you have one policy for all requests that are proxied
416         #  to a home server.  This policy is completely independent of
417         #  any policies used to receive, or process the request.
418         #
419         #virtual_server = pre_post_proxy_for_pool
420
421         #
422         #  Next, a list of one or more home servers.  The names
423         #  of the home servers are NOT the hostnames, but the names
424         #  of the sections.  (e.g. home_server foo {...} has name "foo".
425         #
426         #  Note that ALL home servers listed here have to be of the same
427         #  type.  i.e. they all have to be "auth", or they all have to
428         #  be "acct", or the all have to be "auth+acct".
429         #
430         home_server = localhost
431
432         #  Additional home servers can be listed.
433         #  There is NO LIMIT to the number of home servers that can
434         #  be listed, though using more than 10 or so will become
435         #  difficult to manage.
436         #
437         # home_server = foo.example.com
438         # home_server = bar.example.com
439         # home_server = baz.example.com
440         # home_server = ...
441
442
443         #
444         #  If ALL home servers are dead, then this "fallback" home server
445         #  is used.  If set, it takes precedence over any realm-based
446         #  fallback, such as the DEFAULT realm.
447         #
448         #  For reasons of stability, this home server SHOULD be a virtual
449         #  server.  Otherwise, the fallback may itself be dead!
450         #
451         #fallback = virtual.example.com
452 }
453
454 ######################################################################
455 #
456 #
457 #  This section defines a new-style "realm".  Note the in version 2.0,
458 #  there are many fewer configuration items than in 1.x for a realm.
459 #
460 #  Automatic proxying is done via the "realms" module (see "man
461 #  rlm_realm").  To manually proxy the request put this entry in the
462 #  "users" file:
463
464 #
465 #
466 #DEFAULT        Proxy-To-Realm := "realm_name"
467 #
468 #
469 realm example.com {
470         #
471         #  Realms point to pools of home servers.
472 #
473         #  For authentication, the "auth_pool" configuration item
474         #  should point to a "home_server_pool" that was previously
475         #  defined.  All of the home servers in the "auth_pool" must
476         #  be of type "auth".
477         #
478         #  For accounting, the "acct_pool" configuration item
479         #  should point to a "home_server_pool" that was previously
480         #  defined.  All of the home servers in the "acct_pool" must
481         #  be of type "acct".
482         #
483         #  If you have a "home_server_pool" where all of the home servers
484         #  are of type "auth+acct", you can just use the "pool"
485         #  configuration item, instead of specifying both "auth_pool"
486         #  and "acct_pool".
487
488         auth_pool = my_auth_failover
489 #       acct_pool = acct
490
491         #
492         #  Normally, when an incoming User-Name is matched against the
493         #  realm, the realm name is "stripped" off, and the "stripped"
494         #  user name is used to perform matches.
495         #
496         #  e.g. User-Name = "bob@example.com" will result in two new
497         #  attributes being created by the "realms" module:
498         #
499         #       Stripped-User-Name = "bob"
500         #       Realm = "example.com"
501         #
502         #  The Stripped-User-Name is then used as a key in the "users"
503         #  file, for example.
504         #
505         #  If you do not want this to happen, uncomment "nostrip" below.
506         #
507         # nostrip
508
509         #  There are no more configuration entries for a realm.
510 }
511
512
513 #
514 #  This is a sample entry for iPass.
515 #  Note that you have to define "ipass_auth_pool" and
516 #  "ipass_acct_pool", along with home_servers for them, too.
517 #
518 #realm IPASS {
519 #       nostrip
520 #
521 #       auth_pool = ipass_auth_pool
522 #       acct_pool = ipass_acct_pool
523 #}
524
525 #
526 #  This realm is used mainly to cancel proxying.  You can have
527 #  the "realm suffix" module configured to proxy all requests for
528 #  a realm, and then later cancel the proxying, based on other
529 #  configuration.
530 #
531 #  For example, you want to terminate PEAP or EAP-TTLS locally,
532 #  you can add the following to the "users" file:
533 #
534 #  DEFAULT EAP-Type == PEAP, Proxy-To-Realm := LOCAL
535 #
536 realm LOCAL {
537         #  If we do not specify a server pool, the realm is LOCAL, and
538         #  requests are not proxied to it.
539 }
540
541 #
542 #  This realm is for requests which don't have an explicit realm
543 #  prefix or suffix.  User names like "bob" will match this one.
544 #
545 #realm NULL {
546 #       authhost        = radius.company.com:1600
547 #       accthost        = radius.company.com:1601
548 #       secret          = testing123
549 #}
550
551 #
552 #  This realm is for ALL OTHER requests.
553 #
554 #realm DEFAULT {
555 #       authhost        = radius.company.com:1600
556 #       accthost        = radius.company.com:1601
557 #       secret          = testing123
558 #}
559
560
561 #  This realm "proxies" requests internally to a virtual server.
562 #  The pre-proxy and post-proxy sections are run just as with any
563 #  other kind of home server.  The virtual server then receives
564 #  the request, and replies, just as with any other packet.
565 #
566 #  Once proxied internally like this, the request CANNOT be proxied
567 #  internally or externally.
568 #
569 #realm virtual.example.com {
570 #       virtual_server = virtual.example.com
571 #}
572 #
573
574 #
575 #  Regular expressions may also be used as realm names.  If these are used,
576 #  then the "find matching realm" process is as follows:
577 #
578 #    1) Look for a non-regex realm with an *exact* match for the name.
579 #       If found, it is used in preference to any regex matching realm.
580 #
581 #    2) Look for a regex realm, in the order that they are listed
582 #       in the configuration files.  Any regex match is performed in
583 #       a case-insensitive fashion.
584 #
585 #    3) If no realm is found, return the DEFAULT realm, if any.
586 #
587 #  The order of the realms matters in step (2).  For example, defining
588 #  two realms "*.example.com" and "*.test.example.com" will result in
589 #  the second realm NEVER matching.  This is because all of the realms
590 #  which match the second regex also match the first one.  Since the
591 #  first regex matches, it is returned.
592 #
593 #  The solution is to list the realms in the opposite order,. e.g.
594 #  "*.test.example.com", followed by "*.example.com".
595 #
596 #
597 #  Some helpful rules:
598 #
599 #   - always place a '~' character at the start of the realm name.
600 #     This signifies that it is a regex match, and not an exact match
601 #     for the realm.
602 #
603 #   - place the regex in double quotes.  This helps the configuration
604 #     file parser ignore any "special" characters in the regex.
605 #     Yes, this rule is different than the normal "unlang" rules for
606 #     regular expressions.  That may be fixed in a future release.
607 #
608 #   - use two back-slashes '\\' whenever you need one backslash in the
609 #     regex.  e.g. "~*\\.example\\.com", and not "~*\.example\.com".
610 #     This is because the regex is in a double-quoted string, and normal
611 #     rules apply for double-quoted strings.
612 #
613 #   - If you are matching domain names, use two backslashes in front of
614 #     every '.' (dot or period).  This is because '.' has special meaning
615 #     in a regular expression: match any character.  If you do not do this,
616 #     then "~*.example.com" will match "fooXexampleYcom", which is likely
617 #     not what you want
618 #
619 #   - If you are matching domain names, put a '$' at the end of the regex
620 #     that matches the domain name.  This tells the regex matching code
621 #     that the realm ENDS with the domain name, so it does not match
622 #     realms with the domain name in the middle.  e.g. "~*\\.example\\.com"
623 #     will match "test.example.comFOO", which is likely not what you want.
624 #     Using "~*\\.example\\.com$" is better.
625 #
626 #  The more regex realms that are defined, the more time it takes to
627 #  process them.  You should define as few regex realms as possible
628 #  in order to maximize server performance.
629 #
630 #realm "~*\\.example\\.com$" {
631 #      authhost = LOCAL      # not strictly necessary
632 #      accthost = LOCAL      # not strictly necessary
633 #}