Wednesday, February 13, 2008

Google Apps and External Jabber/XMPP Servers

Background: I have a couple of domains that I am using with Google Apps. Google Apps includes Google Talk, which is Google's Jabber/XMPP based Instant Messaging. I also have a normal GMail account that also includes Google Talk. While experimenting with an IM interface to Twitter I found that although Google Talk in my normal GMail account could talk to other Jabber systems, Google Talk in my Google Apps account could not.

I found the answer in Kavinda Munasinghe's Blog, and in two Google documents (here) and (here).

As I understand it Jabber/XMPP uses DNS entries to find the servers needed to talk to another domain. For example, if you want to talk to joe@example.com, your Jabber server will use DNS to look up service (SRV) records for the jabber/xmpp service in the example.com domain. Here is an excerpt from the ejabberd documentation regarding the SRV records:

There are 3 SRV records that can be created for a Jabberd installation:

     _jabber._tcp.   ->    .:5269
_xmpp-server._tcp. -> .:5269
_xmpp-client._tcp. -> .:5222

The first and second of these specify the host and the port for server-to-server (s2s) communications. There are two listings for this because the new XMPP protocol, regarding SRV records, is replacing the older Jabber standards. The third listing above specifies host and port for unencrypted client communications (c2s).

Putting it all togehter, the records needed for a Google Apps domain (example.com) are:
_xmpp-server._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server4.l.google.com.
_jabber._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server2.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server3.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server4.l.google.com.
_xmpp-client._tcp.example.com IN SRV 5 0 5222 talk.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk1.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk2.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk3.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk4.l.google.com


Monday, February 11, 2008