No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0178.xml 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Best Practices for Use of SASL EXTERNAL with Certificates</title>
  10. <abstract>This document specifies best practices for XMPP usage of the SASL EXTERNAL mechanism in the context of PKIX certificates.</abstract>
  11. &LEGALNOTICE;
  12. <number>0178</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>N/A</shortname>
  23. &stpeter;
  24. &pgmillard;
  25. <revision>
  26. <version>1.1</version>
  27. <date>2011-05-25</date>
  28. <initials>psa</initials>
  29. <remark><p>Updated text and examples to be consistent with RFC 6120 and RFC 6125.</p></remark>
  30. </revision>
  31. <revision>
  32. <version>1.0</version>
  33. <date>2007-02-15</date>
  34. <initials>psa</initials>
  35. <remark><p>Per a vote of the XMPP Council, advanced specification to Active.</p></remark>
  36. </revision>
  37. <revision>
  38. <version>0.7</version>
  39. <date>2007-02-06</date>
  40. <initials>psa</initials>
  41. <remark><p>Clarified that the scope of this specification is limited to X.509 certificates.</p></remark>
  42. </revision>
  43. <revision>
  44. <version>0.6</version>
  45. <date>2007-01-29</date>
  46. <initials>psa</initials>
  47. <remark><p>Allowed client to not include an authorization identity if the certificate contains no XMPP address (thus depending on the server to assign the identity).</p></remark>
  48. </revision>
  49. <revision>
  50. <version>0.5</version>
  51. <date>2007-01-25</date>
  52. <initials>psa</initials>
  53. <remark><p>Clarified distinction between authentication and authorization; corrected handling of authorization identities; corrected conditions under which SASL EXTERNAL mechanism is offered; specified recommended formats for client and server certificates.</p></remark>
  54. </revision>
  55. <revision>
  56. <version>0.4</version>
  57. <date>2006-11-27</date>
  58. <initials>psa</initials>
  59. <remark><p>Modified XMPP address encapsulation methods per revisions to RFC 3920; clarified conditions for certificates to be considered acceptable.</p></remark>
  60. </revision>
  61. <revision>
  62. <version>0.3</version>
  63. <date>2006-09-21</date>
  64. <initials>psa</initials>
  65. <remark><p>Added TLS and SASL required child elements per revisions to RFC 3920.</p></remark>
  66. </revision>
  67. <revision>
  68. <version>0.2</version>
  69. <date>2006-03-09</date>
  70. <initials>psa</initials>
  71. <remark><p>Corrected client-server failure case to place error in SASL flow rather than binding flow; added note about non-X.509 usages.</p></remark>
  72. </revision>
  73. <revision>
  74. <version>0.1</version>
  75. <date>2006-03-09</date>
  76. <initials>psa</initials>
  77. <remark><p>Initial version.</p></remark>
  78. </revision>
  79. <revision>
  80. <version>0.0.3</version>
  81. <date>2006-02-10</date>
  82. <initials>psa/pgm</initials>
  83. <remark><p>Specified inclusion of authorization identity for server-to-server.</p></remark>
  84. </revision>
  85. <revision>
  86. <version>0.0.2</version>
  87. <date>2006-02-10</date>
  88. <initials>psa/pgm</initials>
  89. <remark><p>Clarified distinction between authentication and authorization.</p></remark>
  90. </revision>
  91. <revision>
  92. <version>0.0.1</version>
  93. <date>2006-02-09</date>
  94. <initials>psa/pgm</initials>
  95. <remark><p>First draft.</p></remark>
  96. </revision>
  97. </header>
  98. <section1 topic='Introduction' anchor='intro'>
  99. <p>XMPP as specified in &rfc3920; and updated in &rfc6120; allows the use of any SASL (&rfc4422;) mechanism in the authentication of XMPP entities. This document specifies a recommended protocol flow for use of the SASL EXTERNAL mechanism with PKIX (&rfc5280;) certificates <note>This specification focuses on the use of the SASL EXTERNAL mechanism with X.509 certificates. Future specifications might document best practices for use of SASL EXTERNAL outside the context of the X.509 infrastructure, for example via Internet Protocol Security (IPSec) as specified in &rfc4301;.</note>, especially when an XMPP service indicates that TLS is mandatory-to-negotiate.</p>
  100. </section1>
  101. <section1 topic='Client-to-Server Recommendation' anchor='c2s'>
  102. <p>As specified in <cite>RFC 3920</cite> and updated in <cite>RFC 6120</cite>, during the stream negotiation process an XMPP client can present a certificate (a "client certificate"). If a JabberID is included in a client certificate, it is encapsulated as an id-on-xmppAddr Object Identifier ("xmppAddr"), i.e., a subjectAltName entry of type otherName with an ASN.1 Object Identifier of "id-on-xmppAddr" as specified in Section 13.7.1.4 of <cite>RFC 6120</cite>.</p>
  103. <p>There are three possible cases:</p>
  104. <ol>
  105. <li>The certificate includes one xmppAddr.</li>
  106. <li>The certificate includes more than one xmppAddr.</li>
  107. <li>The certificate includes no xmppAddr.</li>
  108. </ol>
  109. <p>This specification includes recommendations that address all three cases.</p>
  110. <p>The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL with client certificates is as follows:</p>
  111. <ol>
  112. <li>
  113. <p>Client initiates stream to server.</p>
  114. <example><![CDATA[
  115. <stream:stream
  116. xmlns:stream='http://etherx.jabber.org/streams'
  117. xmlns='jabber:client'
  118. from='juliet@example.com'
  119. to='example.com'
  120. version='1.0'>
  121. ]]></example>
  122. </li>
  123. <li>
  124. <p>Server replies with stream header.</p>
  125. <example><![CDATA[
  126. <stream:stream
  127. xmlns:stream='http://etherx.jabber.org/streams'
  128. xmlns='jabber:client'
  129. id='c2s_234'
  130. from='example.com'
  131. to='juliet@example.com'
  132. version='1.0'>
  133. ]]></example>
  134. </li>
  135. <li>
  136. <p>Server advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
  137. <example><![CDATA[
  138. <stream:features>
  139. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
  140. <required/>
  141. </starttls>
  142. </stream:features>
  143. ]]></example>
  144. </li>
  145. <li>
  146. <p>Client sends STARTTLS command to server.</p>
  147. <example><![CDATA[
  148. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  149. ]]></example>
  150. </li>
  151. <li>
  152. <p>Server informs client to proceed.</p>
  153. <example><![CDATA[
  154. <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  155. ]]></example>
  156. </li>
  157. <li>
  158. <p>Server requests, and client presents, the client certificate during TLS negotiation.</p>
  159. </li>
  160. <li>
  161. <p>Server and client successfully complete the TLS negotiation and client initiates a new initial stream header to server over the encrypted TCP connection.</p>
  162. <example><![CDATA[
  163. <stream:stream
  164. xmlns:stream='http://etherx.jabber.org/streams'
  165. xmlns='jabber:client'
  166. from='juliet@example.com'
  167. to='example.com'
  168. version='1.0'>
  169. ]]></example>
  170. </li>
  171. <li>
  172. <p>Server replies with response stream header.</p>
  173. <example><![CDATA[
  174. <stream:stream
  175. xmlns:stream='http://etherx.jabber.org/streams'
  176. xmlns='jabber:client'
  177. id='c2s_345'
  178. from='example.com'
  179. to='juliet@example.com'
  180. version='1.0'>
  181. ]]></example>
  182. </li>
  183. <li>
  184. <p>Server advertises SASL mechanisms. Because the client presented a client certificate, here the server offers the SASL EXTERNAL mechanism (see Section 6.3.4 of <cite>RFC 6120</cite> for recommendations regarding the conditions under which to offer the SASL EXTERNAL mechanism).</p>
  185. <example><![CDATA[
  186. <stream:features>
  187. <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  188. <mechanism>EXTERNAL<mechanism>
  189. <mechanism>DIGEST-MD5<mechanism>
  190. <mechanism>ANONYMOUS<mechanism>
  191. </mechanisms>
  192. </stream:features>
  193. ]]></example>
  194. </li>
  195. <li>
  196. <p>Client considers EXTERNAL to be its preferred SASL mechanism so it attempts to complete SASL negotiation using that mechanism. The following paragraphs illustrate several possible paths, depending on whether the client includes an authorization identity (for the official rules regarding when to include the authorization identity, see Section 6.3.8 of <cite>RFC 6120</cite>).</p>
  197. <ol style='list-style-type:lower-alpha'>
  198. <li>
  199. <p>If the client certificate contains only one JID, then the client MAY include an authorization identity, but only if it desires to be authorized as a JID other than the address in the client certificate; else it MUST NOT include an authorization identity (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "=").</p>
  200. <example><![CDATA[
  201. <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
  202. mechanism='EXTERNAL'>=</auth>
  203. ]]></example>
  204. </li>
  205. <li>
  206. <p>If the client certificate contains more than one JID, then the client MUST include an authorization identity so that the server can determine which JID to use (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "anVsaWV0QGV4YW1wbGUuY29t", which is the base 64 encoding for "juliet@example.com").</p>
  207. <example><![CDATA[
  208. <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
  209. mechanism='EXTERNAL'>anVsaWV0QGV4YW1wbGUuY29t</auth>
  210. ]]></example>
  211. </li>
  212. <li>
  213. <p>If the client certificate does not contain a JID, then the client MAY include an authorization identity, but only if it desires to be authorized as a JID other than the address specified during SASL negotiation; else it MUST NOT include an authorization identity (this is shown in the following example by setting the XML character data of the &lt;auth/&gt; element to "=").</p>
  214. <example><![CDATA[
  215. <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
  216. mechanism='EXTERNAL'>=</auth>
  217. ]]></example>
  218. </li>
  219. </ol>
  220. </li>
  221. <li>
  222. <p>Server determines whether to allow authentication and authorization of user.</p>
  223. <ol style='list-style-type:lower-alpha'>
  224. <li>
  225. <p>If (1) the certificate presented by the client contains only one valid XMPP address that corresponds to a registered account on the server and (2) the client did not pass an authorization identity in the SASL exchange, then the server SHOULD allow authentication and authorization of that JID.</p>
  226. <example><![CDATA[
  227. <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  228. ]]></example>
  229. </li>
  230. <li>
  231. <p>If the certificate contains more than one valid XMPP address that corresponds to a registered account on the server (e.g., because the server offers virtual hosting) and during the SASL exchange the client specified an authorization identity that corresponds to one of the JIDs presented in the client certificate, then the server SHOULD allow authentication and authorization of the JID specified as the authorization identity.</p>
  232. <example><![CDATA[
  233. <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  234. ]]></example>
  235. <p>If no authorization identity is included, then the server SHOULD return a SASL failure case of &lt;invalid-authzid/&gt; and close the stream.</p>
  236. <example><![CDATA[
  237. <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  238. <invalid-authzid/>
  239. </failure>
  240. </stream:stream>
  241. ]]></example>
  242. </li>
  243. <li>
  244. <p>If the certificate does not contain an XMPP address, then the server MAY attempt to determine if there is a registered account associated with the user, for example by performing an LDAP lookup based on the Common Name or other information presented by the client in the certificate; if such a JID mapping is successful and the mapped JID matches the authorization identity provided, then the server SHOULD allow authentication and authorization of that mapped JID.</p>
  245. <example><![CDATA[
  246. <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  247. ]]></example>
  248. <p>If JID mapping is unsuccessful, then the server SHOULD return a SASL failure condition of &lt;not-authorized/&gt; and close the stream.</p>
  249. <example><![CDATA[
  250. <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  251. <not-authorized/>
  252. </failure>
  253. </stream:stream>
  254. ]]></example>
  255. <p>If JID mapping is successful but the mapped JID does not match the authorization identity provided (if any), then the server SHOULD return a SASL failure condition of &lt;invalid-authzid/&gt; and close the stream.</p>
  256. <example><![CDATA[
  257. <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  258. <invalid-authzid/>
  259. </failure>
  260. </stream:stream>
  261. ]]></example>
  262. </li>
  263. </ol>
  264. </li>
  265. <li>
  266. <p>If SASL authentication succeeded, the client opens a new stream, then client and server proceed with resource binding as described in <cite>RFC 6120</cite>.</p>
  267. </li>
  268. </ol>
  269. </section1>
  270. <section1 topic='Server-to-Server Recommendation' anchor='s2s'>
  271. <p><cite>RFC 3920</cite> specified that if a JabberID is included in a certificate intended for use by an XMPP server (a "server certificate"), it shall be encapsulated as an xmppAddr. That recommendation is updated in <cite>RFC 6120</cite> through a reference to &rfc6125;, which prefers use of a dNSName and/or SRVName entry in the Subject Alternative Name. The DNS domain name contained in the certificate can be a fully-qualified domain name ("FQDN") or a so-called "wildcard" with the '*' character as the complete left-most label (see <cite>RFC 6125</cite> for complete details).</p>
  272. <p>The RECOMMENDED protocol flow for server-to-server use of SASL EXTERNAL with server (domain) certificates is as follows:</p>
  273. <ol>
  274. <li>
  275. <p>Server1 initiates stream to server2.</p>
  276. <example><![CDATA[
  277. <stream:stream
  278. xmlns:stream='http://etherx.jabber.org/streams'
  279. xmlns='jabber:server'
  280. from='conference.example.org'
  281. to='example.com'
  282. version='1.0'>
  283. ]]></example>
  284. </li>
  285. <li>
  286. <p>Server2 replies with stream header.</p>
  287. <example><![CDATA[
  288. <stream:stream
  289. xmlns:stream='http://etherx.jabber.org/streams'
  290. xmlns='jabber:server'
  291. id='s2s_234'
  292. from='example.com'
  293. to='conference.example.org'
  294. version='1.0'>
  295. ]]></example>
  296. </li>
  297. <li>
  298. <p>Server2 advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
  299. <example><![CDATA[
  300. <stream:features>
  301. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
  302. <required/>
  303. </starttls>
  304. </stream:features>
  305. ]]></example>
  306. </li>
  307. <li>
  308. <p>Server1 sends STARTTLS command to Server2.</p>
  309. <example><![CDATA[
  310. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  311. ]]></example>
  312. </li>
  313. <li>
  314. <p>Server2 informs Server1 to proceed.</p>
  315. <example><![CDATA[
  316. <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  317. ]]></example>
  318. </li>
  319. <li>
  320. <p>Server2 requests, and Server1 presents, Server1's certificate during TLS negotiation.</p>
  321. </li>
  322. <li>
  323. <p>Server2 validates certificate in accordance with the rules from <cite>RFC 6120</cite> and <cite>RFC 6125</cite>.</p>
  324. <ol style='list-style-type:lower-alpha'>
  325. <li>
  326. <p>If certificate is unacceptable for the reasons explained in <cite>RFC 6120</cite> and <cite>RFC 6125</cite>, Server2 closes Server1's TCP connection.</p>
  327. </li>
  328. <li>
  329. <p>Else Server2 completes successful TLS negotiation and Server1 sends a new initial stream header to Server2 over the encrypted TCP connection.</p>
  330. <example><![CDATA[
  331. <stream:stream
  332. xmlns:stream='http://etherx.jabber.org/streams'
  333. xmlns='jabber:server'
  334. from='conference.example.org'
  335. to='example.com'
  336. version='1.0'>
  337. ]]></example>
  338. </li>
  339. </ol>
  340. </li>
  341. <li>
  342. <p>Server2 replies with stream header.</p>
  343. <example><![CDATA[
  344. <stream:stream
  345. xmlns:stream='http://etherx.jabber.org/streams'
  346. xmlns='jabber:server'
  347. id='s2s_345'
  348. from='example.com'
  349. to='conference.example.org'
  350. version='1.0'>
  351. ]]></example>
  352. </li>
  353. <li>
  354. <p>Server2 advertises SASL mechanisms. If the 'from' attribute of the stream header sent by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from <cite>RFC 6125</cite>, Server2 SHOULD advertise the SASL EXTERNAL mechanism. If no match is found, Server2 MAY either close Server1's TCP connection or continue with a &xep0220; negotiation.</p>
  355. <example><![CDATA[
  356. <stream:features>
  357. <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  358. <mechanism>EXTERNAL<mechanism>
  359. </mechanisms>
  360. </stream:features>
  361. ]]></example>
  362. </li>
  363. <li>
  364. <p>Server1 considers EXTERNAL to be its preferred SASL mechanism. For server-to-server authentication, the &lt;auth/&gt; element MAY include an authorization identity, however a future version of this specification might disallow use of the authorization identity in server-to-server authentication (in the following example, Server1 includes an empty response of "=" as shown in <cite>RFC 6120</cite>).</p>
  365. <example><![CDATA[
  366. <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
  367. mechanism='EXTERNAL'>=</auth>
  368. ]]></example>
  369. <p>Interoperability Note: Previous versions of this specification stated that the receiving server always relied on the connecting server's inclusion of the authorization identity. Even though this is no longer required, the connecting server SHOULD include the authorization identity for backward compability.</p>
  370. </li>
  371. <li>
  372. <p>Server2 determines if hostname is valid.</p>
  373. <ol style='list-style-type:lower-alpha'>
  374. <li>
  375. <p>If the 'from' attribute of stream header sent by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from <cite>RFC 6125</cite>, Server2 returns success.</p>
  376. <example><![CDATA[
  377. <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  378. ]]></example>
  379. <p>Implementation Note: If Server2 needs to assign an authorization identity during SASL negotiation, it SHOULD use the value of the 'from' attribute of the stream header sent by Server1.</p>
  380. </li>
  381. <li>
  382. <p>Else Server2 SHOULD return a &notauthorized; stream error and close the stream.</p>
  383. <example><![CDATA[
  384. <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  385. <not-authorized/>
  386. </failure>
  387. </stream:stream>
  388. ]]></example>
  389. </li>
  390. </ol>
  391. </li>
  392. </ol>
  393. </section1>
  394. <section1 topic='Security Considerations' anchor='security'>
  395. <p>This document introduces no security considerations or concerns above and beyond those discussed in <cite>RFC 6120</cite> and <cite>RFC 6125</cite>.</p>
  396. </section1>
  397. <section1 topic='IANA Considerations' anchor='iana'>
  398. <p>This document requires no interaction with &IANA;.</p>
  399. </section1>
  400. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  401. <p>This document requires no interaction with the &REGISTRAR;.</p>
  402. </section1>
  403. <section1 topic='Acknowledgements' anchor='ack'>
  404. <p>Thanks to Dave Cridland, Philipp Hancke, Joe Hildebrand, Justin Karneges, Chris Newton, Rob Norris, and Matthias Wimmer for their comments.</p>
  405. </section1>
  406. <section1 topic='Author Note' anchor='authornote'>
  407. <p>Peter Millard, co-author of the initial version of this specification, died on April 26, 2006. The remaining author appreciates his assistance in defining the best practices described herein.</p>
  408. </section1>
  409. </xep>