XMPP

Overview

Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language). The protocol was originally named Jabber, and was developed by the Jabber open-source community in 1999 for near real-time, instant messaging (IM), presence information, and contact list maintenance. Designed to be extensible, the protocol has also been used for publish-subscribe systems, signalling for VoIP, video, file transfer, gaming, Internet of Things (IoT) applications such as the smart grid, and social networking services. - XMPP on Wikipedia

There are a few XMPP servers in the Trisquel 7.0 LTS repositories, but we will be focusing on ejabberd as it provides a very accessible web interface, documentation and is fault-tolerant. XMPP servers will provide voice and audio support without any additional configuration.

The testing for this document was done with version 2.0.1 of ejaberd.


Installation

Install ejabberd form the repository (other methods of installation are documented by the authors): sudo apt-get install ejabberd

During the installation, a certificate will be generated for the server and will be stored in /etc/ejabberd/ejabberd.pem.

Configuration

The configuration files for ejabberd are in the directory /etc/ejabberd/.

The ejabberd.cfg file assumes that your hostname is localhost by default. To change this setting you will have to edit the following lines substituting localhost for your Fully Qualified Domain Name: %% Admin user

{acl, admin, {user, "", "localhost"}}.

%% Hostname

{hosts, ["localhost"]}.

Note: If you intend on changing your hostname in the future you have to recall to change this configuration file, because of the way ejabberd works with databases (you can read about this on the built-in documentation). So if you are planning on changing the name shortly, you should do it before changing this file.

You can verify you current FQHN with: hostname --fqdn

It is necessary to restart the server so the changes take effect. This can be done either with the scripts in /etc/init.d/ or with ejabberd's own control interface command: ejabberdctl restart

The ejabberdctl command is the back-end of the administration webpage so you will want to get familiar with this command for more than a basic configuration (the best place to refer to is it's man page as the other offline documentation is too brief).

The ejabberd web page will require an administrative user. Here is how to create a new user (replace fqdn for your FQDN, admin_user for the name of the new administrative user and password for admin_user's new password - this is a non Unix user): ejabberdctl register admin_user fqdn password

This new user does not have administrative privileges just yet. It is necessary to edit the following line within ejabberd.cfg, replacing admin_user for the name of the new user: %% Admin user

{acl, admin, {user, "admin_user", "fqdn"}}.

Restart the service once more: ejabberdctl restart

Files Overview

For a complete listing of the installed files you can consult ejabberd's built-in documentation on the webpage section "2.4.4 Install".
  • /etc/ejabberd/ejabberd.conf - Main configuration file for the service;
  • /etc/ejabberd/ejabberd.pem - Default private key and respective certificate;
  • /etc/ejabberd/inetrc - Network DNS configuration file specific to the server;

Web Page Initial Setup

If you have been following the configuration on this page, you should now be able to access the administrative web page through http://your_ip:5280/admin_user on a device within the same network. On this page you will get a prompt for your username and password. The username takes the format admin_user@fqdn.

The default webpage should look like: https://trisquel.info/files/ejabberd_web_page.png

Note: if there are any fewer menus than in the picture, there is very likely an issue with how you set up your hostname on the main configuration file for ejabberd.

Every page provides a quick link to the built-in documentation.

Through Virtual Hosts > your_hostname > Users you are able to create new users in the same way as the ejabberd command was used to create the administrative user.

Clients and Configuration

Clients differ in functionality and OS compatibility. The recommend client for Trisquel 7.0 is Pidgin, which supports a range of protocols including XMPP and is very stable. Pidgin supports video and audio communications by default, which is not the case for other clients.

Clients will need a username, password, the FQDN of the server, the network port and it's IP address/hostname/DDNS. The default port for clients is 5222. On the first communication they should automatically receive a prompt to import the server's certificate, in order to allow for encrypted communication.

Networking

The ejabberd service uses three different ports by default (consult the configuration file for other suggested ports):
  • 5222 - Client Communication (Client to server or c2s);
  • 5269 - Server Communication (Server to server or s2s);
  • 5280 - Server Webpage (HTTP by default);

In order to communicate with outside networks you will have to allow the respective ports through the network's router (if using NAT) and through the server's firewall, if you have installed it. Look into using DDNS services, if you have a dynamic IP address attributed by your Internet Service Provider.

References

  • Built in documentation on the webserver
  • Documents on /usr/share/doc/ejabberd/
  • The comments on the main configuration file

TODO

  • Extended security.
  • HTTPS administrative page.
AttachmentSize
ejabberd_web_page.png26.77 KB
ejabberd 2.1.pdf1.9 MB

Revisions

02/03/2015 - 12:44
Trisquelian