-.TH unlang 5 "12 Jun 2007" "" "FreeRADIUS Processing un-language"
+.\" # DS - begin display
+.de DS
+.RS
+.nf
+.sp
+..
+.\" # DE - end display
+.de DE
+.fi
+.RE
+.sp
+..
+.TH unlang 5 "19 May 2010" "" "FreeRADIUS Processing un-language"
.SH NAME
unlang \- FreeRADIUS Processing un\-language
.SH DESCRIPTION
The goal of the language is to allow simple policies to be written
with minimal effort. Those policies are then applied when a request
-is being processed.
+is being processed. Requests are processed through virtual servers
+(including the default one), in the sections titled "authorize",
+"authenticate", "post-auth", "preacct", "accounting", "pre-proxy",
+"post-proxy", and "session".
+
+These policies cannot be used in any other part of the configuration
+files, such as module or client configuration.
.SH KEYWORDS
The keywords for the language are a combination of pre-defined
keywords, and references to loadable module names. We document only
.br
Evaluate the given string, and choose the first matching "case"
statement inside of the current block. If the string is surrounded by
-double quotes, it is expanded as described below in the STRINGS AND
-VARIABLES section.
+double quotes, it is expanded as described in the DATA TYPES section,
+below.
No statement other than "case" can appear in a "switch" block.
.DE
The <list> can be one of "request", "reply", "proxy-request",
-"proxy-reply", or "control". The "control" list is the list of
-attributes maintainted internally by the server that controls how the
-server processes the request. Any attribute that does not go in a
-packet on the network will generally be placed in the "control" list.
+"proxy-reply", "coa", "disconnect", or "control". The "control" list
+is the list of attributes maintainted internally by the server that
+controls how the server processes the request. Any attribute that
+does not go in a packet on the network will generally be placed in the
+"control" list.
For backwards compatibility with older versions, "check" is accepted
as a synonym for "control". The use of "check" is deprecated, and
For EAP methods with tunneled authentication sessions (i.e. PEAP and
EAP-TTLS), the inner tunnel session can also reference
"outer.request", "outer.reply", and "outer.control". Those references
-will update the relevant list in the outer tunnel session.
+allow you to address the relevant list in the outer tunnel session.
+
+The "coa" and "disconnect" sections can only be used when the server
+receives an Access-Request or Accounting-Request. Use "request" and
+"reply" instead of "coa" when the server receives a CoA-Request or
+Disconnect-Request packet.
+
+Adding one or more attributes to either of the "coa" or "disconnect"
+list causes server to originate a CoA-Request or Disconnect-Request
+packet. That packet is sent when the current Access-Request or
+Accounting-Request has been finished, and a reply sent to the NAS.
+See raddb/sites-available/originate-coa for additional information.
The only contents permitted in an "update" section are attributes and
values. The contents of the "update" section are described in the
or update an attribute list.
.DS
- redundant load-balance {
+ redundant-load-balance {
.br
ldap1 # 50%, unless ldap2 is down, then 100%
.br
Evalutes to true if 'foo' is a non-empty string (single quotes, double
quotes, or back-quoted). Also evaluates to true if 'foo' is a
-non-zero number. Note that the language is not typed, so the string
-"0000" can be interpreted as a numerical zero. This issue can be
-avoided by comparings strings to an empty string, rather than by
+non-zero number. Note that the language is poorly typed, so the
+string "0000" can be interpreted as a numerical zero. This issue can
+be avoided by comparings strings to an empty string, rather than by
evaluating the string by itself.
-If the text is not quoted, then it is used as a test for one of the
-module return codes. The condition evaluates to true if the most
-recent module return code matches the name given here. Valid module
-return codes are given in MODULE RETURN CODES, below.
+If the word 'foo' is not a quoted string, then it can be taken as a
+reference to a named attribute. See "Referencing attribute lists",
+below, for examples of attribute references. The condition evaluates
+to true if the named attribute exists.
+
+Otherwise, if the word 'foo' is not a quoted string, and is not an
+attribute reference, then it is interpreted as a reference to a module
+return code. The condition evaluates to true if the most recent
+module return code matches the name given here. Valid module return
+codes are given in MODULE RETURN CODES, below.
.IP Negation
.DS
(!foo)
.PP
Conditions may be nested to any depth, subject only to line length
limitations (8192 bytes).
-.SH STRINGS AND NUMBERS
-Strings and numbers can appear as stand-alone conditions, in which
-case they are evaluated as described in "Simple conditions", above.
-They can also appear (with some exceptions noted below) on the
-left-hand or on the right-hand side of a comparison.
-.IP Numbers
+.SH DATA TYPES
+There are only a few data types supported in the language. Reference
+to attributes, numbers, and strings. Any data type can appear in
+stand-alone condition, in which case they are evaluated as described
+in "Simple conditions", above. They can also appear (with some
+exceptions noted below) on the left-hand or on the right-hand side of
+a comparison.
+.IP numbers
Numbers are composed of decimal digits. Floating point, hex, and
octal numbers are not supported. The maximum value for a number is
machine-dependent, but is usually 32-bits, including one bit for a
sign value.
.PP
-"strings"
+word
+.RS
+Text that is not enclosed in quotes is interpreted differently
+depending on where it occurs in a condition. On the left hand side of
+a condition, it is interpreted as a reference to an attribute. On the
+right hand side, it is interpreted as a simple string, in the same
+manner as a single-quoted string.
+
+Using attribute references permits limited type-specific comparisons,
+as seen in the examples below.
+
+.DS
+ if (User-Name == "bob") {
+.br
+ ...
+.br
+ if (Framed-IP-Address > 127.0.0.1) {
+.br
+ ...
+.br
+ if (Service-Type == Login-User) {
+.DE
+.RE
+.IP """strings"""
.RS
Double-quoted strings are expanded by inserting the value of any
variables (see VARIABLES, below) before being evaluated. If
the result is a number it is evaluated in a numerical context.
-String length is limited by line-length, usually about 8000 characters.
+String length is limited by line-length, usually about 8000
+characters. A double quote character can be used in a string via
+the normal back-slash escaping method. ("like \\"this\\" !")
.RE
.IP 'strings'
-Single-quoted strings are evaluated as-is.
+Single-quoted strings are evaluated as-is. Their values are not
+expanded as with double-quoted strings above, and they are not
+interpreted as attribute references.
.IP `strings`
Back-quoted strings are evaluated by expanding the contents of the
string, as described above for double-quoted strings. The resulting
%{<list>:Attribute-Name}
.DE
-Where <list> is one of "request", "reply", "proxy-request",
-"proxy-reply", "control", "outer.request", "outer.reply", or
-"outer.control", as described above in the documentation for the
-"update" section. The "<list>:" prefix is optional, and if omitted,
-is assumed to refer to the "request" list.
+Where <list> is one of "request", "reply", "control", "proxy-request",
+"proxy-reply", or "outer.request", "outer.reply", "outer.control",
+"outer.proxy-request", or "outer.proxy-reply". just as with the
+"update" section, above. The "<list>:" prefix is optional, and if
+omitted, is assumed to refer to the "request" list.
When a variable is encountered, the given list is examined for an
attribute of the given name. If found, the variable reference in the
%{request:User-Name} # same as above
.br
%{reply:User-Name}
+.br
+ %{outer.reqest:User-Name} # from inside of a TTLS/PEAP tunnel
.DE
.RE
.PP
set, then the length is not set.
e.g. %{#Junk-junk:-foo} will yeild the string "foo".
+.IP %{Attribute-Name#}
+Will print the integer value of the attribute, rather than a decoded
+VALUE or date. This feature applies only to attributes of type
+"date", "integer", "byte", and "short". It has no effect on any other
+attributes. It is used when the numerical value is needed (e.g. Unix
+seconds), rather than a humanly-readable string.
+
+e.g. If a request contains "Service-Type = Login-User", the expansion
+of %{Service-Type#} will yeild "1".
.IP %{Attribute-Name[index]}
Reference the N'th occurance of the given attribute. The syntax
%{<list>:Attribute-Name[index]} may also be used. The indexes start
.RS
.IP =
Add the attribute to the list, if and only if an attribute of the same
-name is already present in that list.
+name is not already present in that list.
.IP :=
Add the attribute to the list. If any attribute of the same name is
already present in that list, its value is replaced with the value of
and value have to match in order for the attribute to be removed from
the list.
.IP ==
-Remove all non-matching attributes from the list. Both the attribute
-name and value have to match in order for the attribute to remain in
-the list.
+Keep all matching attributes. Both the attribute name and value have
+to match in order for the attribute to remain in the list.
Note that this operator is very different than the '=' operator listed
above!
.IP <=
-Enforce that the integer value of the attribute is less than or equal
-to the value given here. If there is no attribute of the same name in
-the list, the attribute is added with the given value, is with "+=".
-If an attribute in the list exists, and has value less than given
-here, it's value is unchanged. If an attribute in the exists, and has
-value greater than given here, it's value is replaced with the value
-given here.
+Keep all attributes having values less than, or equal to, the value
+given here. Any larger value is replaced by the value given here. If
+no attribute exists, it is added with the value given here, as with
+"+=".
This operator is valid only for attributes of integer type.
.IP >=
-Enforce that the integer value of the attribute is greater than or
-equal to the value given here. If there is no attribute of the same
-name in the list, the attribute is added with the given value, is with
-"+=". If an attribute in the list exists, and has value greater than
-given here, it's value is unchanged. If an attribute in the exists,
-and has value less than given here, it's value is replaced with the
-value given here.
+Keep all attributes having values greater than, or equal to, the value
+given here. Any larger value is replaced by the value given here. If
+no attribute exists, it is added with the value given here, as with
+"+=".
This operator is valid only for attributes of integer type.
+.IP !*
+Delete all occurances of the named attribute, no matter what the
+value.
.RE
.IP Values
.br
The format of the value is attribute-specific, and is usually a
string, integer, IP address, etc. Prior to the attribute being
-instantiated, the value is handled as described above in the STRINGS
-AND NUMBERS section. This flexibility means that, for example, you
+instantiated, the value may be expanded as described above in the DATA
+TYPES section, above. This flexibility means that, for example, you
can assign an IP address value to an attribute by specifying the IP
address directly, or by having the address returned from a database
query, or by having the address returned as the output of a program
Some use keywords that are defined in the default configuration file
are:
.IP fail
-Cause the request to be treated as if a database failure had occured.
+Cause the request to be treated as if a database failure had occurred.
.IP noop
Do nothing. This also serves as an instruction to the configurable
failover tracking that nothing was done in the current section.
These return codes can be tested for in a condition, as described
above in the CONDITIONS section.
+
+See also the file doc/configurable_failover for additional methods of
+trapping and modifying module return codes.
.SH FILES
-/etc/raddb/vmpsd.conf,
/etc/raddb/radiusd.conf
.SH "SEE ALSO"
.BR radiusd.conf (5),
-.BR vmpsd.conf (5),
.BR dictionary (5)
.SH AUTHOR
Alan DeKok <aland@deployingradius.com>