4 The run-time variables defined by the server are:
6 %{Attribute-Name} The value of the given Attribute-Name
9 %{request:Attribute-Name} The value of value the given
10 Attribute-Name in the request packet
11 %{reply:Attribute-Name} The value of the given Attribute-Name
13 %{proxy-request:Attribute-Name} The value of the given Attribute-Name
14 in the proxy request packet (if it exists)
15 %{proxy-reply:Attribute-Name} The value of the given Attribute-Name
16 in the proxy reply packet (if it exists)
18 The above variable expansions also support the meta-Attribute
19 Packet-Type as well. See the RADIUS dictionary for details on its
22 %{check:Attribute-Name} Corresponding value for Attribute-Name
23 in check items for request
26 %{config:section.subsection.item} Corresponding value in 'radiusd.conf'
27 for the string value of that item.
29 The %{config:...} variables should be used VERY carefully, as they
30 may leak secret information from your RADIUS server, if you use them
31 in reply attributes to the NAS!
33 If your system supports regular expressions, then regular expression
34 matching defines other special variables, just like in Perl.
36 %{0} What the regular expression matched
37 %{1} The first group which matched
38 %{2} The second group which matched
40 %{8} The eight group which matched.
42 These variables are defined during a regular expression match =~,
43 and only when the expression matches. They are NOT defined for the
44 operator !~, or when =~ doesn't match. Any use of =~ destroys all
45 previous values of %{0}..%{8}, but the variables.
50 %{User-Name} The string value of the User-Name attribute.
51 %{proxy-reply:Framed-Protocol} The string value of the Framed-Protocol
52 attribute, from the proxy reply.
53 %{config:modules.unix.passwd} The string value of the 'passwd' configuration
54 item in the 'unix' module, in the 'modules'
55 section of radiusd.conf.
57 DEFAULT User-Name =~ "^([^@]+)@(.*)"
58 All-That-Matched = `%{0}`
59 Just-The-User-Name = `%{1}`
60 Just-The-Realm-Name = `%{2}`
63 The variables are used in dynamically translated strings. Most of
64 the configuration entries in radiusd.conf (and related files) will do
65 dynamic string translation. To do the same dynamic translation in a
66 RADIUS attribute (when pulling it from a database, or "users" file),
67 you must put the string into an back-quoted string:
69 Session-Timeout = `%{expr: 2 + 3}`
71 To do the dynamic translation in the 'radiusd.conf' (or some other
72 configuration files), just use the variable as-is. See 'radiusd.conf'
79 Additionally, you can use conditional syntax similar to ${foo:-bar} as
80 defined in 'sh'. For example:
83 When attribute Foo is set: returns value of Foo
84 When attribute Foo is unset: returns literal string 'bar'
87 When attribute Foo is set: returns value of attribute Foo
88 When attribute Foo is unset: returns value of attribute Bar (if any)
90 3. %{Foo:-%{Bar:-baz}}
91 When attribute Foo is set: returns value of attribute Foo
92 When attribute Foo is unset: returns value of attribute Bar (if any)
93 When attribute Bar is unset: returns literal string 'baz'
96 Attributes as environment variables in executed programs
97 --------------------------------------------------------
99 When calling an external program (e.g. from Exec-Program-Wait), these
100 variables can be passed on the command line to the program. In
101 addition, the server places all of the attributes in the RADIUS
102 request into environment variables for the external program. The
103 variables are renamed under the following rules:
105 1. All letters are made upper-case.
107 2. All hyphens '-' are turned into underscores '_'
109 so the attribute User-Name can be passed on the command line to the
110 program as %{User-Name}, or used inside the program as the environment
111 variable USER_NAME (or $USER_NAME for shell scripts).
113 If you want to see the list of all of the variables, try adding a
114 line 'printenv > /tmp/exec-program-wait' to the script. Then look in
115 the file for a complete list of variables.
118 One-character variables
119 -----------------------
121 The following one-character variables are also defined. However, they
122 are duplicates of the previous general cases, and are only provided
123 for backwards compatibility. They WILL BE removed in a future
124 release. They also do NOT permit the use of conditional syntax
125 (':-'), as described above.
128 Variable Description Proper Equivalent
129 -------- ----------- ----------------
130 %a Protocol (SLIP/PPP) %{Framed-Protocol}
131 %c Callback-Number %{Callback-Number}
133 %f Framed IP address %{Framed-IP-Address}
134 %i Calling Station ID %{Calling-Station-Id}
136 %m request month (MM)
137 %n NAS IP address %{NAS-IP-Address}
138 %p Port number %{NAS-Port}
139 %s Speed (PW_CONNECT_INFO) %{Connect-Info}
140 %t request in ctime format
141 %u User name %{User-Name}
142 %A radacct_dir %{config:radacctdir}
144 %D request date (YYYYMMDD)
146 %L radlog_dir %{config:logdir}
148 %R radius_dir %{config:raddbdir}
153 %U Stripped User name %{Stripped-User-Name}
154 %V Request-Authenticator
156 %Y request year (YYYY)
157 %Z All request attributes
159 (must have a big buffer)