1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-22 01:02:17 -05:00
xeps/xep-0003.xml

360 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>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 &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'><![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 &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>