XEP-xxxx: Bidirectional Server-to-Server Connections

Abstract
This specification defines a protocol for using server-to-server connections in a bidirectional way such that stanzas are sent and received on the same TCP connection.
Authors
  • Philipp Hancke
  • Dave Cridland
Copyright
© 2010 – 2010 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <https://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.2 (2010-09-13)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

RFC 3920 [1] restricts server-to-server communication in such a way that a server has to use on TCP connection for XML stanzas sent from the server to the peer and another TCP connection (initiated by the peer) for stanzas from the peer to the server, for a total of two TCP connections. rfc3920bis [2] allows two servers to send stanzas in a bidirectional way, but does not define methods for explicitly signalling the usage thereof. This is accomplished in this specification.

2. Protocol

2.1 Stream Feature

If a server supports bidirectional server-to-server streams, it should inform the connecting entity when returning stream features during the stream negotiation process (both before and after TLS negotiation). This is done by including a <bidi/> element qualified by the 'urn:xmpp:features:bidi' namespace.

Example 1. Stream features
<stream:features>
  <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  <bidi xmlns='urn:xmpp:features:bidi'/>
</stream:features>

If the initiating entity chooses to use TLS, STARTTLS negotiation MUST be completed before enabling bidirectionality.

2.2 Negotiation

To enable bidirectional communication, the connecting server sends a <bidi/> element qualified by the 'urn:xmpp:bidi' namespace. This SHOULD be done before either SASL negotiation or Server Dialback (XEP-0220) [3].

Example 2. Connecting Server Requests Bidirectionality
C: <bidi xmlns='urn:xmpp:bidi'/>

Note: Since there is no reply to the request, it is possible to pipeline it.

After enabling bidirectionality, the connecting server continues to authenticate via SASL or requests to send stanzas for a domain pair with Server Dialback. The receiving server MUST NOT send stanzas to the peer before it has authenticated via SASL, or the peer's identity has been verified via Server Dialback. Note that the receiving server MUST NOT attempt to verify a dialback key on the same connection where the corresponding request was issued.

Also note that the receiving server MUST only send stanzas for which it has been authenticated - in the case of TLS/SASL based authentication, this is the value of the stream's 'to' attribute, whereas in the case of Server Dialback (XEP-0220) [3] this is the value of the 'to' attribute on any <db:result> element.

Finally, once bidirectionality is enabled, the receiving server MAY initiate Server Dialback (XEP-0220) [3] authentications for other domains it hosts to any domain authenticated to be hosted by the connecting server.

3. Examples

This section shows two complete examples of bidirectional streams, the first example uses SASL EXTERNAL, the second uses Server Dialback.

Example 3. Bidirectional Streams with SASL Authentication
C: <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
	xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	to='montague.lit' from='capulet.lit'
	xml:lang='en' version='1.0'>
S: <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
	id='65b30434afd7646699d077f7affcb2c120c48e18'
	from='montague.lit' to='capulet.lit' version='1.0'>
S: <stream:features>
     <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
     <bidi xmlns='urn:xmpp:bidi'/>
   </stream:features>
C: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
S: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
C: <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
	xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	to='montague.lit' from='capulet.lit'
	xml:lang='en' version='1.0'>
S: <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
	id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
	from='montague.lit' to='capulet.lit' version='1.0'>
S: <stream:features>
     <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
       <mechanism>EXTERNAL<mechanism>
     </mechanisms>
     <bidi xmlns='urn:xmpp:bidi'/>
   </stream:features>
C: <bidi xmlns='urn:xmpp:bidi'/>
   <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>
     Y2FwdWxldC5saXQ=</auth>
S: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
C: <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
	xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	to='montague.lit' from='capulet.lit'
	xml:lang='en' version='1.0'>
S: <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
	id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
	from='montague.lit' to='capulet.lit' version='1.0'>
S: <stream:features/>
   <!-- At this point, S is allowed to send C stanzas from capulet.lit
        since that is the value of 'to' in the stream open sent by C above.
     -->
C: <iq from='juliet@capulet.lit/balcony' to='montague.lit' type='get'
     id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
S: <iq from='montague.lit' to='juliet@capulet.lit/balcony' type='result'
     id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
Example 4. Bidirectional Streams with Server Dialback
C: <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
	xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	to='montague.lit' from='capulet.lit'
	xml:lang='en' version='1.0'>
S: <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
	id='65b30434afd7646699d077f7affcb2c120c48e18'
	from='montague.lit' to='capulet.lit' version='1.0'>
S: <stream:features>
     <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
     <bidi xmlns='urn:xmpp:bidi'/>
   </stream:features>
C: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
S: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
C: <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
	xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	to='montague.lit' from='capulet.lit'
	xml:lang='en' version='1.0'>
S: <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
	xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
	id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
	from='montague.lit' to='capulet.lit' version='1.0'>
S: <stream:features>
     <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
     <bidi xmlns='urn:xmpp:bidi'/>
   </stream:features>
    <example caption="Stream Setup before TLS"><![CDATA[
C: <bidi xmlns='urn:xmpp:bidi'/>
   <db:result from='capulet.lit' to='montague.lit'>
	e3f5cf21f12749ef2cf59269bc0118f35bc46b26</db:result>
   <!-- At this point S may send from capulet.lit.
     -->
S: <db:result from='montague.lit' to='capulet.lit' type='valid'/>
C: <iq from='juliet@capulet.lit/balcony' to='montague.lit' type='get'
     id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
S: <iq from='montague.lit' to='juliet@capulet.lit/balcony' type='result'
     id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
S: <db:result from='conference.montague.lit' to='capulet.lit'>
        1bac3ef56fed987cfe098c9785c654a5476ed765</db:result>
   <!-- The above is also legal - S attempts to authenticate as
        a different domain as well, presumably a MUC domain
     -->
C: <db:result from='capulet.lit' to='conference.montague.lit' type='valid'/>
   <!-- Now S can send as conference.m.l as well as C sending to that domain.
     -->

4. Security Considerations

This specification introduces no security considerations above and beyond those discussed in RFC 3920.

5. XMPP Registrar Considerations

5.1 Protocol Namespaces

5.2 Stream Features

6. IANA Considerations

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


Appendices

Appendix A: Document Information

Series
XEP
Number
xxxx
Publisher
XMPP Standards Foundation
Status
ProtoXEP
Type
Standards Track
Version
0.0.2
Last Updated
2010-09-13
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0178, XEP-0220
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED

This document in other formats: XML  PDF

Appendix B: Author Information

Philipp Hancke
JabberID
fippo@ve.symlynx.com
Dave Cridland
Email
dave.cridland@isode.com
JabberID
dave.cridland@isode.com

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards 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 document 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.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

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

Appendix G: Notes

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

2. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/draft-ietf-saintandre-rfc3920bis>.

3. XEP-0220: Server Dialback <https://xmpp.org/extensions/xep-0220.html>.

4. 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/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.0.2 (2010-09-13)

    belated run-over pre-publication

    Added notes on authentication

    dwd
  2. Version 0.0.1 (2010-04-12)

    initial version

    ph

Appendix I: Bib(La)TeX Entry

@report{hancke2010xepxxxx,
  title = {Bidirectional Server-to-Server Connections},
  author = {Hancke, Philipp and Cridland, Dave},
  type = {XEP},
  number = {xxxx},
  version = {0.0.2},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-xxxx.html},
  date = {2010-04-12/2010-09-13},
}

END