Categories
Uncategorized

google talk for google apps users

I was playing with building an XMPP bot at the weekend. The trouble was my google talk account, but it’s part of google apps for your domain. Why does this matter? Take a look at my ID:

dom@gapps.mydomain.com/Work

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 mydomain.com1:

_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 dom@gapps.mydomain.com ā€” lovely!

1 The privileges of being an ex-sysadmin. šŸ™‚

2 replies on “google talk for google apps users”

@scott Thanks, but that’s subtly different. That’s about server to server communication, not client to server communications. Of course the only reason I know this is that I found that page, tried it and it didn’t work. šŸ™‚

Leave a Reply to Scott Laird Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s