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-0034.xml 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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>SASL Integration</title>
  10. <abstract>NOTE WELL: this specification was retracted on 2003-11-05 since the topic is addressed definitively in XMPP Core. Please refer to XMPP Core for further information.</abstract>
  11. &LEGALNOTICE;
  12. <number>0034</number>
  13. <status>Retracted</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies/>
  17. <supersedes/>
  18. <supersededby><spec>XMPP Core</spec></supersededby>
  19. <shortname>N/A</shortname>
  20. <author>
  21. <firstname>Robert</firstname>
  22. <surname>Norris</surname>
  23. <email>rob@cataclysm.cx</email>
  24. <jid>rob@cataclysm.cx</jid>
  25. </author>
  26. <author>
  27. <firstname>Jeremie</firstname>
  28. <surname>Miller</surname>
  29. <email>jeremie@jabber.org</email>
  30. <jid>jer@jabber.org</jid>
  31. </author>
  32. <author>
  33. <firstname>Peter</firstname>
  34. <surname>Saint-Andre</surname>
  35. <email>stpeter@jabber.org</email>
  36. <jid>stpeter@jabber.org</jid>
  37. </author>
  38. <revision>
  39. <version>1.1</version>
  40. <date>2003-11-05</date>
  41. <initials>psa</initials>
  42. <remark>The status of this specification has been changed to Retracted since it has been superseded by XMPP Core.</remark>
  43. </revision>
  44. <revision>
  45. <version>1.0</version>
  46. <date>2002-08-13</date>
  47. <initials>psa</initials>
  48. <remark>Changed status to Draft.</remark>
  49. </revision>
  50. <revision>
  51. <version>0.3</version>
  52. <date>2002-07-26</date>
  53. <initials>rn</initials>
  54. <remark>Reworked for server-to-server SASL; added jabber:iq:auth get (as in xmpp-im).</remark>
  55. </revision>
  56. <revision>
  57. <version>0.2</version>
  58. <date>2002-06-05</date>
  59. <initials>rn</initials>
  60. <remark>Fleshed out.</remark>
  61. </revision>
  62. <revision>
  63. <version>0.1</version>
  64. <date>2002-06-03</date>
  65. <initials>psa</initials>
  66. <remark>Initial version based on Jer's notes.</remark>
  67. </revision>
  68. </header>
  69. <section1 topic='Introduction'>
  70. <p>The Simple Authentication and Security Layer (SASL) (see &rfc4422;) provides a generalized method for adding authentication support to connection-based protocols. This document describes a generic XML namespace profile for SASL, that conforms to section 4 of RFC 4422, "Profiling requirements".</p>
  71. <p>This profile may be used for both client-to-server and server-to-server connections. For client connections, the service name used is &quot;jabber-client&quot;. For server connections, the service name used is &quot;jabber-server&quot;. Both these names are registered in the IANA service registry.</p>
  72. <p>The reader is expected to have read and understood the SASL specification before reading this document.</p>
  73. </section1>
  74. <section1 topic='Protocol'>
  75. <section2 topic="Overview">
  76. <p>In these examples, &quot;client&quot; refers to the remote entity that initiated the connection, either a Jabber client or a Jabber server. &quot;Server&quot; refers to the server that the remote entity is attempting to connect and authenticate to.</p>
  77. <p>The steps involved for a SASL negotiation are as follows:</p>
  78. <ol>
  79. <li>Client requests SASL authentication</li>
  80. <li>Server responds with list of available SASL authentication mechanisms</li>
  81. <li>Client selects mechanism</li>
  82. <li>Server sends a challenge</li>
  83. <li>Client responds to challenge</li>
  84. <li>Server sends more challenges, client sends more responses</li>
  85. </ol>
  86. <p>This series of challenge/response pairs continues until one of three things happens:</p>
  87. <ol>
  88. <li>Client aborts the handshake.</li>
  89. <li>Server reports failure.</li>
  90. <li>Server reports success.</li>
  91. </ol>
  92. <p>After authentication has completed, the client sends a packet to begin the session.</p>
  93. <p>The namespace identifier for this protocol is http://www.iana.org/assignments/sasl-mechanisms.</p>
  94. <p>The following examples show the dialogue between a client [C] and a server [S].</p>
  95. <p>
  96. </p>
  97. </section2>
  98. <section2 topic="Stream initialization">
  99. <p>The client begins by requesting SASL authentication as part of the normal Jabber stream negotiation. <note>In the case of the remote entity being a server, the default namespace in the stream header will be &quot;jabber:server&quot;.</note> The server responds by sending the available authentication mechanisms to the client along with the stream information:</p>
  100. <example caption="Stream initialization">
  101. C: &lt;stream:stream xmlns=&apos;jabber:client&apos;
  102. xmlns:stream=&apos;http://etherx.jabber.org/streams&apos;
  103. xmlns:sasl=&apos;http://www.iana.org/assignments/sasl-mechanisms&apos;
  104. to=&apos;jabber.org&apos;&gt;
  105. S: &lt;stream:stream xmlns=&apos;jabber:client&apos;
  106. xmlns:stream=&apos;http://etherx.jabber.org/streams&apos;
  107. xmlns:sasl=&apos;http://www.iana.org/assignments/sasl-mechanisms&apos;
  108. id=&apos;12345678&apos;&gt;
  109. &lt;sasl:mechanisms&gt;
  110. &lt;sasl:mechanism&gt;PLAIN&lt;/sasl:mechanism&gt;
  111. &lt;sasl:mechanism&gt;DIGEST-MD5&lt;/sasl:mechanism&gt;
  112. &lt;sasl:mechanism&gt;EXTERNAL&lt;/sasl:mechanism&gt;
  113. &lt;sasl:mechanisms&gt;
  114. </example>
  115. </section2>
  116. <section2 topic="Mechanism selection and handshake">
  117. <p>Next, the client selects an authentication mechanism:</p>
  118. <example caption="Plaintext mechanism selection">
  119. C: &lt;sasl:auth mechanism=&apos;PLAIN&apos;/&gt;
  120. </example>
  121. <p>The server responds with a mechanism-specific challenge, which the client must respond to. More than one challenge/response pair can take place; this is mechanism-specific.</p>
  122. <p>Challenges and responses are Base64<note><link url="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</link>, section 6.8.</note> encoded.</p>
  123. <example caption="Plaintext handshake">
  124. S: &lt;sasl:challenge/&gt;
  125. C: &lt;sasl:response&gt;cm9iAHNlY3JldA==&lt;/sasl:response&gt;
  126. </example>
  127. <example caption="Digest handshake">
  128. S: &lt;sasl:challenge&gt;
  129. cmVhbG09ImNhdGFjbHlzbS5jeCIsbm9uY2U9Ik9BNk1HOXRFUUdtMmhoIi
  130. xxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz
  131. &lt;/sasl:challenge&gt;
  132. C: &lt;sasl:response&gt;
  133. dXNlcm5hbWU9InJvYiIscmVhbG09ImNhdGFjbHlzbS5jeCIsbm9uY2U9Ik
  134. 9BNk1HOXRFUUdtMmhoIixjbm9uY2U9Ik9BNk1IWGg2VnFUclJrIixuYz0w
  135. MDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJqYWJiZXIvY2F0YWNseX
  136. NtLmN4IixyZXNwb25zZT1kMzg4ZGFkOTBkNGJiZDc2MGExNTIzMjFmMjE0
  137. M2FmNyxjaGFyc2V0PXV0Zi04
  138. &lt;/sasl:response&gt;
  139. S: &lt;sasl:challenge&gt;
  140. cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZA==
  141. &lt;/sasl:challenge&gt;
  142. C: &lt;sasl:response/&gt;
  143. </example>
  144. <p>For mechanisms that require the client to send data first (ie the first challenge from the server is empty), the client may optionally send its first response as part of the mechanism selection:</p>
  145. <example caption="Plaintext mechanism selection; client sends data first">
  146. C: &lt;sasl:auth mechanism=&apos;PLAIN&apos;&gt;cm9iAHNlY3JldA==&lt;/sasl:auth&gt;
  147. </example>
  148. </section2>
  149. <section2 topic="Success, failure and client abort">
  150. <p>The handshake continues until authentication completes successfully, authentication fails, or the client aborts the handshake:</p>
  151. <example caption="Authentication success">
  152. S: &lt;sasl:success/&gt;
  153. </example>
  154. <example caption="Authentication failure">
  155. S: &lt;sasl:failure/&gt;
  156. </example>
  157. <example caption="Client abort">
  158. C: &lt;sasl:abort/&gt;
  159. </example>
  160. <p>Optionally, the server or client may send an informative message along with the success, failure or abort command:</p>
  161. <example caption="Authentication failure; optional informative message">
  162. S: &lt;sasl:failure&gt;Plaintext authentication failed (Incorrect username or password)&lt;/sasl:failure&gt;
  163. </example>
  164. <p>Following a failure or client abort, the client may start a new handshake. Following a successful authentication, any further attempts by the client to begin a new authentication handshake will automatically result in the server sending a failure.</p>
  165. </section2>
  166. <section2 topic='Session start'>
  167. <p>Note: that this section only applies to client-to-server connections.</p>
  168. <p>Following successful authentication, the client must send a standard IQ set packet in the jabber:iq:auth namespace to start a session. The client must supply a username and resource for the session along with this packet.</p>
  169. <example caption="Session start after successful authentication">
  170. C: &lt;iq id=&quot;a1&quot; type=&quot;get&quot;&gt;
  171. &lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
  172. &lt;username&gt;rob&lt;/username&gt;
  173. &lt;/query&gt;
  174. &lt;/iq&gt;
  175. S: &lt;iq id=&quot;a1&quot; type=&quot;result&quot;&gt;
  176. &lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
  177. &lt;username&gt;rob&lt;/username&gt;
  178. &lt;resource/&gt;
  179. &lt;/query&gt;
  180. &lt;/iq&gt;
  181. C: &lt;iq id=&quot;a2&quot; type=&quot;set&quot;&gt;
  182. &lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
  183. &lt;username&gt;rob&lt;/username&gt;
  184. &lt;resource&gt;laptop&lt;/resource&gt;
  185. &lt;/query&gt;
  186. &lt;/iq&gt;
  187. S: &lt;iq id=&quot;a2&quot; type=&quot;result&quot;&gt;
  188. &lt;query xmlns=&quot;jabber:iq:auth&quot;/&gt;
  189. &lt;/iq&gt;
  190. </example>
  191. <p>If the client attempts to start a session before authenticating, or the username given in the jabber:iq:auth packet does not match the username given in the authentication credentials (when the SASL mechanism supports it), the server will return a 401 (Unauthorized) error packet.</p>
  192. </section2>
  193. </section1>
  194. <section1 topic='Support for existing authentication methods'>
  195. <p>Traditionally, Jabber servers have supported two authentication models - jabber:iq:auth for client-to-server authentication, and dialback for server-to-server authentication.</p>
  196. <section2 topic='Legacy client-to-server authentication support'>
  197. <p>Until SASL authentication is in widespread use, clients and servers may support both SASL and the legacy jabber:iq:auth authentication system for client-to-server connections. Note that neither the client nor the server are required to support legacy authentication; it is simply a courtesy to users until the majority of clients and servers support SASL authentication.</p>
  198. <p>If a client connects and does not request the use of SASL (that is, the SASL profile namespace identifier does not appear in the stream initializer response), then the server should disable SASL for this connection; that is, it should not add the SASL profile namespace identifier to the stream initialization response, nor should it offer any SASL mechanisms.</p>
  199. <p>If a client connects to a server that does not support SASL (identified by the lack of the SASL profile namespace identifier in the stream initializer response, even though the client requested it), the client may choose to fall back to use legacy authentication.</p>
  200. </section2>
  201. <section2 topic='Dialback support for server-to-server authentication'>
  202. <p>SASL authentication for server-to-server connections is not intended to replace dialback, as there are uses for both. Dialback is useful in an uncontrolled environment, such as the global Internet, where it is necessary to verify the identity of the remote server. SASL authentication has uses in a more controlled environment, where the administrator wishes to restrict access to a certain number of known remote servers.</p>
  203. <p>To this end, the use of dialback is not deprecated. If a remote server connects and requests the use of dialback (by specifying the &quot;jabber:server:dialback&quot; namespace, the the local server shall not offer SASL authentication. Similarly, if the remote server connects and requests the use of SASL authentication, then the local server shall not offer dialback. In the event that the remote server requests both, the local server should terminate the stream immediately and close the connection. If the remote server requests neither, then the local server may choose to support the pre-dialback server-to-server stream, but it is recommended that the local server terminate the stream and close the connection.</p>
  204. </section2>
  205. </section1>
  206. </xep>