Biz & IT —

Deciphering the jibber jabber: getting started with your own self-hosted XMPP server

Ever considered setting up your own Jabber server? In this concise guide, Ars …

Instant messaging is typically regarded as a social tool, but it also plays an increasingly important role in the workplace as a medium for professional communication. One of the most important technologies that has helped to advance instant messaging as a business tool is the Extensible Messaging and Presence Protocol (XMPP), an XML-based open standard that fosters interoperability between real-time messaging platforms.

XMPP (also known as Jabber) encourages federated infrastructure, allowing individual users or organizations to self-host their own messaging services. The protocol is also flexible enough to support a wide variety of different uses beyond mere chatting—it can be interfaced with all kinds of automated systems or used as a carrier for server-to-server communication. It's becoming common for companies that rely on instant messaging to run their own XMPP service, much as they would operate their own internal mail server.

There are many reasons why companies choose to operate their own XMPP servers. Some companies don't want to entrust sensitive internal communications to outside services. There are also companies, particularly in the financial industry, that have to retain and archive message logs for compliance purposes. In those kinds of environments, the advantages of a self-hosted messaging service are obvious. Another key advantage of operating an XMPP server is that it can be integrated with a company's other applications and services, such as an external Web-based customer support chat system.

Choosing an XMPP server

Setting up a self-hosted XMPP server is relatively easy due to the availability of several excellent open source implementations. The two most popular open source XMPP server applications are ejabberd, which is distributed under the GPL, and OpenFire, which is Apache-licensed. They are both modular, feature-rich, and easy to run.

The erlang-based ejabberd is generally regarded as the best option for large deployments because it scales well and offers good performance for intensive messaging workloads. OpenFire is a good choice for a personal Jabber server or small business messaging set-up because it's unbelievably easy to install, configure, and manage.

There are also several lesser-known open source XMPP server implementations that offer unique advantages in certain environments. Tigase, for example, might be a good choice for a Java shop that wants a more scalable or actively-developed solution than OpenFire. Another good one is the the Lua-based Prosody, which isn't quite as mature as some of the other options, but is extremely lightweight and easy to extend.

If you want to explore other XMPP server implementations, you can find a convenient list of open source and commercial servers at the XMPP Standards Foundation website. It's also worth noting that there are some hosted solutions that might be a good option for users and organizations that want the flexibility of their own XMPP service, but don't strictly need to self-host. For example, ProcessOne's Hosted.im services provides commercial XMPP hosting.

The set-up process

All of the mainstream XMPP server implementations are relatively easy to install if you want a standard configuration, but OpenFire will get you up and running the fastest. It has a Web-based configuration wizard that will walk you through a concise setup process. After you get it running, you can configure additional functionality by installing plugins. OpenFire can be configured and managed entirely from its built-in Web-based administration panel. You can even use the Web admin interface to do user and roster management or search the message logs.

It doesn't take much work to get ejabberd going, but you will have to do some minor hand-editing of its configuration files—which are basically erlang code. The ejabberd Web-based administrative interface is extremely simplistic, because the service is intended to be managed largely from the command line. There is a little bit of a learning curve for configuring ejabberd, but it's a small price to pay for the superior scalability and more robust feature set—assuming those characteristics are beneficial for your environment.

Both ejabberd and OpenFire support multiple database backends. They can optionally use their own internal database systems, but you are going to want to use a real database (e.g. PostgreSQL) when you deploy in a production environment. Especially with OpenFire, an external database is critical for performance.

Gateways

In a corporate setting, your users are generally going to be communicating with each other. But if you don't block outside communication, It's also possible for an XMPP user to add users from another XMPP server to their buddy list. This means that users can communicate with friends and colleagues who are on mainstream XMPP-based chat networks, such as Google Talk. If you want to make it possible for your users to communicate with friends on other incompatible messaging services, however, you will need some kind of bridge.

Despite the unrelenting strength of their popularity, non-XMPP instant messaging services like AIM and MSN are described as "legacy" networks by XMPP standardistas. Interoperability shims that expose legacy networks over XMPP are generically described as gateways. You can install an AIM gateway on your XMPP server, for example, in order to allow users to chat with AIM buddies through their XMPP identity.

In order for the gateway to work, the user needs to have an account registered on the legacy network and needs to supply that account's credentials to the XMPP gateway software. The gateway connects to the legacy service on behalf of the user and relays messages back and forth. Most gateway software implementations will even propagate the user's XMPP presence status to the outside networks.

The idea of connecting to other services through XMPP gateways might seem counterintuitive to users who are accustomed to multi-protocol client applications such as Pidgin or Adium. There are, however, some advantages to using gateways instead of a multi-protocol client. One of the biggest advantages is that you can have your XMPP server do server-side logging for all of your instant messaging accounts. Another important advantage—especially for mobile messaging—is that you only have to worry about connecting with one account, because the server handles all your other accounts.

The standard gateways that are most commonly used with ejabberd are a bunch of external Twisted-based Python applications that are collectively called the pytransports. You install and run the gateway applications and then modify the ejabberd configuration file so it can detect them. The pytransports are a bit crufty and resource intensive, so some ejabberd users might prefer the more efficient (but less mature) Spectrum project, which is built around Pidgin's libpurple.

The standard gateway solution for OpenFire is a Java-based application called Kraken. It can be installed as an OpenFire plugin and configured entirely through OpenFire's administrative Web interface.

Clients

Once you have your server set up, you will need an XMPP client. Most multi-protocol IM clients—including Pidgin, Trillian, and Adium—support XMPP out of the box. You can get a better experience, however, by using a dedicated XMPP client.

Users who are looking for an extremely powerful cross-platform client might appreciate Psi. Although Psi is kind of unpolished and has some rough edges, it has a ton of features and is extremely configurable. There are several flavors of Psi to choose from. In addition to Psi itself, there is also the development branch—called Psi+—which is less stable, but has even more features. Another good variant is Vacuum IM, which has a slightly cleaner user interface and some additional functionality.

GNOME users who are looking for something simple that fits in well with their desktop might want to look at Gajim. It feels a lot like Pidgin, but it's better tuned for XMPP.

These dedicated XMPP clients are particularly beneficial for users who rely on gateways, because they will abstract away a lot of the weirdness that is introduced by routing other services through XMPP. For example, Psi and Gajim will figure out which buddies on your roster are coming from a gateway connection and will adorn those buddies with an appropriate protocol icon. Similarly, Psi will simplify the process of adding a buddy for one of your gateway accounts.

Conclusion

Hosting your own XMPP server can be extremely useful and doesn't take a lot of effort. There are plenty of good open source implementations to choose from. As instant messaging continues to gain ground in the enterprise, it's likely that XMPP will play an important role in supporting business communication.

Channel Ars Technica