This commit is contained in:
stpeter 2010-09-28 16:04:30 -06:00
parent f72b1c2a71
commit 03f0674012
1 changed files with 46 additions and 27 deletions

View File

@ -7,10 +7,11 @@
<xep>
<header>
<title>Best Practices for Use of SASL EXTERNAL with Certificates</title>
<abstract>This document specifies best practices for XMPP usage of the SASL EXTERNAL mechanism in the context of X.509 certificates.</abstract>
<abstract>This document specifies best practices for XMPP usage of the SASL EXTERNAL mechanism in the context of PKIX certificates.</abstract>
&LEGALNOTICE;
<number>0178</number>
<status>Active</status>
<interim/>
<type>Informational</type>
<sig>Standards</sig>
<approver>Council</approver>
@ -22,6 +23,12 @@
<shortname>N/A</shortname>
&stpeter;
&pgmillard;
<revision>
<version>1.1rc1</version>
<date>in progress, last updated 2010-09-24</date>
<initials>psa</initials>
<remark><p>Updated to reflect draft-ietf-xmpp-3920bis and draft-saintandre-tls-server-id-check.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2007-02-15</date>
@ -90,10 +97,17 @@
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>XMPP as specified in &rfc3920; and provisionally clarified in &rfc3920bis; allows the use of any SASL mechanism (see &rfc4422;) in the authentication of XMPP entities, including the SASL EXTERNAL mechanism. This document specifies a recommended protocol flow for such use in the context of X.509 certificates, specifically when negotiation of TLS is required by a deployment. <note>The protocol flows when TLS is not required are more complicated (e.g., alternate flows involving server dialback) and may be described in a future version of this document.</note> <note>This specification focuses on the use of the SASL EXTERNAL mechanism with X.509 certificates. Future specifications may 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></p>
<p>XMPP as specified in &rfc3920; and provisionally clarified in &rfc3920bis; 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 may 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>, expecially when an XMPP service indicates that TLS is mandatory-to-negotiate. <note>The protocol flows when TLS is not required are more complicated (e.g., alternate flows involving server dialback) and may be described in a future version of this document.</note></p>
</section1>
<section1 topic='Client-to-Server Recommendation' anchor='c2s'>
<p>As specified in <cite>RFC 3920</cite> and provisionally clarified in <cite>rfc3920bis</cite>, if a JabberID is included in an X.509 certificate, it MUST be encapsulated as an id-on-xmppAddr Object Identifier. Although it is not necessary for an X.509 certificate to include a JabberID, it is RECOMMENDED that client certificates include at least one id-on-xmppAddr OID encapsulating the JabberID of associated user (e.g., "juliet@example.org"), and OPTIONAL for client certificates to include either more than one id-on-xmppAddr or no id-on-xmppAddr. This specification includes recommendations that address all three cases.</p>
<p>As specified in <cite>RFC 3920</cite> and provisionally clarified in <cite>rfc3920bis</cite>, during the stream negotiation process an XMPP client can present a certificate (here called an "end-user certificate"). If a JabberID is included in an end-user 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 5.1.1. of <cite>RFC 3920</cite> and Section 13.7.1.4 of <cite>rfc3920bis</cite>.</p>
<p>There are three possible cases:</p>
<ol>
<li>The certificate includes one xmppAddr.</li>
<li>The certificate includes more than one xmppAddr.</li>
<li>The certificate includes no xmppAddr.</li>
</ol>
<p>This specification includes recommendations that address all three cases.</p>
<p>The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL with end-user certificates is as follows:</p>
<ol>
<li>
@ -102,6 +116,7 @@
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
from='juliet@example.com'
to='example.com'
version='1.0'>
]]></code>
@ -114,11 +129,12 @@
xmlns='jabber:client'
id='c2s_234'
from='example.com'
to='juliet@example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises TLS stream feature.</p>
<p>Server advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
<code><![CDATA[
<stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
@ -140,31 +156,33 @@
]]></code>
</li>
<li>
<p>Client presents certificate.</p>
<p>Client presents its certificate during TLS negotiation.</p>
</li>
<li>
<p>Server and client negotiate TLS and client initiates a new stream header to server.</p>
<p>Server and client negotiate TLS; if successful, client initiates a new initial stream header to server over the encrypted TCP connection.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
from='juliet@example.com'
to='example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server replies with stream header.</p>
<p>Server replies with response stream header.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'
id='c2s_345'
from='example.com'
to='juliet@example.com'
version='1.0'>
]]></code>
</li>
<li>
<p>Server advertises SASL mechanisms. If server expects that client will be able to authenticate and authorize as the identity provided in the presented certificate, then server SHOULD advertize the SASL EXTERNAL mechanism; otherwise, if presented certificate is unacceptable (e.g., because the certificate is expired, not yet valid, or revoked, or because the root certificate was issued by a certification authority that is untrusted), server MUST NOT offer EXTERNAL mechanism.</p>
<p>Server advertises SASL mechanisms. Here the server offers and prefers the SASL EXTERNAL mechanism (see Section 6.2.4 of <cite>rfc3920bis</cite> for recommendations regarding the conditions under which to offer the SASL EXTERNAL mechanism).</p>
<code><![CDATA[
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
@ -177,22 +195,23 @@
]]></code>
</li>
<li>
<p>Because client presented a certificate, client SHOULD consider EXTERNAL to be its preferred SASL mechanism. If the client certificate includes only one XMPP address and the user wishes to authorize as the identity that has been authenticated by the TLS layer (i.e., the XMPP address that is contained in the client certificate), then the client SHOULD NOT include an authorization identity (i.e., the XML character data for the <auth/> element SHOULD be "=", indicating an empty response); if the client certificate contains more than one XMPP address or if the user wishes to authorize as another identity, then the client MUST include an authorization identity; if the client certificate contain no XMPP address, then the client SHOULD include an authorization identity (but MAY include no authorzation identity since the client may not even know its identity, instead having it assigned by the server).</p>
<p>Client considers EXTERNAL to be its preferred SASL mechanism. Here the client does not include an authorization identity and therefore sets the XML character data of the &lt;auth/&gt; element to "=", indicating an empty response (see Section 6.2.8 of <cite>rfc3920bis</cite> for recommendations regarding the conditions under which to include an authorization identity).</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>=</auth>
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='EXTERNAL'>=</auth>
]]></code>
</li>
<li>
<p>Server determines whether to allow authentication and authorization of user.</p>
<ol>
<li>
<p>If the certificate presented by the client contains only one valid XMPP address that corresponds to a registered account on the server and client did not pass an authorization identity in the SASL exchange, then the server SHOULD allow authentication and authorization of that JID. For the purpose of client authentication and authorization with a server, a valid XMPP address is a JID encapsulated as a subjectAltName entity of type otherName with an ASN.1 Object Identifier of "id-on-xmppAddr" as specified in Section 5.1.1. of <cite>RFC 3920</cite>.</p>
<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>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<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), then the server SHOULD allow authentication and authorization of the JID specified as the authorization identity.</p>
<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), then the server SHOULD allow authentication and authorization of the JID specified as the authorization identity in the SASL exchange.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
@ -205,18 +224,18 @@
]]></code>
</li>
<li>
<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 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>
<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>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
<p>If JID mapping is unsuccessful, then the server MUST return a SASL failure case of &lt;not-authorized/&gt; and close the stream.</p>
<p>If JID mapping is unsuccessful, then the server MUST return a SASL failure condition of &lt;not-authorized/&gt; and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
</failure>
</stream:stream>
]]></code>
<p>If JID mapping is successful but the mapped JID does not match the authorization identity provided (if any), then the server MUST return a SASL failure case of &lt;invalid-authzid/&gt; and close the stream.</p>
<p>If JID mapping is successful but the mapped JID does not match the authorization identity provided (if any), then the server MUST return a SASL failure condition of &lt;invalid-authzid/&gt; and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<invalid-authzid/>
@ -227,12 +246,12 @@
</ol>
</li>
<li>
<p>If SASL authentication succeeded, client opens new stream, then client and server proceed with resource binding as described in <cite>RFC 3920</cite>.</p>
<p>If SASL authentication succeeded, the client opens new stream, then client and server proceed with resource binding as described in <cite>RFC 3920</cite> and <cite>rfc3920bis</cite>.</p>
</li>
</ol>
</section1>
<section1 topic='Server-to-Server Recommendation' anchor='s2s'>
<p>As specified in <cite>RFC 3920</cite> and provisionally clarified in <cite>rfc3920bis</cite>, if a JabberID is included in an X.509 certificate, it MUST be encapsulated as an id-on-xmppAddr Object Identifier. Although it is not necessary for an X.509 certificate to include a JabberID, it is RECOMMENDED that server certificates include the id-on-xmppAddr OID encapsulating the JabberID of the bare XMPP server domain only (e.g., "example.org"). In addition, it is RECOMMENDED in the case of server certificates for the server's hostname to be encapsulated as a subjectAltName extension of type dNSName. Furthermore it is quite common for XMPP servers to also offer associated services as "subdomains" of the server; if a server offers such services then it is RECOMMENDED to either include an id-on-xmppAddr OID for each "subdomain" or to include a dnsName containing the wildcard character '*' applying to the left-most domain name component or component fragment (this is considered to match any single component or component fragment, e.g., *.example.org matches foo.example.org but not bar.foo.example.org, and im*.example.net matches im1.example.net and im2.example.net but not chat.example.net). This specification includes recommendations that address all three cases.</p>
<p><cite>RFC 3920</cite> specified that if a JabberID is included in a certificate intended for use by an XMPP server (here called a "domain certificate"), it shall be encapsulated as an xmppAddr. That recommendation is udpated in <cite>rfc3920bis</cite> through a reference to &certid;, 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.</p>
<p>The RECOMMENDED protocol flow for server-to-server use of SASL EXTERNAL with server (domain) certificates is as follows:</p>
<ol>
<li>
@ -259,7 +278,7 @@
]]></code>
</li>
<li>
<p>Server2 advertises TLS stream feature.</p>
<p>Server2 advertises TLS stream feature, which might indicate that TLS is mandatory-to-negotiate.</p>
<code><![CDATA[
<stream:features>
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
@ -281,16 +300,16 @@
]]></code>
</li>
<li>
<p>Server1 presents certificate.</p>
<p>Server1 presents its certificate during TLS negotiation.</p>
</li>
<li>
<p>Server2 validates certificate.</p>
<p>Server2 validates certificate in accordance with the rules from <cite>rfc3920bis</cite> and <cite>draft-saintandre-tls-server-id-check</cite>.</p>
<ol>
<li>
<p>If certificate is unacceptable (e.g., because the certificate is expired, not yet valid, or revoked), Server2 closes Server1's TCP connection.</p>
<p>If certificate is unacceptable for the reasons explained in <cite>rfc3920bis</cite> and <cite>draft-saintandre-tls-server-id-check</cite>, Server2 closes Server1's TCP connection.</p>
</li>
<li>
<p>Else Server2 completes successful TLS negotiation and Server1 initiates a new stream header to Server2.</p>
<p>Else Server2 completes successful TLS negotiation and Server1 sends a new initial stream header to Server2 over the encrypted TCP connection.</p>
<code><![CDATA[
<stream:stream
xmlns:stream='http://etherx.jabber.org/streams'
@ -315,7 +334,7 @@
]]></code>
</li>
<li>
<p>Server2 advertises SASL mechanisms. If Server2 expects that Server1 will be able to authenticate and authorize as the identity provided in the certificate that Server1 already provided (e.g., because the two servers share a common root certification authority, Server1's certificate has not been revoked, and the address provided in the 'from' address of Server1's initial stream header matches the authentication identity), then Server2 SHOULD advertize the SASL EXTERNAL mechanism.</p>
<p>Server2 advertises SASL mechanisms. If Server2 expects that Server1 will be able to authenticate and authorize as the identity provided in the certificate that Server1 already provided, then Server2 SHOULD advertise the SASL EXTERNAL mechanism.</p>
<code><![CDATA[
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
@ -326,7 +345,7 @@
]]></code>
</li>
<li>
<p>If Server2 advertizes SASL EXTERNAL, Server1 SHOULD consider EXTERNAL to be its preferred SASL mechanism. Server1 SHOULD include an authorization identity (base64-encoded as described in RFC 3920) as the XML character data of the &lt;auth/&gt; element, which SHOULD be the same as the 'from' address on the stream header it sent to Server2.</p>
<p>Server2 considers EXTERNAL to be its preferred SASL mechanism. Here it includes a base-64-encoded authorization identity as the XML character data of the &lt;auth/&gt; element, setting it to the same value as the 'from' address on the stream header it sent to Server2.</p>
<code><![CDATA[
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>Y29uZmVyZW5jZS5leGFtcGxlLm9yZwo=</auth>
]]></code>
@ -336,13 +355,13 @@
<p>Server2 determines if hostname is valid.</p>
<ol>
<li>
<p>If the authorization identity provided by Server1 matches one of the valid XMPP addresses in the certificate, Server2 SHOULD return success. For the purpose of server authentication with another server, a valid XMPP address is a JID encapsulated as a subjectAltName extension of type otherName with an ASN.1 Object Identifier of "id-on-xmppAddr" or a domain name (which MAY include the wildcard character '*') encapsulated as a subjectAltName extension of type dNSName.</p>
<p>If the authorization identity provided by Server1 can be matched against one of the identifiers provided in the certificate following the matching rules from <cite>draft-saintandre-tls-server-id-check</cite>, Server2 returns success.</p>
<code><![CDATA[
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
]]></code>
</li>
<li>
<p>Else server MUST return a &notauthorized; failure and close the stream.</p>
<p>Else server MUST return a &notauthorized; stream error and close the stream.</p>
<code><![CDATA[
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<not-authorized/>
@ -364,7 +383,7 @@
<p>This document requires no interaction with the &REGISTRAR;.</p>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Dave Cridland, Philipp Hancke, Joe Hildebrand, Justin Karneges, Rob Norris, and Matthias Wimmer for their comments.</p>
<p>Thanks to Dave Cridland, Philipp Hancke, Joe Hildebrand, Justin Karneges, Chris Newton, Rob Norris, and Matthias Wimmer for their comments.</p>
</section1>
<section1 topic='Author Note' anchor='authornote'>
<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>