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-0003.xml 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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>Proxy Accept Socket Service (PASS)</title>
  10. <abstract>This document defines a method for relaying media via proxies on the Jabber/XMPP network.</abstract>
  11. &LEGALNOTICE;
  12. <number>0003</number>
  13. <status>Obsolete</status>
  14. <type>Historical</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. </dependencies>
  19. <supersedes/>
  20. <supersededby/>
  21. <shortname>pass</shortname>
  22. <schemaloc>
  23. <url>http://www.xmpp.org/schemas/pass.xsd</url>
  24. </schemaloc>
  25. &jer;
  26. &reatmon;
  27. <revision>
  28. <version>1.4</version>
  29. <date>2009-06-03</date>
  30. <initials>psa</initials>
  31. <remark><p>Per a vote of the XMPP Council, changed status to Obsolete.</p></remark>
  32. </revision>
  33. <revision>
  34. <version>1.3</version>
  35. <date>2007-01-17</date>
  36. <initials>psa</initials>
  37. <remark><p>Per a vote of the XMPP Council, changed status to Deprecated.</p></remark>
  38. </revision>
  39. <revision>
  40. <version>1.2</version>
  41. <date>2004-01-22</date>
  42. <initials>psa</initials>
  43. <remark><p>Editorial revisions.</p></remark>
  44. </revision>
  45. <revision>
  46. <version>1.1</version>
  47. <date>2004-01-06</date>
  48. <initials>psa</initials>
  49. <remark><p>Added XML schema.</p></remark>
  50. </revision>
  51. <revision>
  52. <version>1.0</version>
  53. <date>2002-10-15</date>
  54. <initials>psa</initials>
  55. <remark><p>Changed status to Active.</p></remark>
  56. </revision>
  57. <revision>
  58. <version>0.4</version>
  59. <date>2001-07-02</date>
  60. <initials>rwe</initials>
  61. <remark><p>Error codes update</p></remark>
  62. </revision>
  63. <revision>
  64. <version>0.3</version>
  65. <date>2001-06-29</date>
  66. <initials>rwe</initials>
  67. <remark><p>Protocol update</p></remark>
  68. </revision>
  69. <revision>
  70. <version>0.2</version>
  71. <date>2001-06-28</date>
  72. <initials>psa</initials>
  73. <remark><p>DocBook version</p></remark>
  74. </revision>
  75. <revision>
  76. <version>0.1</version>
  77. <date>2001-06-01</date>
  78. <initials>jer</initials>
  79. <remark><p>Initial release</p></remark>
  80. </revision>
  81. </header>
  82. <section1 topic='Introduction'>
  83. <p>Complete direct client-to-client file transfers presents a major problem for clients that are behind a firewall or NAT. Proxy Accept Socket Service (PASS) enables clients to do real-time file transfers via a third party; in addition, it does not limit clients to file transfers but enables any two clients to create a raw TCP socket between them for any purpose, such as VoIP (SIP/RTP), BEEP, or binary game data.</p>
  84. </section1>
  85. <section1 topic='Registration/Setup'>
  86. <p>The first step is to communicate with a PASS service to set it up.</p>
  87. <example caption='Registration request'><![CDATA[
  88. <iq id='pass1' type='set' to='pass.jabber.org'>
  89. <query xmlns='jabber:iq:pass'>
  90. <expire>600</expire>
  91. </query>
  92. </iq>
  93. ]]></example>
  94. <example caption='Result from PASS Service'><![CDATA[
  95. <iq id='pass1' type='result' from='pass.jabber.org'>
  96. <query xmlns='jabber:iq:pass'>
  97. <server port='43253'>1.2.3.4</server>
  98. </query>
  99. </iq>
  100. ]]></example>
  101. <p>At this point, the PASS service is now listening on the given IP and port for incoming connections on behalf of the Jabber Entity. The provided IP and port can now be sent to any other entity as a connection point, for file transfers or any other use.</p>
  102. <p>The default behavior for the PASS service is to listen on the port forever, unless the requesting client specifies an &lt;expire/&gt; value (in seconds). If the service is not configured with an expire value, it will not timeout the connection, and will start listening on the port again after one of the two sides disconnects.</p>
  103. <table caption='Error Codes'>
  104. <tr>
  105. <th>Code</th>
  106. <th>Message</th>
  107. <th>Cause</th>
  108. </tr>
  109. <tr>
  110. <td>502</td>
  111. <td>No more ports available. Try again later.</td>
  112. <td>The PASS service is listening on all of its available ports.</td>
  113. </tr>
  114. </table>
  115. </section1>
  116. <section1 topic='Incoming Connections'>
  117. <p>When an incoming connection is attempted to that IP and port, the PASS service MUST send an IQ request to the entity on whose behalf it is listening:</p>
  118. <example caption='Request to entity'><![CDATA[
  119. <iq type='set'
  120. id='pass2'
  121. to='user@jabber.org/resource'
  122. from='pass.jabber.org'>
  123. <query xmlns='jabber:iq:pass'>
  124. <client port='1234'>4.3.2.1</client>
  125. <proxy port='43523'>1.2.3.4</proxy>
  126. </query>
  127. </iq>
  128. ]]></example>
  129. <example caption='IQ result to accept connection'><![CDATA[
  130. <iq type='result'
  131. id='pass2'
  132. from='user@jabber.org/resource'
  133. to='pass.jabber.org'>
  134. <query xmlns='jabber:iq:pass'/>
  135. </iq>
  136. ]]></example>
  137. <p>The entity SHOULD now immediately connect to the given proxy IP and port, and upon connection all data written to that socket will be copied to the client connection, and vice-versa. Any disconnect on either side MUST cause a disconnect on the other (initiated by the service). If the IQ set to the entity fails or returns an error, the client socket MUST be dropped as well. The client XML element provides the information about the remote end of the incoming socket.</p>
  138. <p>Abuse in bandwidth or resources could become an issue, so PASS implementations SHOULD include strict and detailed rate and usage limits, allowing only limited usage by single entities and rate-limiting bandwidth used if necessary for both single connections or overall usage. These limits are implementation-specific.</p>
  139. </section1>
  140. <section1 topic='Controls'>
  141. <p>A Jabber client can send various controls to the PASS service via the set to control how the PASS service behaves, how the server handles a listening port.</p>
  142. <section2 topic='expire'>
  143. <p>This tells the server to shut down the port after a specified number of seconds. After the timeout period, the PASS service MUST send an &lt;iq/&gt; to the JID to tell it that the port has been closed down. It notifies the client with:</p>
  144. <example caption='Notification of expiration'><![CDATA[
  145. <iq type='set'
  146. id='pass3'
  147. to='user@jabber.org/resource'
  148. from='pass.jabber.org'>
  149. <query xmlns='jabber:iq:pass'>
  150. <expire/>
  151. <close/>
  152. <proxy port='43253'>1.2.3.4</proxy>
  153. </query>
  154. </iq>
  155. ]]></example>
  156. <example caption='Acknowledgement of expiration'><![CDATA[
  157. <iq type='result'
  158. id='pass3'
  159. from='user@jabber.org/resource'
  160. to='pass.jabber.org'>
  161. <query xmlns='jabber:iq:pass'/>
  162. </iq>
  163. ]]></example>
  164. </section2>
  165. <section2 topic='oneshot'>
  166. <p>This tells the server to listen once, and then close the port. Even if the &lt;expire/&gt; has not been met, the &lt;oneshot/&gt; overrides that and shuts down the listening port. When this happens the server notifies the client with the following packet:</p>
  167. <example caption='Server notifies client of oneshot port closing'><![CDATA[
  168. <iq type='set'
  169. id='pass4'
  170. to='user@jabber.org/resource'
  171. from='pass.jabber.org'>
  172. <query xmlns='jabber:iq:pass'>
  173. <oneshot/>
  174. <close/>
  175. <proxy port='43253'>1.2.3.4</proxy>
  176. </query>
  177. </iq>
  178. ]]></example>
  179. <example caption='Client acknowledges closing of oneshot port'><![CDATA[
  180. <iq type='result'
  181. id='pass4'
  182. from='user@jabber.org/resource'
  183. to='pass.jabber.org'>
  184. <query xmlns='jabber:iq:pass'/>
  185. </iq>
  186. ]]></example>
  187. </section2>
  188. <section2 topic='close'>
  189. <p>This tells the server to explicitly shut down a listening port. Useful for when the client shuts down and can tell the PASS service to recycle the port. The server sends back:</p>
  190. <example caption='Client request to shut down port'><![CDATA[
  191. <iq type='set'
  192. id='pass5'
  193. to='pass.jabber.org'
  194. from='user@jabber.org/resource'>
  195. <query xmlns='jabber:iq:pass'>
  196. <close/>
  197. <proxy port='43253'>1.2.3.4</proxy>
  198. </query>
  199. </iq>
  200. ]]></example>
  201. <example caption='Server acknowledges port closing request'><![CDATA[
  202. <iq type='result'
  203. id='pass5'
  204. to='user@jabber.org/resource'
  205. from='pass.jabber.org'>
  206. <query xmlns='jabber:iq:pass'/>
  207. </iq>
  208. ]]></example>
  209. <table caption='Error Codes'>
  210. <tr>
  211. <th>Code</th>
  212. <th>Message</th>
  213. <th>Cause</th>
  214. </tr>
  215. <tr>
  216. <td>400</td>
  217. <td>Missing &lt;proxy/&gt; specification.</td>
  218. <td>Sent a &lt;close/&gt; w/o a &lt;proxy/&gt;</td>
  219. </tr>
  220. <tr>
  221. <td>401</td>
  222. <td>Port not registered to your JID.</td>
  223. <td>You did not register this port with the server.</td>
  224. </tr>
  225. <tr>
  226. <td>404</td>
  227. <td>Port not found in registry.</td>
  228. <td>The &lt;proxy port=''/&gt; was not a defined port.</td>
  229. </tr>
  230. <tr>
  231. <td>405</td>
  232. <td>Proxy IP does not match.</td>
  233. <td>The IP sent in the &lt;proxy/&gt; does not match the IP of the pass-service</td>
  234. </tr>
  235. </table>
  236. </section2>
  237. </section1>
  238. <section1 topic='Security Considerations'>
  239. <section2 topic='Client Authentication'>
  240. <p>The PASS protocol can be used for clients to talk to each other and find out information about each other. When a client wants to send a file to another client, it can use the jabber:iq:pass namespace to query the IP address of the other client. For example:</p>
  241. <p>You send the other client:</p>
  242. <example><![CDATA[
  243. <iq type='get'
  244. id='pass6'
  245. to='them@jabber.org/resource'
  246. from='you@jabber.org/resource'>
  247. <query xmlns='jabber:iq:pass'/>
  248. </iq>
  249. ]]></example>
  250. <p>The other client SHOULD send back:</p>
  251. <example><![CDATA[
  252. <iq type='result'
  253. id='pass6'
  254. to='you@jabber.org/resource'
  255. from='them@jabber.org/resource'>
  256. <query xmlns='jabber:iq:pass'>
  257. <client>4.3.2.1</client>
  258. </query>
  259. </iq>
  260. ]]></example>
  261. <p>Obviously the port is not going to be known, but the IP address will let you authenticate the JID via the PASS service since the PASS service tells you the &lt;client/&gt; information upon a connection.</p>
  262. </section2>
  263. <section2 topic='Denying a Connection'>
  264. <p>When a server gets an Incoming Connection notification the client has the right to deny that connection based on the &lt;client/&gt; information that it receives. It can return an error to the PASS service specifying the &lt;proxy/&gt; port and hangup on the active &lt;client/&gt; connection and start listening again. This does not affect the &lt;oneshot/&gt; control. For example:</p>
  265. <p>The PASS service sends you:</p>
  266. <example><![CDATA[
  267. <iq type='set'
  268. id='pass7'
  269. to='user@jabber.org/resource'
  270. from='pass.jabber.org'>
  271. <query xmlns='jabber:iq:pass'>
  272. <client port='1234'>4.3.2.1</client>
  273. <proxy port='43523'>1.2.3.4</proxy>
  274. </query>
  275. </iq>
  276. ]]></example>
  277. <p>Your client would send back:</p>
  278. <example><![CDATA[
  279. <iq type='error'
  280. id='pass7'
  281. to='pass.jabber.org'
  282. from='user@jabber.org/resource'>
  283. <query xmlns='jabber:iq:pass'>
  284. <client port='1234'>4.3.2.1</client>
  285. <proxy port='43523'>1.2.3.4</proxy>
  286. </query>
  287. <error code='401' type='auth'>
  288. <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  289. </error>
  290. </iq>
  291. ]]></example>
  292. <table caption='Error Codes'>
  293. <tr>
  294. <th>Code</th>
  295. <th>Message</th>
  296. <th>Cause</th>
  297. </tr>
  298. <tr>
  299. <td>401</td>
  300. <td>Unauthorized</td>
  301. <td>The incoming &lt;client/&gt; does not match the &lt;client/&gt; from the client you want to exchange data with.</td>
  302. </tr>
  303. </table>
  304. </section2>
  305. </section1>
  306. <section1 topic='IANA Considerations'>
  307. <p>This document requires no interaction with &IANA;.</p>
  308. </section1>
  309. <section1 topic='XMPP Registrar Considerations'>
  310. <p>No action on the part of the &REGISTRAR; is necessary as a result of this document, since 'jabber:iq:pass' is already a registered protocol namespace.</p>
  311. </section1>
  312. <section1 topic='XML Schema'>
  313. <code><![CDATA[
  314. <?xml version='1.0' encoding='UTF-8'?>
  315. <xs:schema
  316. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  317. targetNamespace='jabber:iq:pass'
  318. xmlns='jabber:iq:pass'
  319. elementFormDefault='qualified'>
  320. <xs:annotation>
  321. <xs:documentation>
  322. The protocol documented by this schema is defined in
  323. XEP-0003: http://www.xmpp.org/extensions/xep-0003.html
  324. </xs:documentation>
  325. </xs:annotation>
  326. <xs:element name='query'>
  327. <xs:complexType>
  328. <xs:choice minOccurs='0' maxOccurs='unbounded'>
  329. <xs:element name='client' type='PassEntity'/>
  330. <xs:element name='close' type='empty'/>
  331. <xs:element name='expire' type='xs:unsignedLong'/>
  332. <xs:element name='oneshot' type='empty'/>
  333. <xs:element name='proxy' type='PassEntity'/>
  334. <xs:element name='server' type='PassEntity'/>
  335. </xs:choice>
  336. </xs:complexType>
  337. </xs:element>
  338. <xs:complexType name='PassEntity'>
  339. <xs:simpleContent>
  340. <xs:extension base='xs:NMTOKEN'>
  341. <xs:attribute name='port' type='xs:short' use='optional'/>
  342. </xs:extension>
  343. </xs:simpleContent>
  344. </xs:complexType>
  345. <xs:simpleType name='empty'>
  346. <xs:restriction base='xs:string'>
  347. <xs:enumeration value=''/>
  348. </xs:restriction>
  349. </xs:simpleType>
  350. </xs:schema>
  351. ]]></code>
  352. </section1>
  353. </xep>