This tutorial explains how you can install MUCkl, an Ajax application that can be used to join an existing Multi-User Chat based chatroom via a web browser like Firefox. You can create persistent chatrooms using ejabberd's built-in Multi-User Chat module or by using an external component such as Mu-Conference. This tutorial is based on the French tutorial Installer MUCKl EJabberd.
-
Install MUCkl
Download the latest MUCKl and decompress it in the document root of your Web server.
-
Create a Jabber Account for MUCkl
Create a Jabber account for MUCkl. Check only the first step of the instructions to create an initial administrator account.
-
Create a Persistent Room
Create a persistent chatroom with a Multi-User Chat compatible Jabber client and ensure yourself that the user you created in previous step has sufficient permissions to this chatroom.
-
Configure MUCkl
Edit the file config.js in the directory where you unpacked MUCkl. The most important values are:
-
Use HTTP Polling:
var BACKENDTYPE = 'polling';
-
The URL to access the HTTP Polling service:
var HTTPBASE = "http-poll/";
-
Domain name of Jabber service:
var XMPPDOMAIN = "example.org";
-
The username and the corresponding password of the Jabber account you created in the second step:
var MUCKLJID = "username"; var MUCKLPASS = "password";
-
To define a chatroom:
var ROOMS = [ { name:'my chatroom', description:'My chatroom', server:'conference.example.org' } ];
-
Refresh rate:
var timerval = 1000;
-
-
Configure Apache
The module mod_proxy_http must be installed and configured:
a2enmod proxy /etc/init.d/apache2 restart
The HTTP Polling service runs by default on port 5280. However, Apache (which hosts MUCkl) runs on a different port. Hence, we should instruct Apache to redirect MUCkl's requests to the HTTP polling via the URL http://example.org:Apache_port/MUCkl_directory/http-poll to http://localhost:5280/http-poll. Therefore, it is necessary to add a .htaccess file in the directory in which you installed MUCKl. This file should contain the following information:
AddDefaultCharset UTF-8 Options +MultiViews <IfModule mod_rewrite.c> RewriteEngine On RewriteRule http-poll/ http://localhost:5280/http-poll/ [P] </IfModule>
-
Configure ejabberd
To configure ejabberd, you can choose between two methods.
-
Using the Web Administration Interface
Go in the web interface to Nodes/your node/Listened Ports, enter the following information on the last line, and press the Add button:
Port Module Options 5280 ejabberd_http [http_poll, web_admin] -
Using ejabberd.cfg
Edit ejabberd's configuration file; add the following two lines in the section starting with '{listen,' (also described in the guide). You have to restart ejabberd afterwards to apply the changes:
{5280, ejabberd_http, [http_poll, web_admin]},
Remark that there is no ending comma needed in the last entry. However, all entries before the last one need to end with a comma!
Note that you can host the web administration interface and the HTTP Polling component on different ports. For example, you can host the web interface on a secured port, and HTTP Polling on another unsecured port. Check the examples in the Web Interface section of the guide.
-
Authentication Methods
ejabberd and MUCkl allow several authentication methods. Example configurations:
-
Normal authentication
In ejabberd.cfg{auth_method, [internal]}.
In MUCkl config.jsvar ANON_AUTHTYPE = 'nonsasl'; var XMPPDOMAIN = "localhost"; // domain name of jabber service to be used var MUCKLJID = "muckl"; // username var MUCKLPASS = "mucklpass"; // password
You must create the account muckl@localhost with password 'mucklpass'. MUCkl will login to the account muckl@localhost/randomresource. -
Anonymous login authentication
In ejabberd.cfg{auth_method, [anonymous]}. {anonymous_protocol, login_anon}.
In MUCkl config.jsvar ANON_AUTHTYPE = 'anonymous'; var XMPPDOMAIN = "localhost"; // domain name of jabber service to be used var ANONHOST = "localhost"; // hostname of sasl anonymous service
MUCkl will login to the virtual account undefined@localhost/undefined -
SASL anonymous authentication (it doesn't seem to work correctly)
In ejabberd.cfg{auth_method, [anonymous]}. {anonymous_protocol, sasl_anon}.
In MUCkl config.jsvar ANON_AUTHTYPE = 'saslanon'; var XMPPDOMAIN = "localhost"; // domain name of jabber service to be used var ANONHOST = "localhost"; // hostname of sasl anonymous service
install on debian
i tried to follow all the instruction above.
the ejabberd server is working , with admin account and persistant room.
and all the other configurations.
but when i log in there is just a blank screen with only a background image.
no error messages (apache, ejabberd, firebug...)what so ever.
can you help me?
p.s.
apache is configured correctly to reach hostname.tld/http-poll
most likely too late for the
most likely too late for the OP, but i hope this would help somebody else.
i had the same problem using Chrome web browser, something to do with CORS (and to allow that i need to deliver specific header entries in response, didn't have time for rebuilding from source etc.)
quick work-around is to use "binding" type instead of "polling", also needs to configure "/http-bind" for Apache's mod_rewrite, port is the same, target path is "http-bind" (essentially replace "poll" with "bind"), then point HTTPBASE in config.js to "/http-bind". one last thing, enable mod_http_bind in "modules" section in ejabberd.cfg
Create a persistent room with muckl?
> Create a Persistent Room
>
> Create a persistent chatroom with a Multi-User Chat compatible Jabber client and ensure
> yourself that the user you created in previous step has sufficient permissions to this chatroom.
Does anyone know if muckl can create a persistent room? I have ejabberd.cfg configured for persistent rooms as the default, but if I connect to ejabberd with muckl (even if I configure muckl to use the ejabberd admin username/password), it will create a room, but it is not persistent. If the ejabberd service is restarted, the room is dropped. I want admins to create rooms by entering the room with muckl and then non-admin users can enter those rooms with muckl. But I don't want non-admins to be able to create a room. Here's my settings:
{mod_muc, [
%%{host, "conference.@HOST@"},
{access, muc},
{access_create, muc_admin},
{access_persistent, muc_admin},
{access_admin, muc_admin},
{history_size, 20},
{min_message_interval, 0.4},
{min_presence_interval, 4},
{default_room_options,
[
{allow_change_subj, false},
{allow_private_messages, false},
{allow_query_users, false},
{allow_user_invites, false},
{allow_visitor_nickchange, false},
{allow_visitor_status, false},
{anonymous, true},
{logging, true},
{max_users, 200},
{members_by_default, true},
{members_only, false},
{moderated, false},
{password_protected, false},
{persistent, true},
{public, false},
{public_list, false},
{title, "chatroom"}
]}
]},
With your configuration, the
With your configuration, the new rooms are persistent, but they are not publicly visible in the Service Discovery. Make sure you have this to true:
Create a persistent room with muckl?
Yes, that makes the rooms public, I understand. But still if the server is rebooted or ejabberd restarted, those rooms created through muckl no longer exist (are no longer accessible). So they are not really persistent for some reason. I have muckl customized so that there are no predefined rooms in its config file. Rooms are created when an admin uses a specially configured muckl (that authenticates with the ejabberd admin account) to access a room. Then non-admin users use another installation of muckl that authenticates with a regular user account to access the room. It all works well until the server is rebooted or ejabberd restarted. Then the regular users get error "Room creation is denied by service policy" when they enter a room because the room doesn't exist anymore and only admins have the rights to create a room.
Now, if I create a room using a jabber client like Exodus, then the rooms ARE persistent and survive a restart/reboot. But only when the rooms are created via an admin using muckl are the rooms not persistent.
Create a persistent room with muckl?
Oops, my mistake. I believe the problem is a coding issue with my modified version of muckl. I've been able to successfully create persistent rooms using a clean copy of muckl, so the problem must be with my modified version. I'll get it straightened out. Sorry for the distraction!
Internal Server Error
After some time in a channel, connected with Muckl to ejabberd, i get a "Internal Server Error, Reconnect ?" popup. Nothing in ejabberd logfile.
With other clients i have no problems. i use http binding. What could cause the Internal Server Error ?
account lock down
It would be nice if you could add how to stop the muckl user on the server from doing anything that isn't needed for Muckl.
At the moment any jabber client can be log in using the muckl credentials stored in config.js, change the password, send messages to random users and everything else a normal user can do.
Blacklisting IPs would be handy too. (Could this work when the traffic is proxied by the webserver?)
Muckl's great :)
How to prevent password change
At the moment any jabber client can be log in using the muckl credentials stored in config.js, change the password,
If the Jabber account used my MUCkl ismuckl@example.org , this will prevent him from changing the password or registering new accounts:
send messages to random users and everything else a normal user can do.
I can only think of two possibilities: using privacy lists or Legoscia's mod_filter.
>> Port Module
>> Port Module Options
>> 5280 ejabberd_http [http_poll, web_admin]}]
Shouldn't it be
Port Module Options
5280 ejabberd_http [http_poll, web_admin]
?
Fixed
Yes, thanks, fixed.
Modules need to be loaded on Apache2
Hey,
I had some problems with Apache2 and HTTP-Polling. The thing that needs to be done: You need the mod_rewrite and ALL proxys (proxy proxy_connect proxy_http)
And alter apache2/mods-enabled/proxy.conf and add the allowed domain.