Chetan Gaonker | 7f4bf74 | 2016-05-04 15:56:08 -0700 | [diff] [blame] | 1 | # -*- text -*- |
| 2 | ## |
| 3 | ## templates.conf -- configurations to be used in multiple places |
| 4 | ## |
| 5 | ## $Id: 7b8b44e051c974c1a0a6e27a0cff50e621835df2 $ |
| 6 | |
| 7 | ###################################################################### |
| 8 | # |
| 9 | # Version 2.0 has a useful new feature called "templates". |
| 10 | # |
| 11 | # Use templates by adding a line in radiusd.conf: |
| 12 | # |
| 13 | # $INCLUDE templates.conf |
| 14 | # |
| 15 | # The goal of the templates is to have common configuration located |
| 16 | # in this file, and to list only the *differences* in the individual |
| 17 | # sections. This feature is most useful for sections like "clients" |
| 18 | # or "home_servers", where many may be defined, and each one has |
| 19 | # similar repeated configuration. |
| 20 | # |
| 21 | # Something similar to templates can be done by putting common |
| 22 | # configuration into separate files, and using "$INCLUDE file...", |
| 23 | # but this is more flexible, and simpler to understand. It's also |
| 24 | # cheaper for the server, because "$INCLUDE" makes a copy of the |
| 25 | # configuration for inclusion, and templates are simply referenced. |
| 26 | # |
| 27 | # The templates are defined in the "templates" section, so that they |
| 28 | # do not affect the rest of the server configuration. |
| 29 | # |
| 30 | # A section can reference a template by using "$template name" |
| 31 | # |
| 32 | templates { |
| 33 | # |
| 34 | # The contents of the templates section are other |
| 35 | # configuration sections that would normally go into |
| 36 | # the configuration files. |
| 37 | # |
| 38 | |
| 39 | # |
| 40 | # This is a default template for the "home_server" section. |
| 41 | # Note that there is no name for the section. |
| 42 | # |
| 43 | # Any configuration item that is valid for a "home_server" |
| 44 | # section is also valid here. When a "home_server" section |
| 45 | # is defined in proxy.conf, this section is referenced as |
| 46 | # the template. |
| 47 | # |
| 48 | # Configuration items that are explicitly listed in a |
| 49 | # "home_server" section of proxy.conf are used in |
| 50 | # preference to the configuration items listed here. |
| 51 | # |
| 52 | # However, if a configuration item is NOT listed in a |
| 53 | # "home_server" section of proxy.conf, then the value here |
| 54 | # is used. |
| 55 | # |
| 56 | # This functionality lets you put common configuration into |
| 57 | # a template, and to put only the unique configuration |
| 58 | # items in "proxy.conf". Each section in proxy.conf can |
| 59 | # then contain a line "$template home_server", which will |
| 60 | # cause it to reference this template. |
| 61 | # |
| 62 | home_server { |
| 63 | response_window = 20 |
| 64 | zombie_period = 40 |
| 65 | revive_interval = 120 |
| 66 | # |
| 67 | # Etc. |
| 68 | } |
| 69 | |
| 70 | # |
| 71 | # You can also have named templates. For example, if you |
| 72 | # are proxying to 3 different home servers all at the same |
| 73 | # site, with identical configurations (other than IP |
| 74 | # addresses), you can use this named template. |
| 75 | # |
| 76 | |
| 77 | # Then, each "home_server" section in "proxy.conf" would |
| 78 | # only list the IP address of that home server, and a |
| 79 | # line saying |
| 80 | # |
| 81 | # $template example_com |
| 82 | # |
| 83 | # That would tell FreeRADIUS to look in the section below |
| 84 | # for the rest of the configuration items. |
| 85 | # |
| 86 | # For various reasons, you shouldn't have a "." in the template |
| 87 | # name. Doing so means that the server will be unable to find |
| 88 | # the template. |
| 89 | # |
| 90 | example_com { |
| 91 | type = auth |
| 92 | port = 1812 |
| 93 | secret = testing123 |
| 94 | response_window = 20 |
| 95 | # |
| 96 | # Etc... |
| 97 | } |
| 98 | |
| 99 | # |
| 100 | # You can have templates for other sections, too, but they |
| 101 | # seem to be most useful for home_servers. |
| 102 | # |
| 103 | # For now, you can use templates only for sections in |
| 104 | # radiusd.conf, not sub-sections. So you still have to use |
| 105 | # the "$INCLUDE file.." method for things like defining |
| 106 | # multiple "sql" modules, each with similar configuration. |
| 107 | # |
| 108 | } |