Ejabberd Configuration: Difference between revisions

From OLPC
Jump to navigation Jump to search
(fix URL to mod_ctlextra patch for 1.1.x)
(Removing all content from page)
Line 1: Line 1:
{{OLPC}}

The OLPC Jabber server at jabber.laptop.org was running ejabberd 1.1.3 with a few extra modules and patches, but is now trialling ejabberd 2.0 from SVN trunk to see if it aids stability (see [http://dev.laptop.org/ticket/5313 #5313]). We're aiming to reduce the odd configuration and patches in favour of a self-contained server component which can be connected up (using [http://www.xmpp.org/extensions/xep-0114.html XEP-0114]) to any unmodified Jabber server to carry out OLPC's activity and buddy indexing/searching (see [[XMPP Extensions]]). We're not there yet, so in the mean time if you want to run your own server...

We are also working on experimental support of [http://www.igniterealtime.org/projects/openfire/index.jsp Openfire]. See [[Openfire_Configuration]]

== Patches ==

XOs use an extension called PEP ([http://www.xmpp.org/extensions/xep-0163.html XEP-0163: Personal Eventing via PubSub]) to publish information about OLPC-specific buddy properties (key, colour, etc) and the activities people are taking part in. At the present time, [http://www.dtek.chalmers.se/~henoch/text/ejabberd-pep.html ejabberd's PEP support] comes from an external project, which enhances the existing mod_pubsub. It is stored in [https://svn.process-one.net/ejabberd-modules/ ejabberd-modules] SVN repository.

There is a backport of the work to 1.1.x in pep/branches/1.1.2. The build system for this seemed pretty weird, it seems to involve lightly modified copies of files copied from the ejabberd source tree, so I turned it into a patch against the ejabberd source itself.

We also have a patch to the shared roster support so that already-connected clients are notified about new accounts which are registered after you connect (this happens a lot in development environments). There's also a mod_ctlextra patch which you may apply to add some extra features to the ejabberdctl command (see Tips below).

You should apply all of these patches:
* [http://people.collabora.co.uk/~robot101/olpc-ejabberd/pep.diff pep.diff]
* [http://people.collabora.co.uk/~robot101/olpc-ejabberd/shared_roster_push.diff shared_roster_push.diff]
* [http://people.collabora.co.uk/~robot101/olpc-ejabberd/mod_ctlextra.diff mod_ctlextra.diff]

For those running Debian, there are also packages available [http://people.collabora.co.uk/~robot101/olpc-ejabberd/ here].

'''Ejabberd 2.0''': We are currently trialling SVN trunk of ejabberd on jabber.laptop.org, which can be obtained with:
svn co http://svn.process-one.net/ejabberd/trunk
In this case, the PEP patch is unnecessary, and an updated copy of the shared roster patch is required, so the following patches are necessary:
* [http://people.collabora.co.uk/~robot101/olpc-ejabberd/shared_roster_push2.diff shared_roster_push2.diff]
* [http://people.collabora.co.uk/~robot101/olpc-ejabberd/mod_ctlextra.diff mod_ctlextra.diff]

== Configuration ==

=== Enable Modules ===

As well as normal ejabberd configuration (setting your hostname and configuring an admin user), you must enable the following modules in the configuration file:
* mod_caps
* mod_muc
* mod_pubsub
* mod_ctlextra

'''Note that PEP fails in very cryptic ways if mod_caps is not enabled.'''

=== MUC ===

The default MUC configuration is to assume that conference.yourserver is a valid hostname. This isn't actually important for the XOs, but it must exist from the perspective of the server. You could put it into <tt>/etc/hosts</tt> for example.

=== Disable S2S ===

Currently the XOs don't do a very good job with authorisation because they assume that only other XOs eg from the same school will be connected to the server, and "all see all" is an acceptable policy. For Internet-connected servers, it's best to disable "s2s" (server to server) connections to avoid people from outside connecting in and breaking this assumption. Change:
{5269, ejabberd_s2s_in, [{shaper, s2s_shaper},
{max_stanza_size, 131072}]},
To:
% {5269, ejabberd_s2s_in, [{shaper, s2s_shaper},
% {max_stanza_size, 131072}]},

As a trivial optimisation, you can also edit the configuration of mod_disco to stop clients calling out to users.jabber.org, which will always fail because s2s is disabled. Change:
{mod_disco, [{extra_domains, ["users.jabber.org"]}]},
To:
{mod_disco, []},

'''Ejabberd 2.0''': In ejabberd 2.0 you can also explicitly disable s2s connections like this:
{s2s_default_policy, deny}.

=== Enable Old-Style SSL ===

'''Ejabberd 2.0''': In ejabberd 2.0, old-style SSL connections on port 5223 are disabled by default. The XOs have an old version of loudmouth which does not support TLS, but old-style SSL is still used so that we can benefit from in-band DEFLATE compression (see [http://dev.laptop.org/ticket/4936 #4936]). Make sure that support for port 5223 is enabled by uncommenting (delete the %%s) the following in the {listen} section:
{5223, ejabberd_c2s, [
{access, c2s},
{shaper, c2s_shaper},
tls, {certfile, "/etc/ejabberd/ejabberd.pem"},
{max_stanza_size, 65536}
]},

=== Raising The Limits ===

Until a few constants are tweaked (see [http://dev.laptop.org/ticket/5018 #5018]), the XOs send larger than normal stanzas through the server, which triggers a maximum stanza size limit and can make the jabber server disconnect you eg when inserting an image into a shared document. To fix this, we raise the maximum stanza limit. Change:
{max_stanza_size, 65536},
To:
{max_stanza_size, 524288}
In both the port 5222 and port 5223 ejabberd_c2s listen stanzas.

You can also aid interactivity by allowing the clients to send data at a faster rate by changing:
{access, c2s_shaper, [{none, admin},
{normal, all}]}.
To:
{access, c2s_shaper, [{none, admin},
{fast, all}]}.

=== Enable IPv6 ===

IPv6 connectivity should be enabled by adding the 'inet6' keyword to the port configuration in the {listen} section. For example, change:
{5222, ejabberd_c2s, [
{access, c2s},
{shaper, c2s_shaper},
{max_stanza_size, 524288}
]},
To:
{5222, ejabberd_c2s, [
inet6,
{access, c2s},
{shaper, c2s_shaper},
{max_stanza_size, 524288}
]},

Do this for all of the items in the {listen} section: ejabberd_c2s on port 5222, ejabberd_c2s on port 5223, and ejabberd_http on port 5280.

== Setting Up Shared Roster ==

'''You must perform this step by logging in to ejabberd's web admin interface, or your XOs will never see any buddies.'''

Log in as your ejabberd's administrative user on the web admin interface at http://yourserver:5280/admin/ and select Virtual Hosts, then your server hostname, then Shared Roster. Add a group called Everybody with the following settings:
* Name: Everybody
* Members: @all@
* Displayed Groups: Everybody

See [http://ejabberd.jabber.ru/shared-roster-all here] for more information.

== Tips ==

Every time you flash an XO, it will generate a new key and hence register a new account on the server. This can lead to quite a lot of accounts floating around on the server, so you get more and more irrelevant users which will never be used again. If you applied the mod_ctlextra patch, you may use <tt>ejabberdctl delete-older-users 30</tt> to delete users who havn't logged in for a month, for example. Note that this will probably also delete your admin account because you're unlikely to ever log into it using a Jabber client, but you can re-add it with <tt>ejabberdctl register yourserver admin password</tt>.

Set the pubsub_items database to be stored in RAM and Disk (j.l.o was write-bound and using 100% CPU).

Revision as of 01:29, 18 December 2007