XEP-0309: Service Directories

Abstract:This specification shows how to combine and extend a number of existing XMPP protocols for improved sharing of information about XMPP servers.
Author:Peter Saint-Andre
Copyright:© 1999 - 2012 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:Experimental
Type:Standards Track
Version:0.2
Last Updated:2012-01-25

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.


Table of Contents


1. Introduction
2. Gathering Information
    2.1. Server Discovers Directory
    2.2. Server Subscribes to Directory
       2.2.1. Administrator Triggers Presence Subscription
    2.3. Directory Queries Server
       2.3.1. Disco Query
       2.3.2. vCard Query
3. Publishing Information
4. Security Considerations
5. IANA Considerations
6. XMPP Registrar Considerations
    6.1. Protocol Namespaces
    6.2. Service Discovery Category/Type
    6.3. Service Discovery Features
7. XML Schema
    7.1. Registration URI
    7.2. Certification Authority Information

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History


1. Introduction

Several directories (e.g., at xmpp.org and jabberes.org) have long provided information about public XMPP services so that end users can more easily find servers to register with, add-on components to use for features such as Multi-User Chat [1], etc. These service directories tend to rely on humans to gather and in some cases verify the information they publish before providing it via the World Wide Web or the XMPP network for use by end users and IM client software. However, relying on humans to gather and verify such information can result in significant delays and errors. It would be better to automate the information-gathering functions as much as possible.

This document shows how to combine and extend a number of existing XMPP protocols for (mostly) automated gathering of information about public XMPP services. Widespread deployment of this specification will result in more timely, accurate information about the services available on the XMPP network.

2. Gathering Information

The following scenario involves two entities:

Note: Although the entity that gathers information for a directory could be a client or a component, here we assume that it is a server ("xmpp.net").

These two entities use Server Buddies [2], Service Discovery [3], and vCard4 over XMPP [4] in the following ways.

Directory                      Server
(xmpp.net)                   (jabber.org)
    |                             |
    |   [first, server learns     |
    |    identity of directory]   |
    |                             |
    |<---disco info request-------|
    |----disco info response----->|
    |                             |
    |   [second, entities become  |
    |    "buddies" per XEP-0267]  |
    |                             |
    |<---presence subscribe-------|
    |----presence subscribed----->|
    |----presence subscribe------>|
    |<---presence subscribed------|
    |                             |
    |   [third, directory         |
    |    gathers server data]     |
    |                             |
    |----disco info request------>|
    |<---disco info response------|
    |                             |
    |----vcard request----------->|
    |<---vcard response-----------|
    |                             |
  

2.1 Server Discovers Directory

In order to determine the exact identity of the directory, the server sends a service discovery information request to the directory.

Example 1. Server Queries Directory

<iq type='get'
    from='jabber.org'
    to='xmpp.net'
    id='xh1f37n5'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
    

Example 2. Directory Returns Disco Info

<iq type='result'
    from='xmpp.net'
    to='jabber.org'
    id='xh1f37n5'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='directory' type='server'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='http://jabber.org/protocol/disco#items'/>
    <feature var='urn:xmpp:server-presence'/>
  </query>
</iq>
    

2.2 Server Subscribes to Directory

If the server wishes to have its information aggregated, it sends a presence subscription request to the directory as described in XEP-0267.

Example 3. Server Sends Subscription Request to Directory

<presence from='jabber.org'
          to='xmpp.net'
          type='subscribe'/>
    

Upon receiving such the presence subscription request, the directory approves it.

Example 4. Directory Sends Approval to Server

<presence from='xmpp.net'
          to='jabber.org'
          type='subscribed'/>
    

The directory also sends a subscription request to the server.

Example 5. Directory Sends Subscription Request to Server

<presence from='xmpp.net'
          to='jabber.org'
          type='subscribe'/>
    

The server then approves that subscription request, as well.

Example 6. Services Sends Approval to Directory

<presence from='jabber.org'
          to='xmpp.net'
          type='subscribed'/>
    

2.2.1 Administrator Triggers Presence Subscription

The server administator needs a way to trigger the server to send a presence subscription to the directory. This can be done by using Ad-Hoc Commands [5] as in Service Administration [6]. Therefore we define a new server administration use case. The command node for this use case SHOULD be "http://jabber.org/protocol/admin#server-buddy".

A sample protocol flow for this use case is shown below.

Example 7. Admin Requests to Add Server Buddy

<iq from='stpeter@jabber.org/squire'
    id='server-buddy-1'
    to='jabber.org'
    type='set'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands' 
           action='execute'
           node='http://jabber.org/protocol/admin#server-buddy'/>
</iq>
      

Unless an error occurs, the service SHOULD return the appropriate form.

Example 8. Service Returns Server Buddy Form to Admin

<iq from='jabber.org'
    id='server-buddy-1'
    to='stpeter@jabber.org/squire'
    type='result'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands' 
           node='http://jabber.org/protocol/admin#server-buddy'
           sessionid='server-buddy:20120109T0310Z'
           status='executing'>
    <x xmlns='jabber:x:data' type='form'>
      <title>Adding a Server Buddy</title>
      <instructions>Fill out this form to add a "server buddy".</instructions>
      <field type='hidden' var='FORM_TYPE'>
        <value>http://jabber.org/protocol/admin</value>
      </field>
      <field label='The server to add'
             type='jid-single'
             var='peerjid'>
        <required/>
      </field>
    </x>
  </command>
</iq>
      

Example 9. Admin Submits Server Buddy Form to Service

<iq from='stpeter@jabber.org/squire'
    id='server-buddy-2'
    to='xmpp.net'
    type='set'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands' 
           node='http://jabber.org/protocol/admin#server-buddy'
           sessionid='server-buddy:20120109T0310Z'>
    <x xmlns='jabber:x:data' type='submit'>
      <field type='hidden' var='FORM_TYPE'>
        <value>http://jabber.org/protocol/admin</value>
      </field>
      <field var='peerjid'>
        <value>xmpp.net</value>
      </field>
    </x>
  </command>
</iq>
      

Example 10. Service Informs Admin of Completion

<iq from='jabber.org'
    id='server-buddy-2'
    to='stpeter@jabber.org/squire'
    type='result'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands' 
           node='http://jabber.org/protocol/admin#server-buddy'
           sessionid='server-buddy:20120109T0310Z'
           status='completed'/>
</iq>
      

2.3 Directory Queries Server

After the subscription handshake has been completed, the directory queries the server for information. There are two aspects: service discovery information and vCard information.

2.3.1 Disco Query

In order to determine the exact identity of the server, the directory sends a service discovery information request to the server.

Example 11. Directory Queries Server

<iq type='get'
    from='xmpp.net'
    to='jabber.org'
    id='i3vs51b9'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
      

Example 12. Server Returns Disco Info

<iq type='result'
    from='jabber.org'
    to='xmpp.net'
    id='i3vs51b9'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='server' type='im'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='http://jabber.org/protocol/disco#items'/>
    <feature var='jabber:iq:register'/>
    <feature var='urn:xmpp:server-presence'/>
    <feature var='urn:xmpp:public-server'/>
  </query>
</iq>
      

Note: If the server is a public node on the XMPP network, it includes a service discovery feature of "urn:xmpp:public-server". This feature is defined below.

Note: If the server allows In-Band Registration [7], it includes a service discovery feature of "jabber:iq:register". If the server does not allow in-band registration but allows account registration at a website, it includes the registration URL in its vCard as described below.

The foregoing examples show the gathering of disco#info data (identity and supported features). An directory MAY also gather disco#items data about components and other services associated with the base XMPP server at a domain.

2.3.2 vCard Query

In order to gather additional information about the server, the directory sends a vCard information request to the server.

Note: Because vCard4 enables the XMPP community to more easily define extensions to vCard (e.g., for registration URLs), it is RECOMMENDED for servers to support vCard4 over XMPP [8] in addition to, or instead of, vcard-temp [9].

Example 13. Directory Requests vCard Data from Server

<iq from='xmpp.net'
    id='lw71bs73'
    to='jabber.org'
    type='get'>
  <vcard xmlns='urn:ietf:params:xml:ns:vcard-4.0'/>
</iq>
      

Example 14. Server Returns vCard Data

<iq from='jabber.org'
    id='lw71bs73'
    to='xmpp.net'
    type='result'>
  <vcard xmlns='urn:ietf:params:xml:ns:vcard-4.0'>
    <fn><text>jabber.org IM service</text></fn>
    <url><uri>http://www.jabber.org/</uri></url>
    <lang>
      <parameters><pref>1</pref></parameters>
      <language-tag>en</language-tag>
    </lang>
    <adr>
      <region>IA</region>
      <country>US</country>
    </adr>
    <email><text>xmpp@jabber.org</text></email>
    <impp><uri>xmpp:jabber.org</uri></impp>
    <logo><uri>http://www.jabber.org/images/logo.png</uri></logo>
    <geo><uri>geo:42.25,-91.05</uri></geo>
    <tz><text>America/Chicago</text></tz>
    <kind><text>application</text></kind>
    <registration xmlns='urn:xmpp:vcard:registration:1'>
      <uri>https://register.jabber.org/</uri>
    </registration>
  </vcard>
</iq>
      

It is RECOMMENDED for public server vCards to include the following information:

It is OPTIONAL for public server vCards to include the following information:

It is best for the server directory to discover the last two elements in-band (by means of TLS negotiation and Software Version [10], respectively), then add them to the contact vCard as described in the next section.

3. Publishing Information

Currently, service directories such as xmpp.org and jabberes.org publish their information on the World Wide Web, typically via a human-friendly website and sometimes also via machine-readable files at a well-known URI for use by IM clients to pre-populate drop-down boxes showing XMPP servers that allow in-band registration. (For example, the xmpp.org service publishes a file listing registered public servers using the Service Discovery [11] format.)

In addition to publishing such information on the web, this document defines a second publishing path: the XMPP network itself. The directory can do this by creating a public Publish-Subscribe [12] node at the directory's bare domain (e.g., xmpp.net) that pushes data in the vCard4 format shown above, as described more fully in XEP-0292. Other entities can then subscribe to this node to receive updated information about services that are added to or removed from the directory.

For example, the following stanza shows an information push from the xmpp.net directory about the jabber.org service, sent to a subscriber at example.com.

Example 15. Directory Pushes Server Data to Subscriber

<message from='xmpp.net'
         to='example.com'
         type='headline'
         id='hx61cs8k'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:contacts'>
      <item id='3B55FBC7-8149-4693-A1A1-5367E2A49C83'>
        <vcard xmlns='urn:ietf:params:xml:ns:vcard-4.0'>
          <fn><text>jabber.org IM service</text></fn>
          <url><uri>http://www.jabber.org/</uri></url>
          <lang>
            <parameters><pref>1</pref></parameters>
            <language-tag>en</language-tag>
          </lang>
          <adr>
            <region>IA</region>
            <country>US</country>
          </adr>
          <email><text>xmpp@jabber.org</text></email>
          <impp><uri>xmpp:jabber.org</uri></impp>
          <logo><uri>http://www.jabber.org/images/logo.png</uri></logo>
          <geo><uri>geo:42.25,-91.05</uri></geo>
          <tz><text>America/Chicago</text></tz>
          <kind><text>application</text></kind>
          <registration xmlns='urn:xmpp:vcard:registration:1'>
            <uri>https://register.jabber.org/</uri>
          </registration>
          <ca xmlns='urn:xmpp:vcard:ca:0'>
            <name>StartSSL</uri>
            <uri>http://www.startssl.com/</uri>
          </ca>
          <name xmlns='jabber:iq:version'>Isode M-Link</name>
        </vcard>
      </item>
    </items>
  </event>
</message>
  

4. Security Considerations

Because a service directory does not know about an XMPP server unless the administrator of the server initiates a presence subscription to the directory, information leakage is minimized.

Use of the "urn:xmpp:public-server" service discovery feature provides a way for an XMPP server to explicitly indicate that its information is public.

Use of the "directory/server" service discovery identity provides a way for a service directory to explicitly indicate that it gathers service information obtained from XMPP servers that contact it.

5. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [13].

6. XMPP Registrar Considerations

6.1 Protocol Namespaces

This document specifies that the 'urn:xmpp:vcard:registration' namespace is used to qualify the XMPP-specific vCard4 extension for account registration URLs.

The XMPP Registrar shall add this namespace to its registry at <http://xmpp.org/registrar/namespaces.html>.

6.2 Service Discovery Category/Type

This document specifies that a service directory is identified by the "directory" category and the "server" type within XMPP Service Discovery.

The XMPP Registrar shall add the "server" type to the "directory" category already listed in the registry at <http://xmpp.org/registrar/disco-categories.html>. The registration is as follows.

Registry Submission

<category>
  <name>directory</name>
  <type>
    <name>server</name>
    <desc>A directory of XMPP servers</desc>
    <doc>[TBD]</doc>
  </type>
</category>
    

6.3 Service Discovery Features

This document specifies that a public server on the XMPP network is identified by the "urn:xmpp:public-server" Service Discovery feature.

The XMPP Registrar shall add this feature to its registry at <http://xmpp.org/registrar/disco-features.html>. The registration is as follows.

Registry Submission

<var>
  <name>urn:xmpp:public-server</name>
  <desc>The server is a public node on the XMPP network</desc>
  <doc>[TBD]</doc>
</var>
    

7. XML Schema

7.1 Registration URI

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:vcard:registration:1'
    xmlns='urn:xmpp:vcard:registration:1'
    elementFormDefault='qualified'>

  <xs:element name='registration'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='uri' type='xs:anyURI'/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
    

7.2 Certification Authority Information

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:vcard:ca:0'
    xmlns='urn:xmpp:vcard:ca:0'
    elementFormDefault='qualified'>

  <xs:element name='ca'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='name' type='xs:string'/>
        <xs:element name='uri' type='xs:anyURI'/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

</xs:schema>
    

Appendices


Appendix A: Document Information

Series: XEP
Number: 0309
Publisher: XMPP Standards Foundation
Status: Experimental
Type: Standards Track
Version: 0.2
Last Updated: 2012-01-25
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
Source Control: HTML
This document in other formats: XML  PDF


Appendix B: Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org
URI: https://stpeter.im/


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright © 1999 - 2012 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <http://xmpp.org/about-xmpp/xsf/xsf-ipr-policy/> or obtained by writing to XMPP Standards Foundation, 1899 Wynkoop Street, Suite 600, Denver, CO 80202 USA).

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.


Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.


Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Appendix G: Notes

1. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.

2. XEP-0267: Server Buddies <http://xmpp.org/extensions/xep-0267.html>.

3. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.

4. XEP-0292: vCard4 over XMPP <http://xmpp.org/extensions/xep-0292.html>.

5. XEP-0050: Ad-Hoc Commands <http://xmpp.org/extensions/xep-0050.html>.

6. XEP-0133: Service Administration <http://xmpp.org/extensions/xep-0133.html>.

7. XEP-0077: In-Band Registration <http://xmpp.org/extensions/xep-0077.html>.

8. XEP-0292: vCard4 over XMPP <http://xmpp.org/extensions/xep-0292.html>.

9. XEP-0054: vcard-temp <http://xmpp.org/extensions/xep-0054.html>.

10. XEP-0092: Software Version <http://xmpp.org/extensions/xep-0092.html>.

11. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.

12. XEP-0060: Publish-Subscribe <http://xmpp.org/extensions/xep-0060.html>.

13. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.


Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 0.2 (2012-01-25)

Added vCard extension for certification authority information; showed how to include software name in a vCard; recommended that the CA information and software name be added by the service directory, not included by the server itself.

(psa)

Version 0.1 (2012-01-10)

Initial published version.

(psa)

Version 0.0.3 (2012-01-09)

Defined ad-hoc command for triggering outbound presence subscription.

(psa)

Version 0.0.2 (2012-01-09)

Defined data sharing via PEP.

(psa)

Version 0.0.1 (2011-12-12)

First draft.

(psa)

END