|
|
...making Linux just a little more fun! How to Set Up a Jabber Server
1.0 Introduction:Unless you have been living under a rock for the past few years, you must have heard about instant messaging and how it has changed the world of communications over the Internet. According to http://www.webopedia.com, Instant Messaging (IM) is a service that alerts users when their friends or colleagues are on line and allows them to communicate in real time through private online chat areas. Two of the most popular IM services are AOL Instant Messenger (AIM) and MSN Messenger. Unfortunately, most of the publicly available servers use proprietary protocols that only allow you to communicate with users on the same system. These systems are not compatible with each other and can't be accessed from other clients. Jabber is an open source implementation of the IM server that aims to change this. It uses streaming XML protocols that are free, open, and public. These protocols have been formalized by the Internet Engineering Task Force (IETF) as the approved instant messaging and presence technology under the name of XMPP. The first Jabber technologies were developed in 1998 by Jeremie Miller and is now used on thousands of servers world-wide to enable millions of users to communicate with each other. The biggest advantage of the Jabber server when compared with commercial IM servers is that, since it is open source, anyone can run a Jabber server and it can be restricted to a specific community like a company work force or a group of friends. In this article, I will document the steps I took to set up a Jabber server and how I managed to overcome the difficulties I faced. Hopefully this will make it easier for you to set up your own Jabber server. 2.0 Pre-ConfigurationBefore we compile the server, we need to make some changes to the system on which we'll be installing the server to make it more secure. The first thing we have to do is create a new user so the Jabberd server process is not run as root. This is highly recommended, since running server processes as root is a pretty bad idea. Now, you might be wondering why that's the case. Right? Well, imagine this scenario: a buffer overflow flaw is discovered in the Jabberd server code and before a fix for it has been written a script-kiddy who has hated you since you stole his place in the 5th grade cafeteria finds out that you are running a version of the server that is vulnerable to the attack and decides to hack you. Now, if you are running the server as root, he would have you at his mercy, as he would have full control of the server and he could do whatever he wanted with it. On the other hand, if you were running it as another user, he would still have to jump through a lot of hoops to get root access and hopefully he would set off some kind of alarm before he gets it, allowing you to catch him. Convinced yet? No? Well it's your funeral... To add a user to the server, run the following command as root:
After changing the password, we need to create a directory where
the jabberd process will store its logs and pids. You do it by
running the following commands: Once the directories are created, we need to change the ownership of
the directories so that the user jabber can write to them. We do
this by running the following commands: 2.1 Getting the Jabber ServerSince Jabber is an Open Source project, there are multiple implementations of the Jabber server. A list of some of the servers is available at: http://www.jabber.org/software/servers.shtml. I decided to use the Jabberd 2.x implementation of the server as I already had the source for the server on my computer. Also, it wasn't possible to download another server source due to the recent hack of the Jabber Studio servers and the subsequent shutdown of the download section of the site while they figured out what was going on. Hopefully, by the time you read this, their machines should be back to normal and you will be able to download the latest version of Jabberd from their site. 2.2 Configuring and Installing JabberFirst thing we have to do after we download the source is to
uncompress it by issuing the following command: The jabberd server has a lot of configuration options that can
be set during the initial configuration. To see a list of all the
options available run the following command: Once the configure script has finished running without giving
any errors, we can go ahead and compile the program by issuing the
following command: By default, jabberd uses MySQL to store the user data, so we'll need to
setup a new MySQL database that jabberd can access. There is a script in
the 'tools' subdirectory of the jabberd source that makes this really easy
to do. To run the script issue the following command: Enter the MySQL root password when you are prompted for it. This
script creates a new database and populates it with tables that the
jabberd server requires. Once the script finishes running, we need
to create a user called jabberd2 in MySQL to allow jabberd to
manipulate the database. This is done by issuing the following
command: Now enter the root password when you are prompted for it and you
will get the MySQL command prompt. At this prompt enter the
following command: replacing "examplepassword" with a password of your choice. Once you run
this command type 2.3 Customizing the jabberd server installTo customize the server, we first need to change to the jabberd
directory by running the following command:
Once we are done editing, save sm.xml and exit the editor. Now we need to customize c2s.xml, so follow these steps as root:
This completes the configuration of the jabberd server. This
gives us a basic jabber server that allows users to register
themselves and chat with each other. However, if we want to have the
ability to create chat rooms, we need to install some additional
software called 2.4 Creating a default buddy list for new usersjabberd gives us the ability to create a template buddy list so that each new user has a default buddy list. This is very useful in environments where the administrator wants to make sure each user has all the important people in their buddy list without spending a lot of time adding each user manually. The template file is located in the templates subdirectory and is
called <query xmlns=’jabber:iq:roster’> <!-- <item name=’Buddy Name’ jid=’JID@Host.domain’ subscription=’both’> <group>BuddyGroup</group> </item> --> </query> To add new users we need to uncomment the <item name> tag and add a new line for each user. For example if you wanted to add me to the default roster and my JID (Jabber ID) was suramya@jabber.suramya.com the entry for my name would look like this: <item name='Suramya' jid='suramya@jabber.suramya.com' subscription='both'> <group>Support</group> </item> The group field tells the client the group under which the entry is supposed to be stored. In this case Suramya is being stored under the Support group. All entries need to be enclosed within the <query> </query> tag, so the complete file with one user would look something like: <query xmlns=’jabber:iq:roster’> <item name=’Suramya’ jid=’suramya@jabber.suramya.com’ subscription=’both’> <group>Support</group> </item> </query> 2.5 Install mu-conference serverBefore we can install mu-server we need to install the Jabber Component Runtime(JCR) which is available for download at: http://jabber.terrapin.com/JCR/jcr-0.1.2.tar.gz. To download and install JCR follow these steps:
Once jcr finishes compiling we can proceed with the installation of mu-conference by following these steps:
Now we have to customize mu-conference by editing
This finishes the configuration of the mu-conference server and we are now ready to run it. 2.5 Running the Jabberd serverTo run the server run the following commands:
3.0 ConclusionBy now I have hopefully saved you a lot of trouble by telling you how to setup a jabber server quickly and easily. If you think this document helped you or you have some comments or questions about this please feel free to contact me and let me know. However I must warn you that I am a somewhat lazy person who might take a little while before replying to your emails. Thanks for your time - Suramya Tomar4.0 Document Information/HistoryCreated by: Suramya Tomar 4.1 CopyrightThis document is Copyright © 14th July 2005, Suramya
Tomar. 4.2 CreditsIn this section I have the pleasure of acknowledging the following people without whose input this would have never seen the light of the day:
I was born in 1980 in a small Air Force hospital in Hashimara, India. I
then spent the next 18 years of my life all over India during which I had
the pleasure of attending 7 schools to complete 12 years of schooling.
I started using Linux in late 1999 when a friend lent me a Redhat 7.1
installation CD and another friend 'donated' a 6GB harddisk. This was right
after my Win98 had crashed for the nth time so I decided to give Linux a
shot. I tried it and got hooked almost instantly. Over the next 2 years I
upgraded to Redhat 7.3 but when Redhat decided to stop support for RH 7.3 I
switched to Debian and have been living happily ever since.
I like to program a lot and have recently figured out how to decipher
the jumble of characters some people like to call Perl and found that I
actually like it. For websites I like using PHP with MySQL backends and can
program with C, C++, VB and .Net. I am also very interested in computer
security and Artificial Intelligence and try to read as much on
these topics as I can.
Other than working on the computer I like reading (mainly Fantasy and
Science Fiction but I will read anything except romance novels), listening
to music (fav singers include: Shania Twain, In-Grid, Crystal Waters) and
taking stuff apart to see how it works.
If you are really bored and want to learn more about me then feel free to
visit my website at: http://www.suramya.com where you will find
more info about me than you ever wanted to know.
|