We are pleased to announce ejabberd version 19.08. The main focus has been to further improve ease of use, consistency, performance, but also to start cleaning up our code base. As usual, we have kept on improving server performance and fixed several issues.
New Features and improvements
New authentication method using JWT tokens
You can now authenticate with JSON Web Token (JWT, see jwt.io for details).
This feature allows you to have your backend generate authentication tokens with a limited lifetime.
Generating JSON Web Key
You need to generate a secret key to be able to sign your JWT tokens.
To generate a JSON Web Key, you can for example use JSON Web Key Generator, or use your own local tool for production deployment.
The result looks like this:
Save you JSON Web Key in a file, e.g. secret.jwk.
Be careful: This key must never be shared or committed anywhere. With that key, you can generate credentials for any users on your server.
Configure ejabberd to use JWT auth
In ejabberd.yml change auth_method to jwt and add the jwt_key option pointing to secret.jwk:
Generate some JWT tokens
See jwt.io for an example of how to generate JSON Web Tokens. The payload must look like this:
And the encoded token looks like this:
Authenticate on XMPP using encoded token as password
Now, the user firstname.lastname@example.org can use this token as a password before 1564436511 epoch time (i.e. July 29, 2019 21:41:51 GMT).
New configuration validator
With ejabberd 19.08, we introduce a new configuration checker, giving more precise configuration guidance in case of syntax errors or misconfiguration. This configuration checker has also been released as an independent open source project: yconf.
The new configuration validator makes it possible to improve the configuration parsing. For example, it supports the following:
Better handling of Erlang atom vs string
There is not need to quote string to express the fact you want an atom in the configuration file: the new configuration validator handles the Erlang types mapping automatically.
More flexible ways to express timeouts
Now, all timeout values can be expanded with suffixes, e.g.
s2s_timeout: 10 minutes
cache_life_time: 1 hour
If the suffix is not given, the timeout is assumed in seconds
Atomic configuration reload
The configuration will either be fully reloaded or rolled back.
Better, more precise error reporting
Here are a couple of examples of the kind of message that the new configuration validator can produce.
In the following example, the validator will check against a value range:
14:15:48:32.582 [critical] Failed to start ejabberd application: Invalid value of option loglevel: expected integer from 0 to 5, got: 6
More generally, it can check value against expected types:
15:51:34.007 [critical] Failed to start ejabberd application: Invalid value of option modules->mod_roster->versioning: expected boolean, got string instead
It will report invalid values and suggest fixes in case error was possibly due to a typo:
15:50:06.800 [critical] Failed to start ejabberd application: Invalid value of option modules->mod_pubsub->plugins: unexpected value: pepp. Did you mean pep? Possible values are: flat, pep
Prevent use of duplicate options
Finally, it will also properly fail on duplicate options and properly report the error:
15:56:35.227 [critical] Failed to start ejabberd application: Configuration error: duplicated option: s2s_use_starttls
It was a source of error as an option could shadow another one, possibly in an included file.
We improve scalability of several modules:
MUC Room modules is more scalable, allowing supporting more rooms, by hibernating the room after a timeout. Hibernating means removing it from memory when not used and reloading it on-demand.
The MUC messages processing has also been changed to now properly handle all the available CPU cores. MUC room message handling is now faster and support larger throughput on SMP architectures
SQL database handling
We improve the way the SQL pool is managed to better handle high load. We also improved MySQL schema a bit to help with indexing.
Changed implementation of mod_offline option use_mam_for_storage
Previous version was trying to determine the range of messages that should be fetched from MAM by storing time when last user resource disconnected. But that had couple edge cases that could cause problems, for example in case of hardware node crash we could not store information about user disconnect and with that we didn’t have data to initiate MAM query.
The new version doesn’t track user disconnects, but simply ensure that we have timestamp of first message that is gonna be put in storage, after some measurements cost of that check with caching on top is not that costly, and as it is much more robust we decided to move to that safer approach.
New option captcha_url
Option captcha_host is now deprecated in favor of captcha_url. However, it’s not replaced automatically at startup, i.e. both options are supported with ‘captcha_url’ being the preferred one.
Deprecated ‘route_subdomains’ option
This option was introduced to fulfil requirements of RFC3920 10.3, but in practice it was very inconvenient and many admins were forced to change its value to ‘s2s’ (i.e. to behaviour that violates the RFC). Also, it seems like in RFC6120 this requirement no longer presents.
Those admins who used this option to block s2s with their subdomains can use ‘s2s_access’ option for the same purpose.
Renamed arguments from ‘Server’ to ‘Host’
Several ejabberd commands still used as argument name ‘Server’, instead of the more common ‘Host’. Such arguments have been renamed, and backward support allows old calls to work correctly.
The eight affected commands are:
If you are using these calls, please start updating your parameter names to Host when moving to ejabberd 19.08. You will thus use a more consistent API and be future proof.
Removed Riak support
- Riak DB development is almost halted after Basho
- riak-erlang-client is abandoned and doesn’t work correctly with OTP22
- Riak is slow in comparison to other databases
- Missing key ordering makes it impossible to implement range queries efficiently (e.g. MAM queries)
If you are using Riak, you can contact ProcessOne to get assistance migrating to DynamoDB, an horizontally scalable key value datastore made by Amazon.
Erlang/OTP 19.1 is still the minimum supported Erlang version for this release.
Database schema changes
There is no change to perform on the database to move from ejabberd 19.05 to ejabberd 19.08.
Please, make a backup before upgrading.
It means that an old schema for ejabberd 19.05 will work on ejabberd 19.08. However, if you are using MySQL, you should not that we changed the type of the server_host field to perform better with indexes. The change is not mandatory, but changing it to varchar(191) will produce more efficient indexes.
You can check the upgrade page for details: Upgrading from ejabberd 19.05 to 19.08
Download and install ejabberd 19.08
The source package and binary installers are available at ProcessOne. If you installed a previous version, please read ejabberd upgrade notes.
As usual, the release is tagged in the Git source code repository on Github. If you suspect that you’ve found a bug, please search or fill a bug report in Issues.
– Improve ejabberd halting procedure
– Process unexpected Erlang messages uniformly: logging a warning
– mod_configure: Remove modules management
– Use new configuration validator
– ejabberd_http: Use correct virtual host when consulting trusted_proxies
– Fix Elixir modules detection in the configuration file
– Make option ‘validate_stream’ global
– Allow multiple definitions of host_config and append_host_config
– Introduce option ‘captcha_url’
– mod_stream_mgmt: Allow flexible timeout format
– mod_mqtt: Allow flexible timeout format in session_expiry option
– Fix SQL connections leakage
– New authentication method using JWT tokens
– extauth: Add ‘certauth’ command
– Improve SQL pool logic
– Add and improve type specs
– Improve extraction of translated strings
– Improve error handling/reporting when loading language translations
– Improve hooks validator and fix bugs related to hooks registration
– Gracefully close inbound s2s connections
– mod_mqtt: Fix usage of TLS
– mod_offline: Make count_offline_messages cache work when using mam for storage
– mod_privacy: Don’t attempt to query ‘undefined’ active list
– mod_privacy: Fix race condition
– Add code for hibernating inactive muc_room processes
– Improve handling of unexpected iq in mod_muc_room
– Attach mod_muc_room processes to a supervisor
– Restore room when receiving a message or a generic iq for not started room
– Distribute routing of MUC messages across all CPU cores
– Fix pending nodes retrieval for SQL backend
– Check access_model when publishing PEP
– Remove deprecated pubsub plugins
– Expose access_model and publish_model in pubsub#metadata