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