misc_radius_admin.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <?xml version="1.0" encoding='ISO-8859-1'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- misc_radius Module User's Guide -->
  9. <chapter>
  10. <title>&adminguide;</title>
  11. <section>
  12. <title>Overview</title>
  13. <para>
  14. The <emphasis>misc_radius</emphasis> module implements various
  15. RADIUS related functions.
  16. Functions exist for loading caller's or callee's
  17. attributes into AVPs, checking if user belongs to a group, and
  18. checking if a specific URI belongs to a user. It thus replaces old
  19. avp_radius, group_radius, and uri_radius modules.
  20. </para>
  21. <para>
  22. All functions of this module load AVPs from SIP-AVP reply items
  23. received from RADIUS upon a successful request. Value of the
  24. SIP-AVP reply item must be a string of form:
  25. <itemizedlist>
  26. <listitem><para><emphasis>
  27. value = SIP_AVP_NAME SIP_AVP_VALUE
  28. </emphasis></para></listitem>
  29. <listitem><para><emphasis>
  30. SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER
  31. </emphasis></para></listitem>
  32. <listitem><para><emphasis>
  33. SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE
  34. </emphasis></para></listitem>
  35. </itemizedlist>
  36. </para>
  37. <example>
  38. <title><quote>SIP-AVP</quote> RADIUS AVP exmaples</title>
  39. <programlisting format="linespecific">
  40. ....
  41. "email:[email protected]"
  42. -> STRING NAME AVP (email) with STRING VALUE ([email protected])
  43. "#14:[email protected]"
  44. -> ID AVP (14) with STRING VALUE ([email protected])
  45. "age#28"
  46. -> STRING NAME AVP (age) with INTEGER VALUE (28)
  47. "#14#28"
  48. -> ID AVP (14) with INTEGER VALUE (28)
  49. ....
  50. </programlisting>
  51. </example>
  52. <para>
  53. Unlike in old avp_radius module, functions
  54. radius_load_calle[re]_avps() do not prefix string names of AVPs
  55. by string
  56. <quote>caller_</quote> or <quote>callee_</quote> depending if
  57. caller's or callee's attributes were loaded. If you need these
  58. prefixes, make your RADIUS server to prepend them into attribute
  59. names when it constructs reply items.
  60. </para>
  61. <para>
  62. A new feature of misc_radius module is that it is now possible
  63. to include user defined extra RADIUS attributes in all requests
  64. send by functions of this module.
  65. </para>
  66. </section>
  67. <section>
  68. <title>Dependencies</title>
  69. <section>
  70. <title>&kamailio; Modules</title>
  71. <para>
  72. The module depends on the following modules (in the other words
  73. the listed modules must be loaded before this module):
  74. <itemizedlist>
  75. <listitem>
  76. <para><emphasis>none</emphasis></para>
  77. </listitem>
  78. </itemizedlist>
  79. </para>
  80. </section>
  81. <section>
  82. <title>External Libraries or Applications</title>
  83. <para>
  84. The following libraries or applications must be installed
  85. before compilling &kamailio; with this module loaded:
  86. </para>
  87. <itemizedlist>
  88. <listitem>
  89. <para><emphasis>radiusclient-ng</emphasis> 0.5.6 or higher --
  90. library and development files. See <ulink
  91. url='http://developer.berlios.de/projects/radiusclient-ng/'>
  92. http://developer.berlios.de/projects/radiusclient-ng/</ulink>.
  93. </para>
  94. </listitem>
  95. </itemizedlist>
  96. </section>
  97. </section>
  98. <section>
  99. <title>Exported Parameters</title>
  100. <section>
  101. <title><varname>radius_config</varname> (string)</title>
  102. <para>
  103. This is the location of the configuration file of radius client
  104. libraries.
  105. </para>
  106. <para>
  107. Default value is
  108. <quote>/usr/local/etc/radiusclient-ng/radiusclient.conf</quote>.
  109. </para>
  110. <example>
  111. <title><varname>radius_config</varname> parameter usage</title>
  112. <programlisting format="linespecific">
  113. ...
  114. modparam("misc_radius", "radius_config", "/etc/radiusclient.conf")
  115. </programlisting>
  116. </example>
  117. </section>
  118. <section>
  119. <title><varname>caller_service_type</varname> (integer)</title>
  120. <para>
  121. This is the value of the Service-Type radius attribute to be
  122. used, when caller's attributes are loaded.
  123. </para>
  124. <para>
  125. Default value is dictionary value of <quote>SIP-Caller-AVPs</quote>
  126. Service-Type.
  127. </para>
  128. <example>
  129. <title><varname>caller_service_type</varname> parameter usage</title>
  130. <programlisting format="linespecific">
  131. ...
  132. modparam("misc_radius", "caller_service_type", 18)
  133. </programlisting>
  134. </example>
  135. </section>
  136. <section>
  137. <title><varname>callee_service_type</varname> (integer)</title>
  138. <para>
  139. This is the value of the Service-Type radius attribute to be
  140. used, when callee's attributes are loaded.
  141. </para>
  142. <para>
  143. Default value is dictionary value of <quote>SIP-Callee-AVPs</quote>
  144. Service-Type.
  145. </para>
  146. <example>
  147. <title><varname>callee_service_type</varname> parameter usage</title>
  148. <programlisting format="linespecific">
  149. ...
  150. modparam("misc_radius", "callee_service_type", 19)
  151. </programlisting>
  152. </example>
  153. </section>
  154. <section>
  155. <title><varname>group_service_type</varname> (integer)</title>
  156. <para>
  157. This is the value of Service-Type RADIUS attribute to be
  158. used, when radius_is_user_in() function is called.
  159. </para>
  160. <para>
  161. Default value is dictionary value of <quote>Group-Check</quote>
  162. Service-Type.
  163. </para>
  164. <example>
  165. <title><varname>group_service_type</varname> parameter usage</title>
  166. <programlisting format="linespecific">
  167. ...
  168. modparam("misc_radius", "group_service_type", 20)
  169. </programlisting>
  170. </example>
  171. </section>
  172. <section>
  173. <title><varname>uri_service_type</varname> (integer)</title>
  174. <para>
  175. This is the value of Service-Type RADIUS attribute to be
  176. used, when radius_does_uri[_user]_exist() function is
  177. called.
  178. </para>
  179. <para>
  180. Default value is dictionary value of <quote>Call-Check</quote>
  181. Service-Type.
  182. </para>
  183. <example>
  184. <title><varname>uri_service_type</varname> parameter usage</title>
  185. <programlisting format="linespecific">
  186. ...
  187. modparam("misc_radius", "uri_service_type", 21)
  188. </programlisting>
  189. </example>
  190. </section>
  191. <section>
  192. <title><varname>caller_extra</varname> (string)</title>
  193. <para>
  194. Semi-colon separated list of extra RADIUS
  195. attribute name=pseudo variable pairs. When
  196. radius_load_caller_avps() is called, the listed extra
  197. attributes are included RADIUS request with
  198. current values of corresponding pseudo variables.
  199. </para>
  200. <para>
  201. There is no default value, i.e., by default no extra
  202. attributes are included.
  203. </para>
  204. <example>
  205. <title><varname>caller_extra</varname> parameter usage</title>
  206. <programlisting format="linespecific">
  207. ...
  208. modparam("misc_radius", "caller_extra", "Calling-Station-Id=$fu")
  209. </programlisting>
  210. </example>
  211. </section>
  212. <section>
  213. <title><varname>callee_extra</varname> (string)</title>
  214. <para>
  215. Semi-colon separated list of extra RADIUS
  216. attribute name=pseudo variable pairs. When
  217. radius_load_callee_avps() is called, the listed extra
  218. attributes are included RADIUS request with
  219. current values of corresponding pseudo variables.
  220. </para>
  221. <para>
  222. There is no default value, i.e., by default no extra
  223. attributes are included.
  224. </para>
  225. <example>
  226. <title><varname>callee_extra</varname> parameter usage</title>
  227. <programlisting format="linespecific">
  228. ...
  229. modparam("misc_radius", "callee_extra", "SIP-URI-User=$rU;SIP-URI-Host=$rd")
  230. </programlisting>
  231. </example>
  232. </section>
  233. <section>
  234. <title><varname>group_extra</varname> (string)</title>
  235. <para>
  236. Semi-colon separated list of extra RADIUS
  237. attribute name=pseudo variable pairs. When
  238. radius_is_user_in() is called, the listed extra
  239. attributes are included RADIUS request with
  240. current values of corresponding pseudo variables.
  241. </para>
  242. <para>
  243. There is no default value, i.e., by default no extra
  244. attributes are included.
  245. </para>
  246. <example>
  247. <title><varname>group_extra</varname> parameter usage</title>
  248. <programlisting format="linespecific">
  249. ...
  250. modparam("misc_radius", "group_extra", "My-Special=$avp(i:100)")
  251. </programlisting>
  252. </example>
  253. </section>
  254. <section>
  255. <title><varname>uri_extra</varname> (string)</title>
  256. <para>
  257. Semi-colon separated list of extra RADIUS
  258. attribute name=pseudo variable pairs. When
  259. radius_does_uri[_user]_exist() function is called, the
  260. listed extra
  261. attributes are included in RADIUS request with
  262. current values of corresponding pseudo variables.
  263. </para>
  264. <para>
  265. There is no default value, i.e., by default no extra
  266. attributes are included.
  267. </para>
  268. <example>
  269. <title><varname>uri_extra</varname> parameter usage</title>
  270. <programlisting format="linespecific">
  271. ...
  272. modparam("misc_radius", "uri_extra", "Called-Station-Id=$tu")
  273. </programlisting>
  274. </example>
  275. </section>
  276. <section>
  277. <title><varname>use_sip_uri_host</varname> (integer)</title>
  278. <para>
  279. If zero, radius_does_uri_exist() function sends to
  280. RADIUS server userpart@hostpart in UserName attribute. If
  281. non-zero, radius_does_uri_exist() function sends to
  282. RADIUS server userpart in UserName attribute and hostpart in
  283. SIP-URI-Host attribute.
  284. </para>
  285. <para>
  286. Default value is 0 (only use UserName attribute).
  287. </para>
  288. <example>
  289. <title><varname>use_sip_uri_host</varname> parameter usage</title>
  290. <programlisting format="linespecific">
  291. ...
  292. modparam("misc_radius", "use_sip_uri_host", 1)
  293. </programlisting>
  294. </example>
  295. </section>
  296. </section>
  297. <section>
  298. <title>Exported Functions</title>
  299. <section>
  300. <title><function
  301. moreinfo="none">radius_load_caller_avps(caller)</function></title>
  302. <para>
  303. The functions loads caller's attributes from radius and
  304. stores them into AVPs. Parameter <quote>caller</quote>
  305. is a string that may contain pseudo variables.
  306. It indicates the user, whose attributes are loaded.
  307. </para>
  308. <para>
  309. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
  310. </para>
  311. <example>
  312. <title><function moreinfo="none">radius_load_caller_avps()</function> usage</title>
  313. <programlisting format="linespecific">
  314. ...
  315. radius_load_caller_avps("$fU@$fd"); # take caller from From URI
  316. ...
  317. radius_load_caller_avps("$au@$ar"); # take caller from Authorization
  318. ... # or Proxy-Authorization header
  319. </programlisting>
  320. </example>
  321. </section>
  322. <section>
  323. <title><function
  324. moreinfo="none">radius_load_callee_avps(callee)</function></title>
  325. <para>
  326. The functions loads callee's attributes from radius and
  327. stores them into AVPs. Parameter <quote>callee</quote>
  328. is a string that may contain pseudo variables.
  329. It indicates the user, whose attributes are loaded.
  330. </para>
  331. <para>
  332. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
  333. </para>
  334. <example>
  335. <title><function moreinfo="none">radius_load_callee_avps()</function> usage</title>
  336. <programlisting format="linespecific">
  337. ...
  338. radius_load_callee_avps("$rU@$rd"); # take callee from Request-URI
  339. ...
  340. </programlisting>
  341. </example>
  342. </section>
  343. <section>
  344. <title><function
  345. moreinfo="none">radius_is_user_in(user, group)</function></title>
  346. <para>
  347. The functions checks from RADIUS, if user given in first
  348. argument belongs to group given in second argument. Both
  349. arguments are strings, but user string may also contain
  350. pseudo variables. In case of positive result, loads
  351. AVPs from SIP-AVP reply items, if any.
  352. </para>
  353. <para>
  354. This function can be used from REQUEST_ROUTE,
  355. FAILURE_ROUTE, BRANCH_ROUTE, and LOCAL_ROUTE.
  356. </para>
  357. <example>
  358. <title><function moreinfo="none">radius_is_user_in()</function> usage</title>
  359. <programlisting format="linespecific">
  360. ...
  361. radius_is_user_in("$rU@$rd", "1"); # take user from Request-URI
  362. ...
  363. radius_is_user_in("$au@$ar", "group_x");# take user from credentials
  364. ...
  365. </programlisting>
  366. </example>
  367. </section>
  368. <section>
  369. <title><function
  370. moreinfo="none">radius_does_uri_exist([uri])</function></title>
  371. <para>
  372. Checks from RADIUS if userpart@hostpart of Request-URI
  373. or of an URI stored in optional pseudo variable argument
  374. belongs to a local
  375. user. In case of positive result, loads AVPs from
  376. SIP-AVP reply items, if any.
  377. </para>
  378. <para>
  379. This function can be used from REQUEST_ROUTE and
  380. LOCAL_ROUTE.
  381. </para>
  382. <example>
  383. <title><function moreinfo="none">radius_does_uri_exist()</function> usage</title>
  384. <programlisting format="linespecific">
  385. ...
  386. if (radius_does_uri_exist()) ... # check Request-URI
  387. ...
  388. if (radius_does_uri_exist("$avp(i:99)")) ... # check URI in $avp(i:99)
  389. ...
  390. </programlisting>
  391. </example>
  392. </section>
  393. <section>
  394. <title><function
  395. moreinfo="none">radius_does_uri_user_exist([user])</function></title>
  396. <para>
  397. Similar to radius_does_uri_exist, but check is done
  398. based only on Request-URI userpart or userpart stored in
  399. optional pseudo variable argument. Userpart should thus
  400. be unique among all user URIs, such as an E.164 number.
  401. In case of positive result, loads AVPs from
  402. SIP-AVP reply items, if any.
  403. </para>
  404. <para>
  405. This function can be used from REQUEST_ROUTE and
  406. LOCAL_ROUTE.
  407. </para>
  408. <example>
  409. <title><function moreinfo="none">radius_does_uri_user_exist()</function> usage</title>
  410. <programlisting format="linespecific">
  411. ...
  412. if (radius_does_uri_user_exist()) ... # check Request-URI userpart
  413. ...
  414. if (radius_does_uri_exist("$fU")) ... # check From URI userpart
  415. ...
  416. </programlisting>
  417. </example>
  418. </section>
  419. </section>
  420. </chapter>