google talk for google apps users
When you feed this to an XMPP library (xmpp4r-simple in my case), it attempts to find a server located at
gapps.mydomain.com. Which isn’t correct, my server is talk.google.com or somesuch.
But there’s a get-out clause in the spec (RFC3920).
Client-to-server communications MUST NOT proceed until the DNS hostname asserted by the server has been resolved. Such resolutions SHOULD first attempt to resolve the hostname using an [SRV] Service of “xmpp-client” and Proto of “tcp”, resulting in resource records such as “_xmpp-client._tcp.example.com.” (the use of the string “xmpp-client” for the service identifier is consistent with the IANA registration). If the SRV lookup fails, the fallback is a normal IPv4/IPv6 address record resolution to determine the IP address, using the “xmpp-client” port of 5222, registered with the IANA.
So, all it takes to get this working is some DNS tomfoolery. I added this to the zone file for
_xmpp-client._tcp.gapps IN SRV 5 0 5222 talk.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk1.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk2.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk3.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk4.l.google.com.
Where did I find this information from? Well, it wasn’t on google’s help, but the DNS can tell me. There’s no XMPP server on gmail.com, yet you can still use your gmail address as a JID.
host -t srv _xmpp-client._tcp.gmail.com
Now I can sign on as
firstname.lastname@example.org — lovely!
1 The privileges of being an ex-sysadmin. 🙂