Added xlat function %{config:...}
[freeradius.git] / doc / variables.txt
1 The variables defined by the server are:
2
3      %{Attribute-Name}               Corresponding value for Attribute-Name
4                                      in request
5      %{request:Attribute-Name}       Corresponding value for Attribute-Name
6                                      in request
7      %{reply:Attribute-Name}         Corresponding value for Attribute-Name
8                                      in reply
9      %{proxy-reply:Attribute-Name}   Corresponding value for Attribute-Name
10                                      in the proxy reply (if it exists)
11
12      %{config:section.subsection.item} Corresponding value in 'radiusd.conf'
13                                        for the string value of that item.
14
15   The %{config:...} variables should be used VERY carefully, as they
16 may leak secret information from your RADIUS server, if you use them
17 in reply attributes to the NAS!
18
19   e.g.
20
21   %{User-Name}                   The string value of the User-Name attribute.
22   %{proxy-reply:Framed-Protocol} The string value of the Framed-Protocol
23                                  attribute, from the proxy reply.
24   %{config:modules.unix.passwd}  The string value of the 'passwd' configuration
25                                  item in the 'unix' module, in the 'modules'
26                                  section of radiusd.conf.
27
28 Additionally, you can use syntax similar to ${foo:-bar} as defined in
29 'sh'.  For example:
30
31   1.  %{Foo:-bar}
32     When attribute Foo is set:  returns value of Foo
33     When attribute Foo unset:   returns literal string 'bar'
34
35   2.  %{Foo:-%{Bar}}
36     When attribute Foo is set:  returns value of attribute Foo
37     When attribute Foo unset:   returns value of attribute Bar (if any)
38
39   3.  %{Foo:-%{bar:-baz}}
40     When attribute Foo is set:  returns value of attribute Foo
41     When attribute Foo unset:   returns value of attribute Bar (if any)
42     When attribute Bar unset:   returns literal string 'baz'
43
44
45 When calling an external program (e.g. from Exec-Program-Wait), these
46 variables can be passed on the command line to the program.  In
47 addition, the server places all of the attributes in the RADIUS
48 request into environment variables for the external program.  The
49 variables are renamed under the following rules:
50
51   1.  All letters are made upper-case.
52
53   2.  All hyphens '-' are turned into underscores '_'
54
55 so the attribute User-Name can be passed on the command line to the
56 program as %{User-Name}, or used inside the program as the environment
57 variable USER_NAME (or $USER_NAME for shell scripts).
58
59
60 The following one-character variables are also defined.  However, they
61 are duplicates of the previous general cases, and are only provided
62 for backwards compatibility.  They may be removed in a future
63 release.
64
65      %a       Protocol (SLIP/PPP)
66      %c       Callback-Number
67      %d       request day (DD)
68      %f       Framed IP address
69      %i       Calling Station ID
70      %l       request timestamp
71      %m       request month (MM)
72      %n       NAS IP address
73      %p       Port number
74      %s       Speed (PW_CONNECT_INFO)
75      %t       request in ctime format
76      %u       User name
77      %A       radacct_dir
78      %C       clientname
79      %D       request date (YYYYMMDD)
80      %L       radlog_dir
81      %M       MTU
82      %R       radius_dir
83      %S       request timestamp in SQL format
84      %T       request timestamp in database format
85      %U       Stripped User name
86      %V       Request-Authenticator (Verified/None)
87      %Y       request year (YYYY)
88      %Z       All request attributes except password (must have big buffer)