Jabber setup

Updated 7 March 2019

XMPP

Introduction

XMPP (Extensible Messaging and Presence Protocol, previously known as Jabber) is an XML-based, open, easy-to-use protocol for instant messaging and near real-time status information. User accounts and groups are stored on the OpenLDAP server, and Ejabberd is used as a XMPP server. The necessary software is included with [Calculate Directory Server] (cds).

Configuring a LDAP server

Calculate Utilities store user accounts and groups on a OpenLDAP server. First configure the LDAP service according to the manual.

Jabber server configuration

First install your Jabber service:

cl-setup jabber
* WARNING: Running this program will modify the configuration files of the Jabber service (Ejabberd). If you want to continue, enter 'yes', else enter 'no': yes 

Enter password for admin@calculate.spb.calculate.ru
New password:
Repeat new password:
* User added to Jabber service
* Added ldif file ...                                                            [ ok ]
* Starting Ejabberd ...                                                          [ ok ]
* Jabber service configured ...                                                 [ ok ]

Once completed, Jabber will be configured with default settings. The hostname of the Jabber service will be the hostname of the computer.

To specify additional Jabber hosts, use the --hosts parameter.

While setting up the service, enter the password for the admin account.

Accounts

Each user on the network has a unique identifier, a Jabber ID, or JID . Like the email, a JID address contains the user name and the domain name of the server on which the user is registered, separated by the @ sign. For example, a user registered on example.org will have the following JID address: user@example.org.

To add a Jabber account, use the cl-useradd command.

To add a user nicknamed Guest , guest@example.org, run:

cl-useradd -p -c "Guest" guest jabber
New password:
Repeat new password:
* User added to Jabber service

To add user guest@example.org with nickname Guest~ and set a photo for them, run the following:

cl-useradd -p -c "Guest" -i pic/guest.png guest jabber

Note

Supported image formats are determined by the functionality of ImageMagick. If it is not in the system, only the jpeg format will be available.

To change the password of a Jabber account, use cl-passwd. For instance, to change the password for guest, run:

cl-passwd guest jabber
New password:
Repeat new password:
* Password of Jabber user modified

To lock a user account, use cl-usermod -L. For instance, to lock guest, run:

cl-usermod -L guest jabber
* User guest of Jabber service locked

To unlock an account, run cl-usermod -U. For instance, to unlock guest, run:

cl-usermod -L guest jabber
* User guest of Jabber service unlocked

To remove an account from Jabber, run cl-userdel. For instance, to remove guest, run:

cl-userdel guest jabber
* User guest of Jabber service removed

Groups

A group is a set of JIDs used to send messages to several users at the same time. When a user connects to Jabber, they will automatically receive a list of groups and their members. Users without groups have to be added manually to the contact list. Each user can only belong to one group.

To create a Jabber group, use the cl-groupadd command. For instance, to create a group named "Testing Group", run:

cl-groupadd "Testing Group" jabber
 * Group 'Testing Group' added to Jabber service

To rename an existing Jabber group, use cl-groupmod. For example, to rename 'Testing Group' to 'My Test', run as follows:

cl-groupmod -n 'My Test' 'Testing Group' jabber
 * Group renamed to My Test

To manage a Jabber group, use the cl-groupmod and cl-usermod commands. To add user guest to group 'Guest Group', run cl-usermod as shown below:

cl-usermod -g "Guest Group" guest jabber
* User group modified

To remove user guest from group 'Guest Group', run:

cl-groupmod -d guest "Guest group" jabber
* Users removed from group Guest Group

To add users guest and guest2 to 'Guest group', run:

cl-groupmod -a guest,guest2 "Guest group" jabber
* Users added to group Guest Group

Restrictions

If you have more than one network interface on your server while working on only one of them, add the corresponding ip directive to /etc/jabber/ejabberd.yml: "192.168.0.2" to the listen section:

/etc/jabber/ejabberd.yml

...
listen:
  -
    port: 5223
    module: ejabberd_c2s
    max_stanza_size: 65536
    tls: true
    ip: "192.168.0.2"
    certfile: "/etc/jabber/ssl.pem"
    shaper: c2s_shaper
    access: c2s
...