File: aaa_radius_admin.xml

package info (click to toggle)
opensips 2.2.2-3.1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 31,160 kB
  • sloc: ansic: 334,348; xml: 91,231; perl: 6,659; sh: 5,148; sql: 4,175; makefile: 3,167; yacc: 2,499; python: 1,197; cpp: 611; php: 573
file content (408 lines) | stat: -rw-r--r-- 11,532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!-- Module User's Guide -->

<chapter>

	<title>&adminguide;</title>

	<section>
	<title>Overview</title>
	<para>
		This module provides a Radius implementation for the AAA API from the core.
	</para>
	<para>
		It also provides two functions to be used from the script for generating custom Radius acct and auth requests.
		Detection and handling of SIP-AVPs from Radius replies is automatically and transparently done by the module.
	</para>

	<para>
		Since version 2.2, aaa_radius module supports asynchronous operations. But in order to use them, one must apply
		the patch contained by the modules/aaa_radius folder, called <emphasis>radius_async_support.patch</emphasis>.In
		order to do this, you must have freeradius-client sources. In order to do this you can follow
		the tutorial in the end of the documentation.
	</para>

	<para>
		Any module that wishes to use it has to do the following:
	</para>
	<itemizedlist>
		<listitem>
			<para><emphasis>include aaa.h</emphasis>
			</para>
		</listitem>
		<listitem>
			<para><emphasis>make a bind call with a proper radius specific url</emphasis>
			</para>
		</listitem>

	</itemizedlist>

	</section>

	<section>
	<title>Dependencies</title>
	<section>
		<title>&osips; Modules</title>
		<para>
		None.
		</para>
	</section>

	<section>
		<title>External Libraries or Applications</title>
		<para>
		One of the following libraries must be installed before running
		&osips; with this module loaded:
		</para>
			<itemizedlist>
			<listitem>
			<para><emphasis>radiusclient-ng</emphasis> 0.5.0 or higher
				See <ulink
				url='http://developer.berlios.de/projects/radiusclient-ng/'>
				http://developer.berlios.de/projects/radiusclient-ng/</ulink>.
			</para>
			</listitem>
			<listitem>
			<para><emphasis>freeradius-client</emphasis>
				See <ulink
				url='http://freeradius.org/'>
				http://freeradius.org/</ulink>.
			</para>
			</listitem>
			</itemizedlist>
			<para>
				One can force the radius library that is usedby setting RADIUSCLIENT env, before compiling the module, to one of the following values:
				<itemizedlist>
					<listitem>
						<para><emphasis>RADCLI  ***</emphasis> libradcli-dev library shall be used;</para>
					</listitem>

					<listitem>
						<para><emphasis>FREERADIUS  ***</emphasis> libfreeradius-client-dev library shall be used;</para>
					</listitem>

					<listitem>
						<para><emphasis>RADIUSCLIENT  ***</emphasis> libradiusclient-ng library shall be used;</para>
					</listitem>
				</itemizedlist>

				<para>IMPORTANT: If the selected library is not installed the module won't compile.</para>
				<para>NOTE: If RADIUSCLIENT env not set, the module will try to find one of the three radius libraries in
				the following order: radcli, freeradius, radiusclient-ng. That is if radcli library is installed
				it shall be used, else freeradius shall be looked for and so on.</para>
			</para>
	</section>
	</section>

	<section>
		<title>Exported Parameters</title>
		<section>
		<title><varname>sets (string)</varname></title>
		<para>
			Sets of Radius AVPs to be used when building custom RADIUS requests (set of input RADIUS AVPs)
			or when fetching data from the RADIUS reply (set of output RADIUS AVPs).
		</para>

		<para>
			The format for a set definition is the following:
		</para>
		<itemizedlist>
			<listitem>
			<para>
			" set_name = ( attribute_name1 = var1 [, attribute_name2 = var2 ]* ) "
			</para>
			</listitem>
		</itemizedlist>
		<para>
			The left-hand side of the assignment must be an attribute name known by the RADIUS dictionary.
		</para>
		<para>
			The right-hand side of the assignment must be a script pseudo variable or
			a script AVP. For more information about them see <ulink
				url='http://www.opensips.org/Resources/DocsCoreVar15'>
				CookBooks - Scripting Variables</ulink>.
		</para>
		<example>
		<title>Set <varname>sets</varname> parameter</title>
		<programlisting format="linespecific">

...
modparam("aaa_radius","sets","set4  =  (  Sip-User-ID  =   $avp(10)
			,   Sip-From-Tag=$si,Sip-To-Tag=$tt      )      ")
...

...
modparam("aaa_radius","sets","set1 = (User-Name=$var(usr), Sip-Group = $var(grp),
			Service-Type = $var(type)) ")
...

...
modparam("aaa_radius","sets","set2 = (Sip-Group = $var(sipgrup)) ")
...

</programlisting>
		</example>
		</section>

		<section>
		<title><varname>radius_config (string)</varname></title>
		<para>
			Radiusclient configuration file.
		</para>
		<para>
			This parameter is optional. It must be set only if the radius_send_acct
			and radius_send_auth functions are used.
		</para>
		<example>
		<title>Set <varname>radius_config</varname> parameter</title>
		<programlisting format="linespecific">

...
modparam("aaa_radius", "radius_config", "/etc/radiusclient-ng/radiusclient.conf")
...

</programlisting>
		</example>
		</section>

		<section>
		<title><varname>syslog_name (string)</varname></title>
		<para>
		Enable logging of the client library to syslog, using the given log name.
		</para>
		<para>
		This parameter is optional. Radius client libraries will try to use syslog
		to report errors (such as problems with dictionaries) with the given ident
		string .If this parameter is set, then these errors are visible in syslog.
		Otherwise errors are hidden.
		</para>
		<para>
		By default this parameter is not set (no logging).
		</para>
		<example>
		<title>Set <varname>syslog_name</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("aaa_radius", "syslog_name", "aaa-radius")
...
</programlisting>
		</example>
		</section>

		<section>
		<title><varname>fetch_all_values (integer)</varname></title>
		<para>
		For the output sets, this parameter controls if all the values (for the same
		RADIUS AVP) should be returned (otherwise only the first value will be
		returned). When enabling this options, be sure that the variable you use
		to get the RADIUS output can store multiple values (like the AVP variables).
		</para>
		<para>
		By default this parameter is disabled (set to 0) for backward compatibility
		reasons.
		</para>
		<example>
		<title>Set <varname>fetch_all_values</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("aaa_radius", "fetch_all_values", 1)
...
</programlisting>
		</example>
		</section>

	</section>

	<section>
		<title>Exported Functions</title>

		<section>

		<title>
		<function moreinfo="none">radius_send_auth(input_set_name, output_set_name)</function>
		</title>
		<para>
			This function can be used from the script to make custom
			radius authentication request. The function takes two parameters.
		</para>
		<para>
			The first parameter represents the name of the set that contains
			the list of attributes and pvars that will form the authentication
			request (see the <quote>sets</quote> module parameter).
		</para>
		<para>
			The second parameter represents the name of the set that contains
			the list of attributes and pvars that will be extracted form the
			authentication reply (see the <quote>sets</quote> module
			parameter).
		</para>
		<para>
			The sets must be defined using the <quote>sets</quote> exported
			parameter.
		</para>
		<para>
			The function return TRUE (retcode 1) if authentication was
			successful, FALSE (retcode -1) if an error (any kind of error)
			occured during authentication processes or FALSE (retcode -2) if
			authentication was rejected or denied by RADIUS server.
		</para>
		<para>
			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, ERROR_ROUTE and LOCAL_ROUTE.
		</para>
		<example>
		<title><function>radius_send_auth</function> usage</title>
		<programlisting format="linespecific">

...
radius_send_auth("set1","set2");
switch ($rc) {
	case 1:
		xlog("authentication ok \n");
		break;
	case -1:
		xlog("error during authentication\n");
		break;
	case -2:
		xlog("authentication denied \n");
		break;
}
...

		</programlisting>
		</example>
		</section>

		<section>
		<title>
		<function moreinfo="none">radius_send_acct(input_set_name)</function>
		</title>
		<para>
			This function can be used from the script to make custom
			radius authentication request. The function takes only one parameter
			that represents the name of the set that contains the list of attributes
			and pvars that will form the accounting request.
		</para>
		<para>
			Only one set is needed as a parameter because no AVPs can be extracted
			from the accounting replies.
		</para>
		<para>
			The set must be defined using the "sets" exported parameter.
		</para>
		<para>
			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, ERROR_ROUTE and LOCAL_ROUTE.
		</para>
		<example>

		<title><function>radius_send_acct</function> usage</title>
		<programlisting format="linespecific">

...
radius_send_acct("set1");
...

		</programlisting>
		</example>
		</section>
	</section>

	<section>
		<title>Exported Async Functions</title>

		<section>

		<title>
		<function moreinfo="none">radius_send_auth(input_set_name, output_set_name)</function>
		</title>
		<para>
			This function can be used from the script to make custom
			radius authentication request. The function takes two parameters.
		</para>
		<para>
			The first parameter represents the name of the set that contains
			the list of attributes and pvars that will form the authentication
			request (see the <quote>sets</quote> module parameter).
		</para>
		<para>
			The second parameter represents the name of the set that contains
			the list of attributes and pvars that will be extracted form the
			authentication reply (see the <quote>sets</quote> module
			parameter).
		</para>
		<para>
			The sets must be defined using the <quote>sets</quote> exported
			parameter.
		</para>
		<para>
			The function return TRUE (retcode 1) if authentication was
			successful, FALSE (retcode -1) if an error (any kind of error)
			occured during authentication processes or FALSE (retcode -2) if
			authentication was rejected or denied by RADIUS server.
		</para>
		<example>
		<title><function>radius_send_auth</function> usage</title>
		<programlisting format="linespecific">

...
{
async( radius_send_auth("set1","set2"), resume);
}

route[resume] {
switch ($rc) {
	case 1:
		xlog("authentication ok \n");
		break;
	case -1:
		xlog("error during authentication\n");
		break;
	case -2:
		xlog("authentication denied \n");
		break;
}
...

		</programlisting>
		</example>
		</section>

		<section>
		<title>
		<function moreinfo="none">radius_send_acct(input_set_name)</function>
		</title>
		<para>
			This function can be used from the script to make custom
			radius authentication request. The function takes only one parameter
			that represents the name of the set that contains the list of attributes
			and pvars that will form the accounting request.
		</para>
		<para>
			Only one set is needed as a parameter because no AVPs can be extracted
			from the accounting replies.
		</para>
		<para>
			The set must be defined using the "sets" exported parameter.
		</para>
		<para>
			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, ERROR_ROUTE and LOCAL_ROUTE.
		</para>
		<example>

		<title><function>radius_send_acct</function> usage</title>
		<programlisting format="linespecific">

...
{
async( radius_send_acct("set1","set2"), resume);
}

route[resume] {
xlog(" accounting finished\n");
}

...

		</programlisting>
		</example>
		</section>
	</section>
</chapter>