Friday, December 23, 2016

Enable the MUC (Multi User Chat) in Prosody

Enabling Components in prosody server



In the XMPP world, many services are provided in components, which allows for greater ease of customization within a basic framework. A common example of this is the MUC or multi-user chat functionality. To enable MUC services in Prosody you need to add a line like the following to your
/etc/prosody/prosody.cfg.lua file.

/etc/prosody/prosody.cfg.lua

Component "conference.example.com" "muc"

In this example, conference.example.com is the domain where the MUC rooms are located, and will require an “DNS A record,” that points to the IP Address where the Prosody instance is running. MUCs will be identified as JIDs (Jabber IDs) at this hostname, so for instance the “rabbits” MUC hosted by this server would be located at rabbits@conference.example.com.

MUC, in contrast to many other common components in the XMPP world, is provided internally by Prosody. Other components, like transports to other services, run on an external interface. Each external component has its own host name, and provides a secret key which allows the central server to authenticate to it. See the following “aim.example.com” component as an example.

/etc/prosody/prosody.cfg.lua

Component "aim.example.com"
component_secret = "mysecretcomponentpassword"
Note that external components will need to be installed and configured independently of Prosody.

Typically, Prosody listens for connections from components on the localhost interface (i.e. on the 127.0.0.1 interface;). If you’re connected to external resources that are running on an alternate interface, specify the following variables as appropriate in the global section of the configuration file before the first VirtualHost declaration.

/etc/prosody/prosody.cfg.lua

component_interface = "192.168.0.10"
component_ports = { 8888, 8887 }

Using prosodyctl


The XMPP protocol supports “in-band” registration, where users can register for accounts with your server via the XMPP interface. However, this is often an undesirable function as it doesn’t permit the server administrator the ability to moderate the creation of new accounts and can lead to spam-related problems. As a result, Prosody has this functionality disabled by default. While you can enable in-band registration, we recommend using the prosodyctl interface at the terminal prompt.

If you’re familiar with the ejabberdctl interface from ejabberd, prosodyctl mimics its counterpart as much as possible.

To use prosodyctl to register a user, in this case username@example.com, issue the following command:


prosodyctl adduser username@example.com
To set the password for this account, issue the following command and enter the password as requested:


prosodyctl passwd username@example.com
To remove this user, issue the following command:

prosodyctl deluser username@example.com
Additionally, prosodyctl can provide a report on the status of the server in response to the following command:


prosodyctl status
Note that all of the prosodyctl commands require root privileges, unless you’ve logged in as the same user that Prosody runs under (not recommended).

No comments:

Post a Comment