auth.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <?xml version='1.0'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbookid/id/g/4.5/docbookx.dtd">
  4. <refentry id="module.auth"
  5. xmlns:serdoc="http://sip-router.org/xml/serdoc">
  6. <refmeta>
  7. <refentrytitle>auth</refentrytitle>
  8. <manvolnum>7</manvolnum>
  9. </refmeta>
  10. <refnamediv>
  11. <refname>auth</refname>
  12. <refpurpose>Basic Functionality for Digest Authentication</refpurpose>
  13. </refnamediv>
  14. <refsect1>
  15. <title>Description</title>
  16. <para>
  17. The <command>auth</command> SER module provides basic functionality
  18. for digest authentication. However, it does not provide access to
  19. the user information and therefore relies on another module. These
  20. modules are <serdoc:module>auth_db</serdoc:module>,
  21. <serdoc:module>auth_diameter</serdoc:module>,
  22. <serdoc:module>auth_identity</serdoc:module>, and
  23. <serdoc:module>auth_radius</serdoc:module>.
  24. </para>
  25. </refsect1>
  26. <refsect1>
  27. <title>Functions</title>
  28. <refsect2 xml:id="function.consume_credentials">
  29. <title>
  30. <function>consume_credentials</function> ()
  31. </title>
  32. <para>
  33. Allowed in request processing only.
  34. </para>
  35. <para>
  36. The <function>consume_credentials()</function> function
  37. removes previously authorized credentials from the request.
  38. This means that forwarded or relayed requests
  39. will not contain credentials that were checked by this server
  40. and ensures that the proxy will not reveal information about
  41. credentials used to downstream elements. In addition, the
  42. message will be shorter.
  43. </para>
  44. <para>
  45. The function must be called after a call to an authorization
  46. function such as
  47. <serdoc:func>www_authenticate</serdoc:func>.
  48. </para>
  49. </refsect2>
  50. </refsect1>
  51. <refsect1>
  52. <title>Module Parameters</title>
  53. <refsect2 xml:id="module.auth.auth_checks_in_dlg">
  54. <title><parameter>auth_checks_in_dlg</parameter></title>
  55. <serdoc:paraminfo>
  56. <serdoc:paramtype>integer</serdoc:paramtype>
  57. <serdoc:paramdefault>0</serdoc:paramdefault>
  58. </serdoc:paraminfo>
  59. <para>
  60. The <parameter>auth_checks_in_dlg</parameter> parameter controls
  61. which integrity checks are performed on requests within a dialog,
  62. ie., requests that carry a To tag. The default value of
  63. <literal>0</literal> turns off any checks. Otherwise, the value
  64. indicates which checks are run.
  65. </para>
  66. <para>
  67. See <serdoc:link linkend="module.auth.integrity_checks">Additional
  68. Integrity Checks</serdoc:link> below for more details.
  69. </para>
  70. </refsect2>
  71. <refsect2 xml:id="module.auth.auth_checks_no_dlg">
  72. <title><parameter>auth_checks_no_dlg</parameter></title>
  73. <serdoc:paraminfo>
  74. <serdoc:paramtype>integer</serdoc:paramtype>
  75. <serdoc:paramdefault>0</serdoc:paramdefault>
  76. </serdoc:paraminfo>
  77. <para>
  78. The <parameter>auth_checks_no_dlg</parameter> parameter controls
  79. which integrity checks are performed on out-of-dialog requests,
  80. ie., requests that do not carry a To tag. The default value of
  81. <literal>0</literal> turns off any checks. Otherwise, the value
  82. indicates which checks are run.
  83. </para>
  84. <para>
  85. See <serdoc:link linkend="module.auth.integrity_checks">Additional
  86. Integrity Checks</serdoc:link> below for more details.
  87. </para>
  88. </refsect2>
  89. <refsect2 xml:id="module.auth.auth_checks_register">
  90. <title><parameter>auth_checks_register</parameter></title>
  91. <serdoc:paraminfo>
  92. <serdoc:paramtype>integer</serdoc:paramtype>
  93. <serdoc:paramdefault>0</serdoc:paramdefault>
  94. </serdoc:paraminfo>
  95. <para>
  96. The <parameter>auth_checks_register</parameter> parameter
  97. controls which integrity checks are performed on a REGISTER
  98. message. If the parameter is changed from its default value
  99. of <literal>0</literal>, it activates those checks and defines,
  100. which checks are run.
  101. </para>
  102. <para>
  103. See <serdoc:link linkend="module.auth.integrity_checks">Additional
  104. Integrity Checks</serdoc:link> below for more details.
  105. </para>
  106. </refsect2>
  107. <refsect2 xml:id="module.auth.challenge_attr">
  108. <title><parameter>challenge_attr</parameter></title>
  109. <serdoc:paraminfo>
  110. <serdoc:paramtype>attriubte name</serdoc:paramtype>
  111. <serdoc:paramdefault>$digest_challenge</serdoc:paramdefault>
  112. </serdoc:paraminfo>
  113. <para>
  114. The <parameter>challenge_attr</parameter> parameter names the
  115. attribute which will contain the complete header field with the
  116. authentication challenge. The content if this attribute has to
  117. be added to the response in order to transmit the challenge
  118. to the client.
  119. </para>
  120. </refsect2>
  121. <refsect2 xml:id="module.auth.nc_array_order">
  122. <title><parameter>nc_array_order</parameter></title>
  123. <serdoc:paraminfo>
  124. <serdoc:paramtype>integer</serdoc:paramtype>
  125. <serdoc:paramdefault>20</serdoc:paramdefault>
  126. </serdoc:paraminfo>
  127. <para>
  128. The <parameter>nc_array_order</parameter> parameter is an
  129. alternative way to set the maximum number of nonces for the nonce
  130. check enabled by the
  131. <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  132. parameter. Its meaning is identical to that of the
  133. <serdoc:modparam module="auth">nc_array_size</serdoc:modparam>
  134. parameter but the size is given by stating the power of 2.
  135. See <serdoc:modparam module="auth">nc_array_size</serdoc:modparam>
  136. and <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  137. for more details.
  138. </para>
  139. </refsect2>
  140. <refsect2 xml:id="module.auth.nc_array_size">
  141. <title><parameter>nc_array_size</parameter></title>
  142. <serdoc:paraminfo>
  143. <serdoc:paramtype>integer</serdoc:paramtype>
  144. <serdoc:paramdefault>1048576</serdoc:paramdefault>
  145. </serdoc:paraminfo>
  146. <para>
  147. The <parameter>nc_array_size</parameter> parameter sets the
  148. maximum number of in-flight nonces for the nonce
  149. count check enabled by the
  150. <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  151. parameter. It represents the maximum number of nonces for which
  152. state will be kept. When this number is exceeded, state for older
  153. nonces will be discarded to make space for new ones. See
  154. <serdoc:modparam module="auth">nonce_count</serdoc:modparam> for
  155. more details.
  156. </para>
  157. <para>
  158. The value should be a power of 2. If it is not, it will be rounded
  159. down to such a number. For example a value of 1000000 will be
  160. rounded down to 524288. The
  161. <serdoc:modparam module="auth">nc_array_order</serdoc:modparam>
  162. parameter can be used to directly specify the power of 2. For
  163. instance, a value for
  164. <serdoc:modparam module="auth">nc_array_order</serdoc:modparam>
  165. of 20 is equivalent to a <parameter>nc_array_size</parameter>
  166. of 1048576.
  167. </para>
  168. <para>
  169. The memory used to keep the nonce state will be
  170. equal to the value of <parameter>nc_array_size</parameter> in
  171. bytes.
  172. </para>
  173. </refsect2>
  174. <refsect2 xml:id="module.auth.nid_pool_no">
  175. <title><parameter>nid_pool_no</parameter></title>
  176. <serdoc:paraminfo>
  177. <serdoc:paramtype>integer</serdoc:paramtype>
  178. <serdoc:paramdefault>1</serdoc:paramdefault>
  179. </serdoc:paraminfo>
  180. <para>
  181. The <parameter>nid_pool_no</parameter> parameter controls the number
  182. of partitions for the
  183. <serdoc:modparam module="auth">nonce_count</serdoc:modparam> and
  184. <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>
  185. arrays. It is common to both of them to reduce the nonce size.
  186. </para>
  187. <para>
  188. Instead of using single arrays for keeping nonce state, these arrays
  189. can be divided into several partitions. Each SER process is assigned
  190. to one of these partitions, allowing for higher concurrency on
  191. multi-CPU machines. Besides increasing performance, increasing
  192. <parameter>nid_pool_no</parameter> has also a negative effect: it
  193. could decrease the maximum supported in-flight nonces in certain
  194. conditions. In the worst case, when only one SER process receives
  195. most of the traffic (e.g. very busy TCP connection between two
  196. proxies), the in-flight nonces could be limited to the array size
  197. (<serdoc:modparam module="auth">nc_array_size</serdoc:modparam>
  198. for <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  199. and <serdoc:modparam module="auth">otn_in_flight_no</serdoc:modparam>
  200. for <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>)
  201. divided by the partitions number
  202. (<parameter>nid_pool_no</parameter>). However for normal traffic,
  203. where
  204. the process receiving a message is either random or chosen in a
  205. round-robin fashion, the maximum number of in-flight nonces will be
  206. influenced to a very small degree by
  207. <parameter>nid_pool_no</parameter>, since the messages
  208. will be close to equally distributed to processes using different
  209. partitions.
  210. </para>
  211. <para>
  212. The <parameter>nid_pool_no</parameter> value should be one of:
  213. 1, 2, 4, 8, 16, 32 or 64 (the maximum value is 64 and all values
  214. should be a power of 2 or else they will be rounded down to such
  215. a value).
  216. </para>
  217. </refsect2>
  218. <refsect2 xml:id="module.auth.nonce_auth_max_drift">
  219. <title><parameter>nonce_auth_max_drift</parameter></title>
  220. <serdoc:paraminfo>
  221. <serdoc:paramtype>integer</serdoc:paramtype>
  222. <serdoc:paramdefault>3</serdoc:paramdefault>
  223. </serdoc:paraminfo>
  224. <para>
  225. The <parameter>nonce_auth_max_drift</parameter> parameter
  226. specifies the maximum difference in seconds between a nonce
  227. creation time and the current time, if the nonce creation time
  228. appears to be in the future.
  229. </para>
  230. <para>
  231. In some cases, like shortly after a system time backward
  232. adjustment or when the current proxy is part of a cluster which is
  233. not time-synchronized, it's possible to receive a nonce with
  234. a creation time in the future. In this case if the difference is
  235. greater then the value of <parameter>nonce_auth_max_drift</parameter>
  236. in seconds, the nonce is considered stale and the request
  237. re-challenged. If this were not done, a dramatic time change
  238. backwards may lead to nonces having been generated before the
  239. cange being valid for too long.
  240. </para>
  241. </refsect2>
  242. <refsect2 xml:id="module.auth.nonce_count">
  243. <title><parameter>nonce_count</parameter></title>
  244. <serdoc:paraminfo>
  245. <serdoc:paramtype>boolean</serdoc:paramtype>
  246. <serdoc:paramdefault>no</serdoc:paramdefault>
  247. </serdoc:paraminfo>
  248. <para>
  249. The <parameter>nonce_count</parameter> parameter controls, whether
  250. tracking of nounce count is enabled. If it is set to
  251. <literal>yes</literal>, the received <parameter>nc</parameter> value
  252. is remembered and checked against the value used in the previous
  253. digest response. For a successful authentication the received
  254. <parameter>nc</parameter> must be greater then the previously
  255. received one (See RFC 2617 for more details). This will provide
  256. protection against replay attacks while still allowing credentials
  257. caching at the UA side.
  258. </para>
  259. <para>
  260. In order for this to work, the
  261. <serdoc:modparam module="auth">qop</serdoc:modparam> parameter
  262. must not be set to an empty string. It it is, the challenges won’t
  263. include the <parameter>qop</parameter> parameter and the user agent
  264. will probably not include the <parameter>qop</parameter> or
  265. <parameter>nc</parameter> parameters in its response.
  266. </para>
  267. <para>
  268. If a response doesn’t include <parameter>qop</parameter> or
  269. <parameter>nc</parameter> (for example obsolete UAs that don't
  270. support them) the response will be checked according to the other
  271. enabled nonce checks, in this order:
  272. <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam> and
  273. the applicable of the additional integrity checks. If a response
  274. includes <parameter>nc</parameter> only the normal
  275. <serdoc:modparam module="auth">nonce_expire</serdoc:modparam>
  276. checks and the
  277. <serdoc:modparam module="auth">nonce_count</serdoc:modparam> checks
  278. will be performed, all the other checks will be ignored.
  279. </para>
  280. <para>
  281. The <parameter>nonce_count</parameter> checks work by tracking a
  282. limited number of nonces. The maximum number of tracked nonces is
  283. set using the
  284. <serdoc:modparam module="auth">nc_array_size</serdoc:modparam> or
  285. <serdoc:modparam module="auth">nc_array_order</serdoc:modparam>
  286. parameters. If this number is exceeded, older entries will be
  287. overwritten. As long as the maximum rate of challengeable messages
  288. per average response time is lower then
  289. <serdoc:modparam module="auth">nc_array_size</serdoc:modparam>,
  290. the nonce count check should work flawlessly. For optimal
  291. performance (maximum reuse of cache credentials)
  292. <serdoc:modparam module="auth">nc_array_size</serdoc:modparam>
  293. divided by
  294. <serdoc:modparam module="auth">nid_pool_no</serdoc:modparam>
  295. should be lower then the message rate multiplied by the desired
  296. <serdoc:modparam module="auth">nonce_expire</serdoc:modparam>.
  297. <!-- XXX: Give an example with default nonce_expire and typical
  298. RTT. -->
  299. </para>
  300. <para>
  301. The maximum accepted <parameter>nc</parameter> value is 255. If
  302. <parameter>nc</parameter> becomes greater then this, the nonce will
  303. be considered stale and the UA will be re-challenged.
  304. </para>
  305. <para>
  306. <emphasis>Note:</emphasis> If the <parameter>nonce_count</parameter>
  307. parameter is enabled, all challenges should be done in stateful
  308. mode, ie., a transaction should be created prior to the
  309. authentication check, for instance by using the function
  310. <serdoc:func>t_newtran</serdoc:func>, to absorb possible
  311. retransmissions. All the replies need to be sent statefuly,
  312. using <serdoc:func>t_reply()</serdoc:func>). Otherwise,
  313. all retransmissions will be challenged which may cause the user
  314. agent to believe the password supplied by the user to be wrong.
  315. </para>
  316. <para>
  317. For more information on stateful processing, see
  318. <serdoc:module>tm</serdoc:module>. An example on how to implement
  319. a stateful registrar can be found in
  320. <serdoc:module>registrar</serdoc:module>.
  321. </para>
  322. </refsect2>
  323. <refsect2 xml:id="module.auth.nonce_expire">
  324. <title><parameter>nonce_expire</parameter></title>
  325. <serdoc:paraminfo>
  326. <serdoc:paramtype>integer</serdoc:paramtype>
  327. <serdoc:paramdefault>300</serdoc:paramdefault>
  328. </serdoc:paraminfo>
  329. <para>
  330. The <parameter>nonce_exipre</parameter> parameter determines the
  331. time in seconds before a nonce is considered stale.
  332. </para>
  333. <para>
  334. Nonces have a limited lifetime after which they
  335. will be considered stale.
  336. This is to protect replay attacks. Credentials containing a stale
  337. nonce will be not authorized. The user agent will be challenged
  338. again instead. This new challenge will not only contain a newly
  339. generated nonce, but also the <parameter>stale</parameter>
  340. parameter which indicates to the client the failure was not due
  341. to a wrong username or password and it doesn't need to disturb
  342. the user asking for them. It can simply recalculate its answer
  343. using existing username and password.
  344. </para>
  345. </refsect2>
  346. <refsect2 xml:id="module.auth.one_time_nonce">
  347. <title><parameter>one_time_nonce</parameter></title>
  348. <serdoc:paraminfo>
  349. <serdoc:paramtype>boolean</serdoc:paramtype>
  350. <serdoc:paramdefault>no</serdoc:paramdefault>
  351. </serdoc:paraminfo>
  352. <para>
  353. The <parameter>one_time_nonce</parameter> controls whether digist
  354. responses with a reused nonce will be rejected. If it is set to
  355. <literal>yes</literal>, nonces cannot be reused by user agents.
  356. </para>
  357. <para>
  358. This results in each request being challenged. To avoid retransmits
  359. being challenged, it should only be used in stateful mode, ie., by
  360. creating a transaction before authentication, for instance trough
  361. a call to the <serdoc:func>t_newtran</serdoc:func> function. For
  362. more information on stateful mode see
  363. <serdoc:module>tm</serdoc:module>. An example on how to implement
  364. a stateful registrar can be found in
  365. <serdoc:module>registrar</serdoc:module>.
  366. </para>
  367. <para>
  368. The one time nonce provides enhanced replay protections at the cost
  369. of invalidating UA side credentials
  370. caching and causing extra round trips. Therefore, the nonce chount
  371. check enabled through the
  372. <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  373. parameter should be preferred.
  374. </para>
  375. <para>
  376. The one time nonce provides the same protection as the nonce count
  377. check but requiring more messages. The advantages are that it uses
  378. less memory for the same supported number of maximum in-flight
  379. nonces (by a factor of 8) and that it works
  380. with user agents that do not support <parameter>qop</parameter>
  381. and <parameter>nc</parameter>. It shoud thus be used if such
  382. user agents are in use and the checks described in section
  383. <serdoc:link linkend="module.auth.integrity_checks">Additional
  384. Integrity Checks</serdoc:link> are not deemed sufficient.
  385. </para>
  386. <para>
  387. Like the nonce count check, one time nonces works by tracking a
  388. limited number of nonces. The maximum number of tracked nonces is
  389. set using the
  390. <serdoc:modparam module="auth">otn_in_flight_no</serdoc:modparam>
  391. or
  392. <serdoc:modparam module="auth">otn_in_flight_order</serdoc:modparam>
  393. parameters. If this number is exceeded, older entries will be
  394. overwritten. As long as the maximum rate of challengeable messages
  395. per average response time is lower then
  396. <serdoc:modparam module="auth">otn_in_flight_no</serdoc:modparam>,
  397. the one time nonce check should work flawlessly.
  398. </para>
  399. </refsect2>
  400. <refsect2 xml:id="module.auth.otn_in_flight_no">
  401. <title><parameter>otn_in_flight_no</parameter></title>
  402. <serdoc:paraminfo>
  403. <serdoc:paramtype>integer</serdoc:paramtype>
  404. <serdoc:paramdefault>1048576</serdoc:paramdefault>
  405. </serdoc:paraminfo>
  406. <para>
  407. The <parameter>otn_in_flight_no</parameter> parameter specifies
  408. the maximum number of in-flight nonces for the one time nonce
  409. check enabled by the
  410. <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>
  411. parameter. It represents the maximum number of nonces remembered
  412. for the one time nonce check. When this number is exceeded,
  413. information about older nonces will be discarded and overwritten
  414. with information about newly generated nonces. See
  415. <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>
  416. for more details.
  417. </para>
  418. <para>
  419. The value should be a power of 2. If it is not, it will be rounded
  420. down to such a value. The
  421. <serdoc:modparam module="auth">otn_in_flight_order</serdoc:modparam>
  422. parameter can be used to directly specify the power of 2.
  423. </para>
  424. <para>
  425. The memory used to keep the nonce information will be identical to
  426. the value of <parameter>otn_in_flight_no</parameter> divided by 8
  427. since only 1 bit of state is kept per nonce.
  428. </para>
  429. </refsect2>
  430. <refsect2 xml:id="module.auth.otn_in_flight_order">
  431. <title><parameter>otn_in_flight_order</parameter></title>
  432. <serdoc:paraminfo>
  433. <serdoc:paramtype>integer</serdoc:paramtype>
  434. <serdoc:paramdefault>20</serdoc:paramdefault>
  435. </serdoc:paraminfo>
  436. <para>
  437. The <parameter>otn_in_flight_order</parameter> parameter is an
  438. alternative way to set the maximum number of nonces for the
  439. one time nonce check enabled by the
  440. <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>
  441. parameter. Its meaning is identical to that of the
  442. <serdoc:modparam module="auth">otn_in_flight_no</serdoc:modparam>
  443. parameter but the size is given by stating the power of 2.
  444. See <serdoc:modparam module="auth">otn_in_flight_no</serdoc:modparam>
  445. and <serdoc:modparam module="auth">one_time_nonce</serdoc:modparam>
  446. for more details.
  447. </para>
  448. </refsect2>
  449. <refsect2 xml:id="module.auth.protect_contacts">
  450. <title><parameter>protect_contacts</parameter></title>
  451. <serdoc:paraminfo>
  452. <serdoc:paramtype>boolean</serdoc:paramtype>
  453. <serdoc:paramdefault>no</serdoc:paramdefault>
  454. </serdoc:paraminfo>
  455. <para>
  456. If the <parameter>protect_contacts</parameter> parameter is set
  457. to <literal>yes</literal>, the contacts are included when creating
  458. a nonce.
  459. </para>
  460. <!-- XXX What does this exactly mean? -->
  461. </refsect2>
  462. <refsect2 xml:id="module.auth.proxy_challenge_header">
  463. <title><parameter>proxy_challenge_header</parameter></title>
  464. <serdoc:paraminfo>
  465. <serdoc:paramtype>string</serdoc:paramtype>
  466. <serdoc:paramdefault>"Proxy-Authenticate"</serdoc:paramdefault>
  467. </serdoc:paraminfo>
  468. <para>
  469. The <parameter>proxy_challenge_header</parameter> parameter
  470. contains the name of the header field that should be used to
  471. include the proxy-to-user challenge.
  472. </para>
  473. </refsect2>
  474. <refsect2 xml:id="module.auth.qop">
  475. <title><parameter>qop</parameter></title>
  476. <serdoc:paraminfo>
  477. <serdoc:paramtype>string</serdoc:paramtype>
  478. <serdoc:paramdefault>"auth"</serdoc:paramdefault>
  479. </serdoc:paraminfo>
  480. <para>
  481. The <parameter>qop</parameter> parameter determines, which value
  482. for the <parameter>qop</parameter> parameter should be included
  483. in a challenge. The parameter was optional in the SIP revision
  484. described by RFC 2543. The current version from RFC 3261 states,
  485. however, that the parameter must be included in all challenges.
  486. </para>
  487. <para>
  488. In digest authentication, the <parameter>qop</parameter>
  489. parameter, short for ‘quality of protection’, indicates which
  490. parts of a request should be used for the calculation of the
  491. digest response. If the value is <literal>auth</literal>,
  492. only authentication should be done and the response is solely
  493. calculated using information from the challenge plus the user’s
  494. password. A value of <literal>auth-int</literal> indicates that
  495. in addition the integrity of the request body is to be verified.
  496. For this purpose, a hash over the body is additionally included
  497. in the calculation.
  498. </para>
  499. <para>
  500. In a challenge the parameter indicates, which of these methods
  501. the server supports. This can either be one of them or both,
  502. separated by a comma. For challenges generated by SER, this
  503. is given by the <parameter>qop</parameter> module. It may also
  504. be an empty string, in which case no <parameter>qop</parameter>
  505. parameter will be present in challenges created by SER. This may
  506. be necessary for compatibility with some old clients but will
  507. make your SER not comply with RFC 3261.
  508. </para>
  509. <para>
  510. Protection against nonce replay attacks can be achieved by
  511. additionally enabling the
  512. <serdoc:modparam module="auth">nonce_count</serdoc:modparam>
  513. parameter. See there for more information.
  514. </para>
  515. </refsect2>
  516. <refsect2 xml:id="module.auth.secret">
  517. <title><parameter>secret</parameter></title>
  518. <serdoc:paraminfo>
  519. <serdoc:paramtype>string</serdoc:paramtype>
  520. <serdoc:paramdefault>random value</serdoc:paramdefault>
  521. </serdoc:paraminfo>
  522. <para>
  523. The <parameter>secret</parameter> parameter
  524. sets the secret used for the calculation of the nonce and for
  525. message integrity checks. If not set, a random secret will be
  526. chosen upon start.
  527. </para>
  528. </refsect2>
  529. <refsect2 xml:id="module.auth.www_challenge_header">
  530. <title><parameter>www_challenge_header</parameter></title>
  531. <serdoc:paraminfo>
  532. <serdoc:paramtype>string</serdoc:paramtype>
  533. <serdoc:paramdefault>"WWW-Authenticate</serdoc:paramdefault>
  534. </serdoc:paraminfo>
  535. <para>
  536. The <parameter>www_challenge_header</parameter> parameter
  537. contains the name of the header field that should be used to
  538. transmit a user-to-user challenge for authentication.
  539. </para>
  540. </refsect2>
  541. </refsect1>
  542. <refsect1 id="module.auth.integrity_checks">
  543. <title>Additional Integrity Checks</title>
  544. <para>
  545. The auth module can perform additional integrity checks on the
  546. authentication response inclued in a request by the client.
  547. </para>
  548. <para>
  549. Without the extra checks, the nonce value will be used only to
  550. store the expire time (see <parameter>nonce_expire</parameter>),
  551. plus an MD5 hash over it and some secret to prevent tampering
  552. with the expire time. With this arrangement, some replay attacks
  553. are still possible in the expire "window".
  554. </para>
  555. <para>
  556. A
  557. possible workaround is to always force qop authentification and
  558. always check the URI from the authorization header, but this does not
  559. work if an upstream proxy rewrites the URI and it will also not work
  560. with a lot of UA implementations.
  561. </para>
  562. <para>
  563. When the extra checks are enabled, the nonce will include and extra
  564. MD5 hash over some selected parts of the message and another secret.
  565. This will be used to check if these parts of the message are the same
  566. when a UA retries the request with the authentication response, thus
  567. protecting from replay attacks or at least severly limiting their
  568. possibility.
  569. </para>
  570. <para>
  571. Three module parameters control which parts of the message will be
  572. included for different types of requests. The parameter
  573. <parameter>auth_checks_register</parameter> sets them for REGISTER
  574. requests. The parameter <parameter>auth_checks_no_dlg</parameter>
  575. does the same for requests that to not have a
  576. <parameter>tag</parameter> parameter in the To header field or have
  577. no To header field altogether (in other words requests sent outside
  578. of an existing dialog). And, finally, the parameter
  579. <parameter>auth_checks_in_dlg</parameter> controls the checks for
  580. SIP requests sent within dialogs, such as BYEs or re-INVITEs.
  581. </para>
  582. <para>
  583. The default value for all three parameters is 0, in which case no
  584. extra checks are performed and the module behaves as it did before
  585. their introduction. Otherwise the parameter is a bit field. The
  586. message parts to be included in the check can be determined by adding
  587. any of the following values together:
  588. </para>
  589. <variablelist>
  590. <varlistentry>
  591. <term><literal>1</literal></term>
  592. <listitem>
  593. <para>
  594. check the full Request-URI,
  595. </para>
  596. </listitem>
  597. </varlistentry>
  598. <varlistentry>
  599. <term><literal>2</literal></term>
  600. <listitem>
  601. <para>
  602. check the Call-ID,
  603. </para>
  604. </listitem>
  605. </varlistentry>
  606. <varlistentry>
  607. <term><literal>4</literal></term>
  608. <listitem>
  609. <para>
  610. check the <parameter>tag</parameter> parameter of the From
  611. header field,
  612. </para>
  613. </listitem>
  614. </varlistentry>
  615. <varlistentry>
  616. <term><literal>9</literal></term>
  617. <listitem>
  618. <para>
  619. check the source IP address the request was received from.
  620. </para>
  621. </listitem>
  622. </varlistentry>
  623. </variablelist>
  624. <para>
  625. For example, setting <parameter>auth_checks_register</parameter> to
  626. <literal>6</literal> would check if the Call-ID or the From tag
  627. have changed from the REGISTER message for which the nonce was
  628. generated. This allows nonce reuse only within the same UA and
  629. for the expire time. Note that enabling the extra checks will
  630. limit nonce caching by UAs, requiring extra challenges and
  631. round trips, but will provide much better protection.
  632. </para>
  633. <para>
  634. When the <parameter>secret</parameter> parameter is set and the
  635. extra checks are enabled, the first half of the secret will be used
  636. for the expire time hash and the other half for the hash on the
  637. extra checks, so make sure you have a long secret. At least 32
  638. characterss are recommended.
  639. </para>
  640. </refsect1>
  641. <refsect1>
  642. <title>See Also</title>
  643. <simplelist type="inline">
  644. <member><serdoc:sbin>ser</serdoc:sbin></member>
  645. <member><serdoc:file>ser.cfg</serdoc:file></member>
  646. <member><serdoc:module>auth_db</serdoc:module></member>
  647. <member><serdoc:module>auth_diameter</serdoc:module></member>
  648. <member><serdoc:module>auth_identity</serdoc:module></member>
  649. <member><serdoc:module>auth_radius</serdoc:module></member>
  650. </simplelist>
  651. </refsect1>
  652. </refentry>
  653. <!-- vim:sw=2 sta et sts=2 ai tw=76
  654. -->