-.TH unlang 5 "12 Jun 2007" "" "FreeRADIUS Processing un-language"
+.TH unlang 5 "16 Jan 2008" "" "FreeRADIUS Processing un-language"
.SH NAME
unlang \- FreeRADIUS Processing un\-language
.SH DESCRIPTION
Python modules rlm_perl, or rlm_python.
The goal of the language is to allow simple policies to be written
-with minimal effort.
+with minimal effort. Those policies are then applied when a request
+is being processed.
.SH KEYWORDS
The keywords for the language are a combination of pre-defined
keywords, and references to loadable module names. We document only
per-keyword.
.IP module-name
A reference to the named module. When processing reaches this point,
-the pre-compiled module is called.
+the pre-compiled module is called. The module may succeed or fail,
+and will return a status to "unlang" if so. This status can be tested
+in a condition. See the "Simple Conditions" text in the CONDITIONS
+section, and MODULE RETURN CODES, below.
.DS
chap # call the CHAP module
.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, may be expanded as described in the DATA TYPES section,
+below.
No statement other than "case" can appear in a "switch" block.
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
+will be removed in a future release.
+
+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.
+
The only contents permitted in an "update" section are attributes and
values. The contents of the "update" section are described in the
ATTRIBUTES section below.
or update an attribute list.
.DS
- redundant load-balance {
+ redundant-load-balance {
.br
ldap1 # 50%, unless ldap2 is down, then 100%
.br
(foo)
.DE
-Evalutes to true if 'foo' is a non-empty string, or 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
+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 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 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.
+.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
.DE
Where <list> is one of "request", "reply", "proxy-request",
-"proxy-reply", or "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.
+"proxy-reply", "control", "outer.request", "outer.reply", or
+"outer.control", as described above for the "update" section. 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
.IP +=
Add the attribute to the tail of the list, even if attributes of the
same name are already present in the list.
+.RE
+.PP
+Enforcement and Filtering Operators
+.RS
+The following operators may also be used in addition to the ones
+listed above. Their function is to perform enforcement or filtering
+on attributes in a list.
.IP -=
Remove all matching attributes from the list. Both the attribute name
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.
+
+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.
+here, it's value is unchanged. If an attribute in the list exists,
+and has a value greater than given here, then that value is replaced
+with the one given here.
This operator is valid only for attributes of integer type.
.IP >=
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.
+given here, it's value is unchanged. If an attribute in the list
+exists, and has value less than given here, then that value is
+replaced with the one given here.
This operator is valid only for attributes of integer type.
.RE
.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.
administrator determines that the faiures are not catastrophic.
.IP reject
Causes the request to be immediately rejected
-.IP return
-Stops processsing of the current section, and returns to process the
-next keyword in the parent section.
+.SH MODULE RETURN CODES
+When a module is called, it returns one of the following codes to
+"unlang", with the following meaning.
+
+.DS
+ notfound information was not found
+.br
+ noop the module did nothing
+.br
+ ok the module succeeded
+.br
+ updated the module updated the request
+.br
+ fail the module failed
+.br
+ reject the module rejected the request
+.br
+ userlock the user was locked out
+.br
+ invalid the configuration was invalid
+.br
+ handled the module has handled the request itself
+.DE
+
+These return codes can be tested for in a condition, as described
+above in the CONDITIONS section.
.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>