1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-25 10:42:19 -05:00
xeps/xep-0003.xml

348 lines
13 KiB
XML
Raw Normal View History

<?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>Active</status>
<type>Historical</type>
<jig>Standards JIG</jig>
<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.2</version>
<date>2004-01-22</date>
<initials>psa</initials>
<remark>Editorial revisions.</remark>
</revision>
<revision>
<version>1.1</version>
<date>2004-01-06</date>
<initials>psa</initials>
<remark>Added XML schema.</remark>
</revision>
<revision>
<version>1.0</version>
<date>2002-10-15</date>
<initials>psa</initials>
<remark>Changed status to Active.</remark>
</revision>
<revision>
<version>0.4</version>
<date>2001-07-02</date>
<initials>rwe</initials>
<remark>Error codes update</remark>
</revision>
<revision>
<version>0.3</version>
<date>2001-06-29</date>
<initials>rwe</initials>
<remark>Protocol update</remark>
</revision>
<revision>
<version>0.2</version>
<date>2001-06-28</date>
<initials>psa</initials>
<remark>DocBook version</remark>
</revision>
<revision>
<version>0.1</version>
<date>2001-06-01</date>
<initials>jer</initials>
<remark>Initial release</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'>
&#60;iq id='pass1' type='set' to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;expire&#62;600&#60;/expire&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Result from PASS Service'>
&#60;iq id='pass1' type='result' from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;server port='43253'&#62;1.2.3.4&#60;/server&#62;
&#60;/query&#62;
&#60;/iq&#62;
</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 &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>
<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'>
&#60;iq type='set'
id='pass2'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='IQ result to accept connection'>
&#60;iq type='result'
id='pass2'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</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='&#60;expire/&#62;'>
<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 &#60;iq/&#62; to the JID to tell it that the port has been closed down. It notifies the client with:</p>
<example caption='Notification of expiration'>
&#60;iq type='set'
id='pass3'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;expire/&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Acknowledgement of expiration'>
&#60;iq type='result'
id='pass3'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
</section2>
<section2 topic='&#60;oneshot/&#62;'>
<p>This tells the server to listen once, and then close the port. Even if the &#60;expire/&#62; has not been met, the &#60;oneshot/&#62; 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'>
&#60;iq type='set'
id='pass4'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;oneshot/&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Client acknowledges closing of oneshot port'>
&#60;iq type='result'
id='pass4'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
</section2>
<section2 topic='&#60;close/&#62;'>
<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'>
&#60;iq type='set'
id='pass5'
to='pass.jabber.org'
from='user@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Server acknowledges port closing request'>
&#60;iq type='result'
id='pass5'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
<table caption='Error Codes'>
<tr>
<th>Code</th>
<th>Message</th>
<th>Cause</th>
</tr>
<tr>
<td>400</td>
<td>Missing &#60;proxy/&#62; specification.</td>
<td>Sent a &#60;close/&#62; w/o a &#60;proxy/&#62;</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 &#60;proxy port=''/&#62; was not a defined port.</td>
</tr>
<tr>
<td>405</td>
<td>Proxy IP does not match.</td>
<td>The IP sent in the &#60;proxy/&#62; 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>
&#60;iq type='get'
id='pass6'
to='them@jabber.org/resource'
from='you@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
<p>The other client SHOULD send back:</p>
<example>
&#60;iq type='result'
id='pass6'
to='you@jabber.org/resource'
from='them@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client&#62;4.3.2.1&#60;/client&#62;
&#60;query&#62;
&#60;/iq&#62;
</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 &#60;client/&#62; 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 &#60;client/&#62; information that it receives. It can return an error to the PASS service specifying the &#60;proxy/&#62; port and hangup on the active &#60;client/&#62; connection and start listening again. This does not affect the &#60;oneshot/&#62; control. For example:</p>
<p>The PASS service sends you:</p>
<example>
&#60;iq type='set'
id='pass7'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;query&#62;
&#60;/iq&#62;
</example>
<p>Your client would send back:</p>
<example>
&#60;iq type='error'
id='pass7'
to='pass.jabber.org'
from='user@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;query&#62;
&#60;error code='401' type='auth'&#62;
&#60;not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/&gt;
&#60;/error&#62;
&#60;/iq&#62;
</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 &#60;client/&#62; does not match the &#60;client/&#62; 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 &REGISTRAR; 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>