1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-04 16:35:07 -05:00
xeps/xep-0034.xml

250 lines
12 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM "xep.ent">
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>SASL Integration</title>
<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>
&LEGALNOTICE;
<number>0034</number>
<status>Retracted</status>
<type>Standards Track</type>
<sig>Standards</sig>
2016-12-26 10:02:53 -05:00
<dependencies/>
<supersedes/>
<supersededby><spec>XMPP Core</spec></supersededby>
<shortname>N/A</shortname>
<author>
<firstname>Robert</firstname>
<surname>Norris</surname>
<email>rob@cataclysm.cx</email>
<jid>rob@cataclysm.cx</jid>
</author>
<author>
<firstname>Jeremie</firstname>
<surname>Miller</surname>
<email>jeremie@jabber.org</email>
<jid>jer@jabber.org</jid>
</author>
<author>
<firstname>Peter</firstname>
<surname>Saint-Andre</surname>
<email>stpeter@jabber.org</email>
<jid>stpeter@jabber.org</jid>
</author>
<revision>
<version>1.1</version>
<date>2003-11-05</date>
<initials>psa</initials>
2016-12-26 10:02:53 -05:00
<remark>The status of this specification has been changed to Retracted since it has been superseded by XMPP Core.</remark>
</revision>
<revision>
<version>1.0</version>
<date>2002-08-13</date>
<initials>psa</initials>
<remark>Changed status to Draft.</remark>
</revision>
<revision>
<version>0.3</version>
<date>2002-07-26</date>
<initials>rn</initials>
<remark>Reworked for server-to-server SASL; added jabber:iq:auth get (as in xmpp-im).</remark>
</revision>
<revision>
<version>0.2</version>
<date>2002-06-05</date>
<initials>rn</initials>
<remark>Fleshed out.</remark>
</revision>
<revision>
<version>0.1</version>
<date>2002-06-03</date>
<initials>psa</initials>
<remark>Initial version based on Jer's notes.</remark>
</revision>
</header>
<section1 topic='Introduction'>
<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>
<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>
<p>The reader is expected to have read and understood the SASL specification before reading this document.</p>
</section1>
<section1 topic='Protocol'>
<section2 topic="Overview">
<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>
<p>The steps involved for a SASL negotiation are as follows:</p>
<ol>
<li>Client requests SASL authentication</li>
<li>Server responds with list of available SASL authentication mechanisms</li>
<li>Client selects mechanism</li>
<li>Server sends a challenge</li>
<li>Client responds to challenge</li>
<li>Server sends more challenges, client sends more responses</li>
</ol>
<p>This series of challenge/response pairs continues until one of three things happens:</p>
<ol>
<li>Client aborts the handshake.</li>
<li>Server reports failure.</li>
<li>Server reports success.</li>
</ol>
<p>After authentication has completed, the client sends a packet to begin the session.</p>
<p>The namespace identifier for this protocol is http://www.iana.org/assignments/sasl-mechanisms.</p>
<p>The following examples show the dialogue between a client [C] and a server [S].</p>
<p>
</p>
</section2>
<section2 topic="Stream initialization">
<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>
<example caption="Stream initialization">
C: &lt;stream:stream xmlns=&apos;jabber:client&apos;
xmlns:stream=&apos;http://etherx.jabber.org/streams&apos;
xmlns:sasl=&apos;http://www.iana.org/assignments/sasl-mechanisms&apos;
to=&apos;jabber.org&apos;&gt;
S: &lt;stream:stream xmlns=&apos;jabber:client&apos;
xmlns:stream=&apos;http://etherx.jabber.org/streams&apos;
xmlns:sasl=&apos;http://www.iana.org/assignments/sasl-mechanisms&apos;
id=&apos;12345678&apos;&gt;
&lt;sasl:mechanisms&gt;
&lt;sasl:mechanism&gt;PLAIN&lt;/sasl:mechanism&gt;
&lt;sasl:mechanism&gt;DIGEST-MD5&lt;/sasl:mechanism&gt;
&lt;sasl:mechanism&gt;EXTERNAL&lt;/sasl:mechanism&gt;
&lt;sasl:mechanisms&gt;
</example>
</section2>
<section2 topic="Mechanism selection and handshake">
<p>Next, the client selects an authentication mechanism:</p>
<example caption="Plaintext mechanism selection">
C: &lt;sasl:auth mechanism=&apos;PLAIN&apos;/&gt;
</example>
<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>
<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>
<example caption="Plaintext handshake">
S: &lt;sasl:challenge/&gt;
C: &lt;sasl:response&gt;cm9iAHNlY3JldA==&lt;/sasl:response&gt;
</example>
<example caption="Digest handshake">
S: &lt;sasl:challenge&gt;
cmVhbG09ImNhdGFjbHlzbS5jeCIsbm9uY2U9Ik9BNk1HOXRFUUdtMmhoIi
xxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz
&lt;/sasl:challenge&gt;
C: &lt;sasl:response&gt;
dXNlcm5hbWU9InJvYiIscmVhbG09ImNhdGFjbHlzbS5jeCIsbm9uY2U9Ik
9BNk1HOXRFUUdtMmhoIixjbm9uY2U9Ik9BNk1IWGg2VnFUclJrIixuYz0w
MDAwMDAwMSxxb3A9YXV0aCxkaWdlc3QtdXJpPSJqYWJiZXIvY2F0YWNseX
NtLmN4IixyZXNwb25zZT1kMzg4ZGFkOTBkNGJiZDc2MGExNTIzMjFmMjE0
M2FmNyxjaGFyc2V0PXV0Zi04
&lt;/sasl:response&gt;
S: &lt;sasl:challenge&gt;
cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZA==
&lt;/sasl:challenge&gt;
C: &lt;sasl:response/&gt;
</example>
<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>
<example caption="Plaintext mechanism selection; client sends data first">
C: &lt;sasl:auth mechanism=&apos;PLAIN&apos;&gt;cm9iAHNlY3JldA==&lt;/sasl:auth&gt;
</example>
</section2>
<section2 topic="Success, failure and client abort">
<p>The handshake continues until authentication completes successfully, authentication fails, or the client aborts the handshake:</p>
<example caption="Authentication success">
S: &lt;sasl:success/&gt;
</example>
<example caption="Authentication failure">
S: &lt;sasl:failure/&gt;
</example>
<example caption="Client abort">
C: &lt;sasl:abort/&gt;
</example>
<p>Optionally, the server or client may send an informative message along with the success, failure or abort command:</p>
<example caption="Authentication failure; optional informative message">
S: &lt;sasl:failure&gt;Plaintext authentication failed (Incorrect username or password)&lt;/sasl:failure&gt;
</example>
<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>
</section2>
<section2 topic='Session start'>
<p>Note: that this section only applies to client-to-server connections.</p>
<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>
<example caption="Session start after successful authentication">
C: &lt;iq id=&quot;a1&quot; type=&quot;get&quot;&gt;
&lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
&lt;username&gt;rob&lt;/username&gt;
&lt;/query&gt;
&lt;/iq&gt;
S: &lt;iq id=&quot;a1&quot; type=&quot;result&quot;&gt;
&lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
&lt;username&gt;rob&lt;/username&gt;
&lt;resource/&gt;
&lt;/query&gt;
&lt;/iq&gt;
C: &lt;iq id=&quot;a2&quot; type=&quot;set&quot;&gt;
&lt;query xmlns=&quot;jabber:iq:auth&quot;&gt;
&lt;username&gt;rob&lt;/username&gt;
&lt;resource&gt;laptop&lt;/resource&gt;
&lt;/query&gt;
&lt;/iq&gt;
S: &lt;iq id=&quot;a2&quot; type=&quot;result&quot;&gt;
&lt;query xmlns=&quot;jabber:iq:auth&quot;/&gt;
&lt;/iq&gt;
</example>
<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>
</section2>
</section1>
<section1 topic='Support for existing authentication methods'>
<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>
<section2 topic='Legacy client-to-server authentication support'>
<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>
<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>
<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>
</section2>
<section2 topic='Dialback support for server-to-server authentication'>
<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>
<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>
</section2>
</section1>
</xep>