Table of Contents
XMPP uses a standard authentication protocol called 'SASL' to validate client credentials. Prosody has a built-in SASL library, and uses this by default to validate credentials against Prosody's internal account store.
Alternatively since 0.7 Prosody supports using Cyrus SASL, an external SASL provider which can validate user-supplied credentials against other sources, such as PAM, LDAP, SQL and more. It also allows the use of GSSAPI for single-sign-on services.
To allow Prosody to access Cyrus SASL you need to install lua-cyrussasl. Information on how to do that on most platforms can be found on our dependencies page. Those running Debian/Ubuntu with our repository can simply:
sudo apt-get install liblua5.1-cyrussasl0
On Redhat/CentOS, the EPEL repository needs to be enabled, after which you can install the package:
sudo yum install lua-cyrussasl
Enable the cyrus backend by adding the following line to your config file:
authentication = "cyrus" -- 0.8+ sasl_backend = "cyrus" -- 0.7 cyrus_service_name = "xmpp" -- Optional, defaults to "xmpp"
Configuring Cyrus SASL itself is currently beyond the scope of this documentation. If you feel you could contribute a simple how-to, or know the link of a good one to add below then let us know
Prosody's Cyrus SASL-related options:
|cyrus_service_name||xmpp||The service name to pass to Cyrus SASL.|
|cyrus_service_realm||(auto)||The realm to pass to Cyrus SASL, the virtual host the user is signing into if not specified.|
|cyrus_require_provisioning||false||If true then Prosody requires user accounts to exist in Prosody, even if successfully authenticated via SASL|
|cyrus_application_name||prosody||The application name to pass to Cyrus SASL. Determines the Cyrus SASL configuration file name.|
|cyrus_server_fqdn||hostname passed to Cyrus|
One of the most common issues is Prosody being unable to access the saslauthd socket (this is obviously only an issue if you are using the saslauthd daemon), used to communicate with the authentication daemon. An example error caused by this would be:
Got SASL error condition -1: Password verification failed
This can be confirmed by trying testsaslauthd as root and then as the user prosody runs as (typically 'prosody'); the former should succeed and the latter should fail.
The solution is to make sure that prosody can access the socket (typically in /var/run/saslauthd/) by adding the 'prosody' user to the 'sasl' group (or otherwise ensuring that the prosody user has filesystem permissions to access the socket).
Cyrus SASL Configuration file
Cyrus SASL needs a configuration file in order to know where to look for user credentials. For Prosody, the file will be named prosody.conf by default. Its location varies by OS and distribution; refer to the table below or your local system documentation for where it should go.
|/etc/sasl||Debian and Ubuntu|
The contents of the configuration file depend on what you want to authenticate against. If you want to authenticate against local accounts, you'll want to set up saslauthd (the configuration of saslauthd varies from system to system), and your prosody.conf will look like this:
pwcheck_method: saslauthd mech_list: PLAIN
If using saslauthd, you must specify only PLAIN in the mech_list, as it only supports plaintext authentication methods.
- This post uses xmpp.conf, but the name is now prosody.conf (see cyrus_application_name above)