Home computing
Instant messaging
XMPP

XMPP (Extensible Messaging and Presence Protocol, formerly known as Jabber) is an Internet standard for instant messaging.

Client applications come on all platforms and freely available XMPP servers can be run with the RUNSTOP free C2N hostname.

This guide explains how to setup an account on your own XMPP server on a Debian Linux PC (Raspberry Pi) and chat with other XMPP users on a smartphone.

An XMPP server on your PC provides an Internet standard way to talk to other people using instant messaging (IM). XMPP IM is similar to SMS text but is not restricted to mobile phones and doesn't require a phone number.

People are indentified by a name at a domain. This looks like an e-mail address, however, e-mail is not supported by XMPP and an e-mail service running in parallel would be neccessary for SMTP.

Using your C2N hostname, accounts can be created on your PC supporting as many people as required. If your RUNSTOP login were 'london', a person named 'bigboss' may be identified on your PC and contacted as bigboss@london.c2n.uk.

Using the Internet, person to person communication is performed with a client application which sends messages via the server. The server will handle delivery to the destination or store messages for later retrieval. One such XMPP server is known as Prosody IM.

Prosody can be found and is documented at the the official site here. In this document we shall be installing prosody from the Debian Linux archive on the Raspberry Pi.

First off we get our Raspberry Pi up to date.

sudo apt-get update
sudo apt-get dist-upgrade

If you're prompted to continue answer Y for yes. The upgrade process may take a while, especially when updating the Linux kernel, please be patient.

Now to install Prosody IM.

sudo apt-get install prosody prosody-modules

After this process completes Prosody will be up and running but not configured.

In the first stage of configuration we will add a new host which will be your C2N hostname. For this example 'london' is chosen to demonstrate this, replace it with your login.

To add the host we will use a text editor and append some lines to the default configuration. Debian Linux recommends not editing the default configuration file, however, the Prosody control application will not work otherwise.

Start the editor and then proceed to the end of the file.

sudo nano /etc/prodosy/prosody.cfg.lua

Now add the following lines (indent using the tab key).

VirtualHost "london.c2n.uk"
        enabled = true
        ssl = {
            key = "/var/lib/prosody/london.c2n.uk.key";
            certificate = "/var/lib/prosody/london.c2n.uk.crt";
        }

Now, after saving the file, we create a TLS certificate used to encrypt our sessions. When prompted use the default answer for each question.

sudo prosodyctl cert generate london.c2n.uk

Now to add a user. Of course you can add as many users as you like.

sudo prosodyctl adduser me@london.c2n.uk

In this very last step we will restart Prosody to allow our changes to take affect and be ready to accept connections.

sudo /etc/init.d/prosody restart

Connections to your home broadband from the Internet will normally be firewalled. For XMPP two Internet Protocol (IP) ports must be enabled for traffic to pass to your XMPP server.

Configuration is similar to the document explaining website access to your Pi found here. The differences are that for XMPP two ports must be opened and directed to your Pi rather than one and these ports are specific to XMPP.

The ports of interest are 5222 which is used by client software to send messages via your server, and 5269 which is used by servers to forward messages between eachother.

Once these ports are setup and forwarded the server is ready for a client.

Client applications are used by account holders to send and receive messages and to manage and subscribe to contacts. Contacts, once identified, have accessible profiles and also allow subscription (by authorisation) to a persons current status, such as being Available or Away.

XMPP application software comes on all platforms such as the Linux desktop and Android mobile phones. Desktop programs include 'Gajim' and on mobile, 'Conversations'. The former is free and the latter is available from the Google Play store as both paid and free versions.

Gajim if a free application for XMPP available in the Debian Linux repository.

Install Gajim and run it from the desktop menu. Gajim can be found under Internet in the XFCE desktop environment, for example.

sudo apt-get install gajim

At initial run, a number of questions are asked to setup your account and make a server connection.

  1. First choose "I already have an account I want to use" and select "Forward" to continue.
  2. It will ask for a Jabber (XMPP) identifier. Enter your details here, in this example, they were bigboss and london.c2n.uk. Enter the password and select "Forward".
  3. Account addition is now complete, select "Connect when I finish" and "Finish".
  4. Lastly a server connection is made, on the very first attempt it will say "Error verifying SSL certificate". This is because we created a self-signed TLS certificate, this is all we need and is fine. Choose "Add" and end with "OK".

Gajim is now ready to use with your XMMP account, change the account status to available and send a message to a friend via your own server.

Conversations Legacy is a freely available version of the Conversations XMPP instant messaging app available on the Google Play store for Android.

Find the app in the store and install it. On the first run we add our account.

  1. First choose "USE MY OWN PROVIDER" at the bottom of the page.
  2. It will ask for a Jabber (XMPP) identifier. Enter your details here, in this example, they were bigboss@london.c2n.uk. Enter the password and select "NEXT".
  3. A server connection is made, on the very first attempt it will say "Accept Unknown Certificate". This is because we created a self-signed TLS certificate, this is all we need and is fine. Choose "ALWAYS".
  4. Lastly, you can choose an avater image, after doing so select "PUBLISH".

Conversations Legacy is now ready to use with your XMMP account, change the account status to available and send a message to a friend via your own server.

This is the end of this document but there is much more to XMPP.

For example, you can setup the OMEMO plugin for Gajim and use it for secure communications. Although we use TLS encryption for our sessions, other servers may not, and OMEMO will provide end to end encryption.

Good luck with XMPP!