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-0288.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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>Bidirectional Server-to-Server Connections</title>
  10. <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.</abstract>
  11. &LEGALNOTICE;
  12. <number>0288</number>
  13. <status>Draft</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XEP-0178</spec>
  20. <spec>XEP-0220</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>bidi</shortname>
  25. <schemaloc>
  26. <url>http://xmpp.org/schemas/bidi.xsd</url>
  27. </schemaloc>
  28. &fippo;
  29. &dcridland;
  30. <revision>
  31. <version>1.0.1</version>
  32. <date>2016-10-17</date>
  33. <initials>ssw</initials>
  34. <remark><p>Fix syntax highlighting and tweak example formatting.</p></remark>
  35. </revision>
  36. <revision>
  37. <version>1.0</version>
  38. <date>2013-09-26</date>
  39. <initials>psa</initials>
  40. <remark><p>Per a vote of the XMPP Council, advanced status to Draft.</p></remark>
  41. </revision>
  42. <revision>
  43. <version>0.5</version>
  44. <date>2012-08-21</date>
  45. <initials>ph/dwd</initials>
  46. <remark><p>Defined additional security considerations about the &quot;unsolicited dialback&quot; attack on bidirectional connections.</p></remark>
  47. </revision>
  48. <revision>
  49. <version>0.4</version>
  50. <date>2012-07-23</date>
  51. <initials>ph</initials>
  52. <remark><p>Added security note about dealing with unexpected &lt;db:result type='valid'/&gt; elements</p></remark>
  53. </revision>
  54. <revision>
  55. <version>0.3</version>
  56. <date>2012-03-07</date>
  57. <initials>ph</initials>
  58. <remark>
  59. <ul>
  60. <li>Fixed wrong from/to in example comment.</li><!-- Torje -->
  61. <li>Required support for dialback error handling if the connecting server uses bidi in combination with dialback</li>
  62. </ul>
  63. </remark>
  64. </revision>
  65. <revision>
  66. <version>0.2</version>
  67. <date>2011-12-12</date>
  68. <initials>ph</initials>
  69. <remark><p>Minor clarifications about the implications of bidi and dialback.</p></remark>
  70. </revision>
  71. <revision>
  72. <version>0.1</version>
  73. <date>2010-10-04</date>
  74. <initials>psa</initials>
  75. <remark><p>Initial published version.</p></remark>
  76. </revision>
  77. <revision>
  78. <version>0.0.2</version>
  79. <date>2010-09-13</date>
  80. <initials>dwd</initials>
  81. <remark>
  82. <p>belated run-over pre-publication</p>
  83. <p>Added notes on authentication</p>
  84. </remark>
  85. </revision>
  86. <revision>
  87. <version>0.0.1</version>
  88. <date>2010-04-12</date>
  89. <initials>ph</initials>
  90. <remark><p>initial version</p></remark>
  91. </revision>
  92. </header>
  93. <section1 topic='Introduction' anchor='intro'>
  94. <p>&rfc3920; restricted server-to-server communication in such a way that a server had to use one 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. &rfc6120; allows two servers to send stanzas in a bidirectional way, but does not define methods for explicitly signalling the usage thereof. This is accomplished herein.</p>
  95. <p>While this may seem like a mere optimization that decreases the number of sockets used by an implementation or increases the performance of the server-to-server connection<note>In constrained environments, bidirectional server-to-server connections exhibit a reduced packet round trip time, see &lt;<link url='http://www.isode.com/whitepapers/xmpp-performance-constrained.html'>http://www.isode.com/whitepapers/xmpp-performance-constrained.html</link>&gt;.</note>, it actually removes some of the practical barriers for the implementation of Multiplexing in &xep0220;.</p>
  96. </section1>
  97. <!--
  98. http://www.ietf.org/mail-archive/web/xmpp/current/msg00658.html
  99. http://www.ietf.org/mail-archive/web/xmpp/current/msg00664.html
  100. -->
  101. <section1 topic='Protocol' anchor='protocol'>
  102. <section2 topic='Stream Feature' anchor='feature'>
  103. <p>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 &lt;bidi/&gt; element qualified by the 'urn:xmpp:features:bidi' namespace.</p>
  104. <example caption="Stream features"><![CDATA[
  105. <stream:features>
  106. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  107. <bidi xmlns='urn:xmpp:features:bidi'/>
  108. </stream:features>
  109. ]]></example>
  110. <p>If the initiating entity chooses to use TLS, STARTTLS negotiation MUST be completed before enabling bidirectionality.</p>
  111. </section2>
  112. <section2 topic='Negotiation' anchor='nego'>
  113. <p>To enable bidirectional communication, the connecting server sends a &lt;bidi/&gt; element qualified by the 'urn:xmpp:bidi' namespace. This SHOULD be done before either SASL negotiation or Server Dialback.</p>
  114. <example caption="Connecting Server Requests Bidirectionality"><![CDATA[
  115. <!-- Client -->
  116. <bidi xmlns='urn:xmpp:bidi'/>
  117. ]]></example>
  118. <p>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.</p>
  119. <p>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 this is the inverse of any domain pair that has been used in a dialback request.</p>
  120. <p>Finally, once bidirectionality is enabled, the receiving server MAY initiate Server Dialback authentications for other domains it hosts to any domain authenticated to be hosted by the connecting server. In particular, it may initiate Target Piggybacking for any target domain that has successfully been used as a source domain by the connecting server. Note that this implies that a connecting server that uses bidi and dialback MUST support dialback error conditions as defined in XEP 0220<note>Ideally, support for dialback errors would be signalled by a proper extension mechanism such as &lt;stream:features/&gt;. However, these are currently only sent from the receiving server to the connecting server and can therefore not be used for signalling support for dialback errors in the other direction.</note>.</p>
  121. </section2>
  122. </section1>
  123. <section1 topic='Examples' anchor='examples'>
  124. <p>This section shows two complete examples of bidirectional streams, the first example uses SASL EXTERNAL, the second uses Server Dialback.</p>
  125. <example caption='Bidirectional Streams with SASL Authentication'><![CDATA[
  126. <!-- Client -->
  127. <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
  128. xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  129. to='montague.lit' from='capulet.lit'
  130. xml:lang='en' version='1.0'>
  131. <!-- Server -->
  132. <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  133. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
  134. id='65b30434afd7646699d077f7affcb2c120c48e18'
  135. from='montague.lit' to='capulet.lit' version='1.0'>
  136. <!-- Server -->
  137. <stream:features>
  138. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  139. <bidi xmlns='urn:xmpp:features:bidi'/>
  140. </stream:features>
  141. <!-- Client -->
  142. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  143. <!-- Server -->
  144. <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  145. <!-- Client -->
  146. <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
  147. xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  148. to='montague.lit' from='capulet.lit'
  149. xml:lang='en' version='1.0'>
  150. <!-- Server -->
  151. <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  152. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
  153. id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
  154. from='montague.lit' to='capulet.lit' version='1.0'>
  155. <stream:features>
  156. <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
  157. <mechanism>EXTERNAL<mechanism>
  158. </mechanisms>
  159. <bidi xmlns='urn:xmpp:features:bidi'/>
  160. </stream:features>
  161. <!-- Client -->
  162. <bidi xmlns='urn:xmpp:bidi'/>
  163. <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>
  164. Y2FwdWxldC5saXQ=
  165. </auth>
  166. <!-- Server -->
  167. <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  168. <!-- Client -->
  169. <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
  170. xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  171. to='montague.lit' from='capulet.lit'
  172. xml:lang='en' version='1.0'>
  173. <!-- Server -->
  174. <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  175. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
  176. id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
  177. from='montague.lit' to='capulet.lit' version='1.0'>
  178. <stream:features/>
  179. <!-- At this point, S is allowed to send C stanzas from montague.lit to capulet.lit
  180. since that is the value of 'from' in the stream open sent by C above.
  181. -->
  182. <!-- Client -->
  183. <iq from='juliet@capulet.lit/balcony' to='montague.lit' type='get'
  184. id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
  185. <!-- Server -->
  186. <iq from='montague.lit' to='juliet@capulet.lit/balcony' type='result'
  187. id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
  188. ]]></example>
  189. <example caption='Bidirectional Streams with Server Dialback'><![CDATA[
  190. <!-- Client -->
  191. <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
  192. xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  193. to='montague.lit' from='capulet.lit'
  194. xml:lang='en' version='1.0'>
  195. <!-- Server -->
  196. <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  197. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
  198. id='65b30434afd7646699d077f7affcb2c120c48e18'
  199. from='montague.lit' to='capulet.lit' version='1.0'>
  200. <stream:features>
  201. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  202. <bidi xmlns='urn:xmpp:features:bidi'/>
  203. </stream:features>
  204. <!-- Client -->
  205. <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  206. <!-- Server -->
  207. <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  208. <!-- Client -->
  209. <stream:stream xmlns:stream='http://etherx.jabber.org/streams'
  210. xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  211. to='montague.lit' from='capulet.lit'
  212. xml:lang='en' version='1.0'>
  213. <!-- Server -->
  214. <stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback'
  215. xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en'
  216. id='b5cd769b1dc292c6f6557fe76cabc4d112333f9a'
  217. from='montague.lit' to='capulet.lit' version='1.0'>
  218. <stream:features>
  219. <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
  220. <bidi xmlns='urn:xmpp:features:bidi'/>
  221. </stream:features>
  222. ]]></example>
  223. <example caption="Stream Setup before TLS"><![CDATA[
  224. <!-- Client -->
  225. <bidi xmlns='urn:xmpp:bidi'/>
  226. <db:result from='capulet.lit' to='montague.lit'>
  227. e3f5cf21f12749ef2cf59269bc0118f35bc46b26</db:result>
  228. <!-- Server -->
  229. <db:result from='montague.lit' to='capulet.lit' type='valid'/>
  230. <!-- At this point S may send from montague.lit to capulet.lit.-->
  231. <!-- Client -->
  232. <iq from='juliet@capulet.lit/balcony' to='montague.lit' type='get'
  233. id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
  234. <!-- Server -->
  235. <iq from='montague.lit' to='juliet@capulet.lit/balcony' type='result'
  236. id='8dfc70af'><query xmlns='urn:xmpp:ping'/></iq>
  237. <db:result from='conference.montague.lit' to='capulet.lit'>
  238. 1bac3ef56fed987cfe098c9785c654a5476ed765</db:result>
  239. <!-- The above is also legal - S attempts to authenticate as
  240. a different domain as well, presumably a MUC domain.
  241. note that S can do this form of multiplexing regardless
  242. of the support for dialback errors since that was required by RFC 3920
  243. -->
  244. <!-- Client -->
  245. <db:result from='capulet.lit' to='conference.montague.lit' type='valid'/>
  246. <!-- Now S can send as conference.m.l as well as C sending to that domain.
  247. -->
  248. ]]></example>
  249. </section1>
  250. <section1 topic='Security Considerations' anchor='security'>
  251. <p>This specification introduces no security considerations above and beyond those discussed in <cite>RFC 6120</cite> or <cite>XEP-0220</cite>.
  252. <!-- one might explain why not... http://mail.jabber.org/pipermail/xmppwg/2004-February/002026.html -->
  253. Note that the impact of the &quot;unsolicited server dialback&quot; attack described in <cite>XEP-0220</cite> is considerably larger for bidirectional streams, e.g. a vulnerability which allows spoofing might also route messages to the wrong targets. Additionally, dialback elements with a &quot;type&quot; attribute also need to be handled in incoming connections.</p>
  254. </section1>
  255. <section1 topic='IANA Considerations' anchor='iana'>
  256. <p>This document requires no interaction with &IANA;.</p>
  257. </section1>
  258. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  259. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  260. <p>The &REGISTRAR; includes 'urn:xmpp:bidi' in its registry of protocol namespaces (see &NAMESPACES;).</p>
  261. </section2>
  262. <section2 topic='Stream Features' anchor='registrar-stream'>
  263. <p>The XMPP Registrar includes 'urn:xmpp:features:bidi' in its registry of stream features (see &STREAMFEATURES;).</p>
  264. </section2>
  265. </section1>
  266. <section1 topic='XML Schema' anchor='schema'>
  267. <section2 topic="Bidi" anchor="schema-bidi">
  268. <code><![CDATA[
  269. <?xml version='1.0' encoding='UTF-8'?>
  270. <xs:schema
  271. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  272. targetNamespace='urn:xmpp:bidi'
  273. xmlns='urn:xmpp:bidi'
  274. elementFormDefault='qualified'>
  275. <xs:annotation>
  276. <xs:documentation>
  277. The protocol documented by this schema is defined in
  278. XEP-0288: http://www.xmpp.org/extensions/xep-0288.html
  279. </xs:documentation>
  280. </xs:annotation>
  281. <xs:element name='bidi' type='empty'/>
  282. <xs:simpleType name='empty'>
  283. <xs:restriction base='xs:string'>
  284. <xs:enumeration value=''/>
  285. </xs:restriction>
  286. </xs:simpleType>
  287. </xs:schema>
  288. ]]></code>
  289. </section2>
  290. <section2 topic="Stream Feature" anchor="schema-feature">
  291. <code><![CDATA[
  292. <?xml version='1.0' encoding='UTF-8'?>
  293. <xs:schema
  294. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  295. targetNamespace='urn:xmpp:features:bidi'
  296. xmlns='urn:xmpp:features:bidi'
  297. elementFormDefault='qualified'>
  298. <xs:element name='bidi' type='empty'/>
  299. <xs:simpleType name='empty'>
  300. <xs:restriction base='xs:string'>
  301. <xs:enumeration value=''/>
  302. </xs:restriction>
  303. </xs:simpleType>
  304. </xs:schema>
  305. ]]></code>
  306. </section2>
  307. </section1>
  308. <section1 topic='Acknowledgements' anchor='ack'>
  309. <p>Thanks to Justin Karneges and Torje Henriksen.</p>
  310. </section1>
  311. </xep>