Thursday, December 06, 2007

10 steps to a multi-protocol iChat.

Problem:


I know that setting up iChat to communicate with MSN, Yahoo, AIM and other users has been discussed in many other places. There are a couple of issues, however, that I have with this process:
  1. Security - you are trusting 3rd-parties with your login information

  2. Stability - the transports many times go up and down

  3. Consistency - sometimes, you're required to sign up for transports from different servers - I don't like that
Up until now, my solution on Mac has been to use Adium for chat. It is an excellent program - and I love everything about it. However, there are a couple of things that I think iChat does a bit better. Since it's integrated with the OS, it has a more consistent look-and-feel across all the other applications. I also like the way that it integrates with Mail.app (you can see who is online from within your mail messages). It's just a more "polished" solution, in my opinion.

I've always thought that the way to go would be to run a jabber server locally, and connect to it with my own transports. This would solve all my issues (Security, Stability, and Consistency), and at the same time, allow me to access all my contacts via iChat (giving me the nice integration). However, up until now, I have not had time, and setting up a jabber server is not the easiest thing to do.

Enter Openfire. I don't know where this program has been - it's by far the easiest jabber server to set up - and it has excellent Mac OS Integration (It uses LaunchDaemons and has a PreferencePane). Below, I list instructions on how I got my iChat to communicate multi-protocol, using Openfire.

These instructions are taken from my installation process on a MacBook Pro running OSX 10.5.1 (Leopard). It should work for previous versions - but the prompts may be somewhat different.

Instructions:


1 - Install Openfire

Download Openfire for Mac from here. The version I used is 3.4.1. Mount the disk image and run the installer. It's really that easy!

2 - Configure Openfire

Open your System Preferences and choose the Openfire preference pane. Make sure that Openfire's status is listed as "Running". Check the box to "Start Openfire When System Turns On". Then click the button to "Open Admin Console".

The Admin Console for Openfire is web-based - it is very easy to use, and very powerful. The first time you open the console, it will ask you some initial setup questions.
  • Choose the language you want

  • For server settings, set your "Domain" to be "localhost". This will simplify adding contacts later. You can leave the other settings as they are.

  • Choose to use the "Embedded Database". Since we will not be exposing our server to other users, we don't really care about the performance level - there will generally be just a single user logged in at once, and it greatly simplifies the setup process.

  • Keep "Default" selected for how to store user and group profiles. We don't want to set up LDAP.

  • Enter in a valid email address and an admin password. REMEMBER THIS PASSWORD

Setup is now finished - you can go ahead and log in to the admin console (the username is "admin" - the password is the one you just set up).

3 - Secure Openfire

We don't want to let other people connect to our jabber server - just those who are on the computer we are setting this up on. That is one of the reasons (security) that we wanted to run our own jabber server.

Under "Registration & Login" set "Inband Account Registration" and "Anonymous Login" to "Disabled". Then click "Save Settings"

4 - Create a jabber user (or users)

You now need to create a user for your jabber server. This is the user that you will use to log in to the jabber server. I suggest you create an account for every account that exists on your Mac. Do the following:

Click on the "Users/Groups" tab at the top of the management console. Choose "Create New User" on the left. Enter in a username and a password (Name and Email are optional). It is called your "JID" (Jabber ID), and is the username and password you will use in iChat. I use the same username as my Mac user name. Then Click "Create User"

5 - Install the IM Gateway Plugin

In order to communicate with other services, we need to install the "IM Gateway Plugin". Do the following:

Click on the "Plugins" tab at the top of the management console. Choose "Available Plugins" on the left. Click on the "plus" sign under "Install" for the "IM Gateway". You can ignore the other plugins - they are more useful for a "real" jabber server. We are only using our server for the transports.

6 - Configure the IM Gateway Plugin

We want to secure the services for our IM Gateway plugin. For each of the third-party services you want to connect to (AIM, MSN, Yahoo, Google Talk, etc.), you need to do the following:

Click on the "Server" tab at the top of the management console. Choose "Settings" under the "Gateways" section on the left. Check the services you wish to use. For each one of them, you can choose "Options" and uncheck mail notifications if you like. Mail notifications BOTHER ME! Under the "Permissions" for each of the services, select "Manual registration only". This will simplify the registration process (and eliminates the need to download or use Psi, as other tutorials have you do. Remember to click "Save Permissions" after each one you change. You can also test your connection to the services, if you want.

7 - Register for your "multi-protocol" services

We now need to enter in your login information for the various multi-protocol services. This information is stored locally on your computer, so it's somewhat secure, but you should be aware that anyone who has physical access to your computer and enough know-how can still find out your login information if they dig enough. This is, however, not any less secure than storing your passwords in your keychain for iChat or Adium anyway. Do the following for each service:

Click on the "Server" tab at the top of the management console. Choose "Registrations" under the "Gateways" section on the left. Click on "Add a new registration". Enter in your "user (JID)" that you use to connect to jabber, the gateway you want to use (MSN/AIM/Yahoo/etc), the username and password that you use to log on to that service, and an optional nickname. Click on "Add". NOTE:On my system, clicking "Add" says that the registration was added, but it doesn't show up in the list until I refresh the web page. I found, however, that you can add all your registrations at once (even if they aren't showing up in the list) and then hit "refresh" at the end to verify that they are all there. After logging in to iChat (below), you can come back here and verify that the "Last Login" reflects that you have correctly logged in to the service.

8 - Set up iChat

Now we have all the information that we need. You can now set up iChat to connect to your jabber server. Do the following:

Open iChat and set up a new jabber account. For "Account Type" choose "Jabber Account", "Account Name" should be jid@localhost - where jid is your jabber ID that you set up above. The password is the password for your jabber id.

9 - Connect!

The first time you connect to your jabber server, you will get a certificate error - this is because the certificate that Openfire uses is a self-signed certificate. You will probably want to click "Show Certificate" and choose to "Always trust localhost when connection to localhost" so you won't get that warning every time you connect.

10 - Add Contacts

OK - so this really isn't a step - but I thought that "10 steps" is better - and it's a bit odd how you need to add contacts. When you want to add a contact to iChat, you need to format it in a way that jabber will know what service to add that chat with. Add your contacts in the form serviceusername@service.localhost - where serviceusername is your contact's name, and service is one of "aim", "gadugadu", "icq", "irc", "msn", "yahoo", "gtalk", "sip", or "xmpp". If your contact's name contains an @ sign (as do MSN and GTalk accounts), you need to replace the "@" in the username with "\40" - so, user@hotmail.com on the msn account would be added as user\40hotmail.com@msn.localhost .

Suggestions/Comments:


I would love to hear feedback, suggestions, and/or comments. Please leave some below!