JEP-0178: Best Practices for Use of SASL EXTERNAL

This document specifies best practices for use of the SASL EXTERNAL mechanism within XMPP.


WARNING: This Informational JEP is Experimental. Publication as a Jabber Enhancement Proposal does not imply approval of this proposal by the Jabber Software Foundation. Implementation of the best practice or protocol profile described herein is encouraged in exploratory implementations, although production systems should not deploy implementations of this protocol until it advances to a status of Draft.


JEP Information

Status: Experimental
Type: Informational
Number: 0178
Version: 0.1
Last Updated: 2006-03-09
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: N/A
Wiki Page: <http://wiki.jabber.org/index.php/Best Practices for Use of SASL EXTERNAL (JEP-0178)>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JID: stpeter@jabber.org

Peter Millard

See Author Note

Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2006 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this JEP has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.


Table of Contents

1. Introduction
2. Client-to-Server Recommendation
3. Server-to-Server Recommendation
4. Security Considerations
5. IANA Considerations
6. Jabber Registrar Considerations
7. Author Note
Notes
Revision History


1. Introduction

RFC 3920 [1] allows the use of any SASL mechanism (see RFC 2222 [2]) in XMPP authentication, including the SASL EXTERNAL mechanism. This document specifies a recommended protocol flow for such use.

Note: This document is provided for discussion purposes in order to clarify the usage of SASL EXTERNAL in XMPP systems. It is not meant to supersede the text in RFC 3920 or RFC 2222. However, the recommendations in this document may be folded into rfc3920bis when that document is written.

2. Client-to-Server Recommendation

The RECOMMENDED protocol flow for client-to-server use of SASL EXTERNAL is as follows:

  1. Client initiates stream to server.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:client' 
            to='example.com' 
            version='1.0'>
          
  2. Server replies with stream header.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:client' 
            id='c2s_234' 
            from='example.com' 
            version='1.0'>
          
  3. Server advertises TLS stream feature.

    <stream:features>
      <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        <required/>
      </starttls>
    </stream:features>
          
  4. Client sends STARTTLS command to server.

    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
          
  5. Server informs client to proceed.

    <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
          
  6. Client presents certificate.

  7. Server validates certificate.

    1. If certification authority is not recognized or certificate has been revoked, server closes client's TCP connection.

    2. Else server completes successful TLS negotiation and client initiates a new stream header to server.

      <stream:stream 
              xmlns:stream='http://etherx.jabber.org/streams' 
              xmlns='jabber:client' 
              to='example.com' 
              version='1.0'>
                
  8. Server replies with stream header.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:client' 
            id='c2s_345' 
            from='example.com' 
            version='1.0'>
          
  9. Server advertises SASL mechanisms. Because client presented a certificate, server advertises SASL EXTERNAL mechanism.

    <stream:features>
      <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism>DIGEST-MD5<mechanism>
        <mechanism>EXTERNAL<mechanism>
        <mechanism>ANONYMOUS<mechanism>
      </mechanisms>
    </stream:features>
          
  10. Because client presented a certificate, client SHOULD consider EXTERNAL to be its preferred SASL mechanism. The client SHOULD NOT include an authorization identity (i.e., XML character data for the <auth/> element) since client-to-server authorization in XMPP is handled during resource binding.

    <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'/>
          
  11. Server sends <success/>.

    <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
          
  12. Client opens new stream.

    <stream:stream
            xmlns:stream='http://etherx.jabber.org/streams'
            xmlns='jabber:client'
            to='example.com'
            version='1.0'>
          
  13. Server replies with stream header.

    <stream:stream
            xmlns:stream='http://etherx.jabber.org/streams'
            xmlns='jabber:client'
            id='c2s_345'
            from='example.com'
            version='1.0'>
          
  14. Server tells client that resource binding is required.

    <stream:features>
      <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
    </stream:features>
          
  15. Client binds a resource (or requests that server create a resource for it).

    <iq type='set' id='bind_1'>
      <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
        <resource>someresource</resource>
      </bind>
    </iq>
          
  16. Server determines the authorized JID of the user. [3]

    1. If the certificate presented by the client contains only one valid XMPP address [4] that corresponds to a registered account on the server, the server SHOULD use that address as the user's authorized JID for the purpose of resource binding, add the requested resource (or create a resource if no resource was requested), and return the result as the user's authorized full JID (<node@domain.tld/resource>) for purposes of resource binding.

      <iq type='result' id='bind_1'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>somenode@example.com/someresource</jid>
        </bind>
      </iq>
                
    2. 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), the server SHOULD use the JID whose hostname matches the 'to' address of the stream header sent by the client to the server, add the requested resource (or create a resource if no resource was requested), and return the result as the user's authorized full JID (<node@domain.tld/resource>) for purposes of resource binding.

    3. If the certificate does not contain a valid XMPP address that corresponds to a registered account on the server, 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, the server SHOULD use that mapped JID as the user's authorized JID, add the requested resource (or create a resource if no resource was requested), and return the result as the user's authorized full JID (<node@domain.tld/resource>) for purposes of resource binding.

    4. If the user cannot be associated with an account registered on the server, the server MUST return a resource binding error, which SHOULD be <not-authorized/>.

      <iq type='error' id='bind_1'>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
          <jid>someresource</jid>
        </bind>
        <error type='cancel'>
          <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>
                

3. Server-to-Server Recommendation

The RECOMMENDED protocol flow for server-to-server use of SASL EXTERNAL is as follows:

  1. Server1 initiates stream to server2.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:server' 
            from='conference.example.org' 
            to='example.com' 
            version='1.0'>
          
  2. Server2 replies with stream header.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:server' 
            id='s2s_234' 
            from='example.com' 
            to='conference.example.org'
            version='1.0'>
          
  3. Server2 advertises TLS stream feature.

    <stream:features>
      <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
        <required/>
      </starttls>
    </stream:features>
          
  4. Server1 sends STARTTLS command to Server2.

    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
          
  5. Server2 informs Server1 to proceed.

    <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
          
  6. Server1 presents certificate.

  7. Server2 validates certificate.

    1. If certificate has been revoked, Server2 closes Server1's TCP connection.

    2. Else Server2 completes successful TLS negotiation and Server1 initiates a new stream header to Server2.

      <stream:stream 
              xmlns:stream='http://etherx.jabber.org/streams' 
              xmlns='jabber:server' 
              from='conference.example.org'
              to='example.com' 
              version='1.0'>
                
  8. Server2 replies with stream header.

    <stream:stream 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmlns='jabber:server' 
            id='s2s_345' 
            from='example.com' 
            to='conference.example.org'
            version='1.0'>
          
  9. Server2 advertises SASL mechanisms. Because Server1 presented a certificate, Server2 advertises SASL EXTERNAL mechanism.

    <stream:features>
      <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism>EXTERNAL<mechanism>
      </mechanisms>
    </stream:features>
          
  10. Because Server1 presented a certificate, Server1 SHOULD consider EXTERNAL to be its preferred SASL mechanism. Server1 SHOULD include an authorization identity (base64-encoded according as described in RFC 3920) as the XML character data of the <auth/> element, which SHOULD be the same as the 'from' address on the stream header.

    <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>Y29uZmVyZW5jZS5leGFtcGxlLm9yZwo=</auth>
          

    (In this case, the authorization identity is "conference.example.org".)

  11. Server2 determines if hostname is valid.

    1. If the authorization identity provided by Server1 matches one of the valid XMPP addresses in the certificate or one of the Common Names in the certificates, Server2 SHOULD return success.

      <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
                
    2. Else server MUST return a <not-authorized/> failure and close the stream.

      <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <not-authorized/>
      </failure>
      </stream:stream>
                

4. Security Considerations

This JEP introduces no security considerations or concerns above and beyond those discussed in RFC 3920.

5. IANA Considerations

This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [5].

6. Jabber Registrar Considerations

This JEP requires no interaction with the Jabber Registrar [6].

7. Author Note

Peter Millard, a co-author of this specification through version 0.1, died on April 26, 2006.


Notes

1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.

2. RFC 2222: Simple Authentication and Security Layer (SASL) <http://www.ietf.org/rfc/rfc2222.txt>.

3. Although TLS and SASL EXTERNAL result in an authenticated user, the server now needs to determine which JID the user is authorized to use.

4. A valid XMPP address is a JID encapsulated as a subjectAltName with an ASN.1 Object Identifier of "id-on-xmppAddr" (which is equivalent to the dotted display format of "1.3.6.1.5.5.7.8.5").

5. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

6. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.


Revision History

Version 0.1 (2006-03-09)

Initial JEP version.

(psa)

Version 0.0.3 (2006-02-10)

Specified inclusion of authorization identity for server-to-server.

(psa/pgm)

Version 0.0.2 (2006-02-10)

Clarified distinction between authentication and authorization.

(psa/pgm)

Version 0.0.1 (2006-02-09)

First draft.

(psa/pgm)


END