Notes about ejabberd

From Kosmos Wiki
Jump to navigation Jump to search

Technology

Erlang

XMPP RFC and XEP support

Official documentation

https://docs.ejabberd.im/

Download official up-to-date packages

https://www.process-one.net/en/ejabberd/downloads

The official Debian/Ubuntu package includes a systemd service: /opt/ejabberd-17.08/bin/ejabberd.service

Configuration

https://docs.ejabberd.im/admin/configuration/

Include config file: include_config_file: "/etc/ejabberd/additional.yml"

Reload configuration

sudo /opt/ejabberd-17.08/bin/ejabberdctl reload_config

Database

Supported databases: Mnesia (Erlang, default), MySQL, PostgreSQL, etc

Warning from the default config file about Mnesia limitations for MAM

XEP-0313: Message Archive Management

You might want to setup a SQL backend for MAM because the mnesia database is limited to 2GB which might be exceeded on large servers

It is possible to migrate from Mnesia to an SQL database

Shared roster

Doc says "Shared roster groups can be edited only via the Web Admin (https://docs.ejabberd.im/admin/configuration/#mod-shared-roster)” but the command line tool works:

sudo /opt/ejabberd-17.08/bin/ejabberdctl srg_create everyone ubuntu-xenial everyone Everyone everyone
sudo /opt/ejabberd-17.08/bin/ejabberdctl srg_user_add @all@ ubuntu-xenial everyone ubuntu-xenial

Import data from prosody

https://docs.ejabberd.im/admin/guide/managing/

import_prosody import_dir: Import data from Prosody server. import_dir is typically /var/lib/prosody/. Currently the following data is imported: vcards, accounts, rosters, private data (e.g. conference bookmarks), conferences, offline messages and privacy lists.

Gotchas

YAML configuration: strings must be double quoted because of Erlang internals, so we can't use the default Ruby YAML generator to generate it (it generates strings without quotes unless it's required, per YAML spec)

Multiple hosts, example config

hosts:
  - "example.org"
  - "example.com"
host_config:
  "example.org":
    domain_certfile: "/opt/ejabberd-17.09/conf/example_org.pem"
  "example.com":
    domain_certfile: "/opt/ejabberd-17.09/conf/example_com.pem"
## host_config:
##   "public.example.org":
##     auth_method: anonymous
##     allow_multiple_connections: false
##     anonymous_protocol: sasl_anon
##
## To use both anonymous and internal authentication:
##
## host_config:
##   "public.example.org":
##     auth_method:
##       - internal
##       - anonymous