Initial nonsense documentation to get around most of the
[freeradius.git] / doc / rlm_sql
1         SQL Module
2
3 0. Introduction
4
5   The SQL module is composed of two parts: a generic SQL front-end
6   (rlm_sql), and a series of database-dependent back-end drivers,
7   (rlm_sql_mysql, rlm_sql_postgresql, etc.)
8
9   In order to build the drivers, you MUST ALSO install the development
10   versions of the database.  That is, you must have the appropriate
11   header files and client libraries for (say) MySQL.  The
12   rlm_sql_mysql driver is NOT a complete MySQL client implementation.
13   Instead, it is a small 'shim' between the FreeRADIUS rlm_sql module,
14   and the MySQL client libraries.
15
16
17   In general, the SQL schemas mirror the layout of the 'users' file.
18   So for configuring check items and reply items, see 'man 5 users',
19   and the examples in the 'users' file.
20
21
22 1. Miscellaneous configuration
23
24   The SQL module has little documentation, sorry.  A helpful (but old)
25   web page is:
26
27         http://www.frontios.com/freeradius.html
28
29   but it hasn't been updated in over 6 months.  If anyone has
30   comments on this (or other) documentation, PLEASE email them to the
31   freeradius-devel list, so that they may be included here.
32
33
34 2. What NOT to do.
35
36   One of the fields of the SQL schema is named 'op'  This is for the
37   'operator' used by the attributes.  e.g.:
38
39    Framed-IP-Address  =      1.2.3.4
40    ^ ATTRIBUTE ----^  ^ OP   ^ VALUE
41
42   If you want the server to be completely misconfigured, and to never
43   do what you want, leave the 'op' field blank.  If you want to be
44   rudely told to RTFM, then post questions on the mailing list, asking
45
46   "why doesn't my SQL configuration work when I leave the 'op' field empty?"
47
48
49   The short answer is that with the op field empty, the server does
50   not know what you want it to do with the attribute.  Should it be
51   added to the reply?  Maybe you wanted to compare the operator to one
52   in the request?   The server simply doesn't know.
53
54   So put a value in the field.  The value is the string form of the
55   operator: "=", ">=", etc.  See Section 3, below, for more details.
56
57
58 3. Operators
59
60  The list of operators is given below.
61
62  Op     Example and documentation
63  --     -------------------------
64
65  =      "Attribute = Value"
66
67         Not allowed as a check item.
68
69         As a reply item, it means "add the item to the reply list, but
70         only if there is no other item of the same attribute."
71
72
73  :=     "Attribute := Value"
74
75         Always matches as a check item, and replaces in the
76         configuration items any attribute of the same name.  If no
77         attribute of that name appears in the request, then this
78         attribute is added.
79
80         As a reply item, it has an identical meaning, but for the
81         reply items, instead of the request items.
82
83  ==     "Attribute == Value"
84
85         As a check item, it matches if the named attribute is present
86         in the request, AND has the given value.
87
88         Not allowed as a reply item.
89
90
91  +=     "Attribute += Value"
92
93         Always matches as a check item, and adds the current attribute
94         with value to the list of configuration items.
95
96         As a reply item, it has an identical meaning, but the
97         attribute is added to the reply items.
98
99
100  !=     "Attribute != Value"
101
102         As a check item, matches if the given attribute is in the
103         request, AND does not have the given value.
104
105         Not allowed as a reply item.
106
107
108  >      "Attribute > Value"
109
110         As a check item, it matches if the request contains an
111         attribute with a value greater than the one given.
112
113         Not allowed as a reply item.
114
115
116  >=     "Attribute >= Value"
117
118         As a check item, it matches if the request contains an
119         attribute with a value greater than, or equal to the one
120         given.
121
122         Not allowed as a reply item.
123
124  <      "Attribute < Value"
125
126         As a check item, it matches if the request contains an
127         attribute with a value less than the one given.
128
129         Not allowed as a reply item.
130
131
132  <=     "Attribute <= Value"
133
134         As a check item, it matches if the request contains an
135         attribute with a value less than, or equal to the one given.
136
137         Not allowed as a reply item.
138
139
140  =~     "Attribute =~ Expression"
141
142         As a check item, it matches if the request contains an
143         attribute which matches the given regular expression.  This
144         operator may only be applied to string attributes.
145
146         Not allowed as a reply item.
147
148
149  !~     "Attribute !~ Expression"
150
151         As a check item, it matches if the request contains an
152         attribute which does not match the given regular expression.
153         This operator may only be applied to string attributes.
154
155         Not allowed as a reply item.
156
157
158  =*     "Attribute =* Value"
159
160         As a check item, it matches if the request contains the named
161         attribute, no matter what the value is.
162
163         Not allowed as a reply item.
164
165
166  !*     "Attribute !* Value"
167
168         As a check item, it matches if the request does not contain
169         the named attribute, no matter what the value is.
170
171         Not allowed as a reply item.
172