Introduction

This tutorial will help you to install an instant messaging server with Prosody. Prosody is a communication server using the protocol XMPP which allows for instant messaging either for you or for your business, it is usable on all terminal types. Using a standard protocol let use it with any XMPP client.

Info : a list of XMPP clients more or less up to date is available on Wikipedia. Personally, I use Gajim on Linux and Jitsi on Windows.

Prerequisite

You will only need a Linux server with a root access. I will also explain how to link accounts to Active Directory.

Installation of Prosody

Method 1

To install Prosody, you can do it via the packages :

sudo apt-get update
sudo apt-get install prosody

Ubuntu Server ( 14.04.4 LTS ), the deposit is up to date and offers the latest version.

Method 2

You can also add the repos of Prosody which will be easier to maintain :

Configuration

You will have now set Prosody. The first thing to do is create a VirtualHost in a configuration file. Prosody configuration files are ended with .lua.

Go to the Prosody directory and look at what is in folders :

cd /etc/prosody
ls -l

You should have the following folders:

certs that will contains your certificates and keys.

conf.d which will be active configurations (much like Apache or Nginx system) using symbolic links.

conf.avail : available configuration files.

You will now create a configuration file.

Replace mail.fr by the name of your domain to match your configuration. In this tutorial, we’ll use email, so users log in with their email instead of their Active Directory login. Also it displays the status of the people in Outlook (if you have Jitsi). So I’ll make it with mail for this tutorial.

Your virtual hostname will be the address to use to connect : eg ` user@mail.fr`.

You can also disable the host by adding the line enabled = false after.

The Components are modules that you can add to the prosody server. In this case, a MUC is defined (“Multi-user Chat” : in short, a “room”), with corresponding addresses (salons.mail.fr).

Putting admin for restrict_room_creation only allows administrators to create persistent room ! This means that other users can only create temporary conferences. Most XMPP client then propose administrators to configure the rooms as they wish. If you do not want this feature, simply delete the line.

Authentication

Here’s how to set an administrator for Prosody. Open the main configuration file (sudo vi prosody.cfg.lua) and add your user. You can also take the opportunity to browse the file. It is fairly well explained.

admins={"admin@mail.fr"}

Prosody can manage authentication with your AD server. As said above, we will ensure that people can connect with their email. To achieve this, it is necessary that email is obviously set in your AD for each user.

Manage Certificates

With Prosody, you can define certificate (self-signed or not) for each VirtualHost. In the main configuration file (prosody.cfg.lua), you should have the following lines :

-- These are the SSL/TLS-related settings. If you don't want-- to use SSL/TLS, you may comment or remove thisssl={key="/etc/prosody/certs/localhost.key";certificate="/etc/prosody/certs/localhost.crt";}

These lines indicate the path to the key and certificate to the localhost server and Prosody server. It is therefore defined two times. As you can see, the localhost server is disabled ( enabled = false). So it should not bother us.

By cons, for your new virtual server (mail.fr), it would be redefined.

The goal here is to have a certificate authority (localhost) and therefore our sign other certificates.

Install Lua-expat 1.3

If you have a version problem for lua-expat, you must add the repository universe of vivid (sudo vi /etc/apt/sources.list) :

debhttp://us.archive.ubuntu.com/ubuntuvividmainuniverse

Then updates the deposits and install lua-expat :

sudo apt-get update
sudo apt-get install lua-expat

Note : during the update packages, it is possible that you have errors. Install lua-expat and then you can comment out the line added in sources.list.

Generate a request file

Now in order to generate our ssl certificate for our virtual host mail.fr, you must have a request file :

sudo prosodyctl cert request mail.fr

Type Enter to validate data by default or enter new information. It should look something like this :

This means that the creation of rooms will be possible only by administrators. Moreover, the rooms are created by the client !

You will have the option in your client to define whether the show is permanent, open, protected by a password,… Other people connected can then search for available rooms in their client and connect if they have the sufficient rights.

Word of the Day

You can set a word of day, adding the following line (in prosody.cfg.lua) :

motd_text=[[Welcome on Instant messaging server.]]

Restart prosody to apply the change.

Plugins Paths

If you take the urge to add more plugins, you can set the path thereof through the following :

Conclusion

In the end, Prosody is very comprehensive. There are obviously other XMPP server but I find that Prosody provides everything you need for instant messaging and allows you to configure your connections accurately.