Pages

Monday, 23 May 2005

HOWTO: Your own private MSN gateway for iChat

Following on from some of the articles I've dug at digg, I wanted to set up iChat for MSN desperately. But I wasn't so keen on giving away my e-mail password to a third party. So here's a procedure for setting up your own Jabber server and MSN gateway on your local machine.

Using iChat via MSN with your own Jabber server

This procedure is very long-winded (and could probably do with some automation). Look out for a revised version later.

Requirements:


Procedure:

  1. Set up an account with DynDNS.org. Associate a hostname with the computer which will run your Jabber server.

  2. Install DNSUpdate. Run its application, letting it install its daemon. Enter the details for your account, and then your host and make sure it can communicate with the DynDNS server.

  3. Reboot the machine to allow DNSUpdate to start automatically. You may get a warning about DNSUpdate upon rebooting, if so click Fix and reboot again.

  4. Extract out Expat by double-clicking it in the Finder. Open a Terminal, type "cd " and drag the Expat folder into the window. Press Enter.

  5. Install Expat by running "./configure" then "make" and finally "sudo make install" entering your password when asked.

  6. Extract out Libidn by double-clicking it in the Finder. Switch to the Terminal, type "cd " again and drag the Libidn folder into the window. Press Enter.

  7. Install Libidn by running "./configure" then "make" and finally "sudo make install" entering your password when asked.

  8. Extract out pth (the Pthreads library) by double-clicking it in the Finder. Switch to the Terminal, type "cd " again, and drag the pth folder into the window. Press Enter.

  9. Install Pth by running "./configure" then "make", "make test" and finally "sudo make install" entering your password when asked.

  10. Extract out Jabberd by double-clicking it in the Finder. Switch to the Terminal, type "cd " again and drag the jabberd folder into the window. Press Enter.

  11. Install Jabberd by running "./configure" then "make" and finally "sudo make install", entering your password when asked.

  12. At this point, we have to configure the Jabber server. You will need to know your hostname that you got from DynDNS earlier. Follow the instructions in the Jabberd 1.4 Administration Guide and return here when done.

  13. You can now launch iChat and test it while your Jabber server is running. In the iChat Account Preferences (iChat > Preferences... or the Jabber page of the Assistant if it is the first time using iChat), put the user name you registered with your server during the test followed by @ followed by the hostname of the Jabber server. Enter the same password. Now try to connect. It will likely fail because iChat prefers secure communications. Go to Preferences... in iChat and click on Accounts, select your Jabber account and click on Server Settings. Untick the Connect using SSL box. Also if you are using the Mac OS X firewall, make sure port 5222 is open (the connection uses your external IP and so goes through the firewall for now). Now try logging in. Click iChat > Log In to Jabber. Your status should become Available. Note that you must be connected to the Internet for iChat to connect properly. Close iChat when it is working.

  14. Extract out pyCrypto by double-clicking it in the Finder. Switch to the Terminal, type "cd " again, and drag the pycrypto folder into the window. Press Enter.

  15. Install pyCrypto by running "python setup.py build", then "sudo python setup.py install", entering your password when asked.

  16. Extract out pyOpenSSL by double-clicking it in the Finder. Switch to the Terminal, type "cd " again, and drag the pyopenssl folder into the window. Press Enter.

  17. Install pyOpenSSL by running "python setup.py build", then "sudo python setup.py install", entering your password when asked.

  18. Extract out the Twisted Sumo package by double-clicking it in the Finder. Switch to the Terminal, type "cd " again, and drag the pycrypto folder into the window. Press Enter.

  19. Install Twisted Sumo by the following commands. First install the provided Zope Interface. Type "cd Zope-Interface", press Tab and then press Enter. Install it by typing "python setup.py build", "sudo python setup.py install". Type "cd .." and press Enter to return to the Twisted Sumo folder. Install that by typing "python setup.py build", "sudo python setup.py install". Enter your password whenever asked.

  20. Now extract and install PyMSNt by double-clicking it in the Finder. Switch to the Terminal and type "sudo cp -r " and drag the PyMSNt folder into the window, then press Enter, entering your password when asked.

  21. Now follow the PyMSNt instructions, which involve editing your jabber.xml file again.

  22. We need to make a link between your Jabber account and your MSN Messenger account. To do this, with Jabber and PyMSNt running (use multiple Terminal windows), double-click the Psi disk image and double-click Psi in the window that appears. Log in as you did with iChat with your Jabber address and password. Right-click on your username and click on Available. Then right-click again, highlight Modify and click Service Discovery. In the window that appears, right-click on MSN and click Register. Now enter your MSN Messenger details. You will get a flood of authorisation requests for your existing MSN contacts. Ignore these now and close Psi.

  23. Open iChat again and log in to Jabber (it should do this automatically, otherwise choose iChat > Log In to Jabber). Accept all of the authorisation requests that appear. Close iChat.

  24. Now we need to get the server to start at startup, or at least while iChat is running. I chose the Startup Item approach to this, but be warned this method is obsolete in Tiger and I couldn't stop PyMSNt from running as root. You'll also need t o be familiar with editing permissions of files. I might leave this for another time, for now however you simply need to run both Jabber and PyMSNt before iChat to connect to MSN.


Happy chatting!