# Options for Cyrus SASL

This document contains information on what options are used by the Cyrus SASL library and bundled mechanisms. The most commonly used options (and those that are therefore most commonly misunderstood are pwcheck_method and auxprop_plugin. Please ensure that you have configured these correctly if things don't seem to be working right. Additionally, mech_list can be an easy way to limit what mechanisms a given application will use.

Option | Used By | Description | Default
--- | --- | --- | ---
authdaemond_path | SASL Library | Path to Courier-IMAP authdaemond's unix socket. Only applicable when pwcheck_method is set to authdaemond. | /dev/null
auto_transition | SASL Library | When set to 'yes' or 'noplain', and when using an auxprop plugin, automatically transition users to other mechs when they do a successful plaintext authentication. When set to 'noplain', only non-plaintext secrets will be written. Note that the only mechs (as currently implemented) which don't use plaintext secrets are OTP and SRP. | no
auxprop_plugin | Auxiliary Property Plugin | Name of auxiliary plugin to use, you may specify a space-separated list of plugin names, and the plugins will be queried in order | (null) - querys all plugins
canon_user_plugin | SASL Library | Name of canon_user plugin to use | INTERNAL
keytab | GSSAPI | Location of keytab file | `/etc/krb5.keytab` (system dependant)
log_level | SASL Library | Numeric Logging Level (see `SASL_LOG_*` in `sasl.h` for values and descriptions | 1 (SASL_LOG_ERR)
mech_list | SASL Library | Whitespace separated list of mechanisms to allow (e.g. 'plain otp'). Used to restrict the mechanisms to a subset of the installed plugins. | (use all available plugins)
ntlm_server | NTLM (server) | Name of server (WinNT, Win2K, Samba, etc) to which authentication will be proxied. | (null) - perform authentication internally
ntlm_v2 | NTLM (client) | Send NTLMv2 responses to the server. | no (send NTLMv1)
opiekeys | OTP (with OPIE) | Location of the opiekeys file | `/etc/opiekeys`
otp_mda | OTP (w/o OPIE) | Message digest algorithm for one-time passwords, used by sasl_setpass (possible values: 'md4', 'md5', 'sha1') | `md5`
plugin_list | SASL Library | Location of Plugin list (Unsupported) | none
pwcheck_method | SASL Library | Whitespace separated list of mechanisms used to verify passwords, used by sasl_checkpass (possible values: 'auxprop', 'saslauthd', 'pwcheck', 'authdaemond' [if compiled with `--with-authdaemond`]) and 'alwaystrue' [if compiled with `--enable-alwaystrue`]) | auxprop
reauth_timeout | DIGEST-MD5 | Length in time (in minutes) that authentication info will be cached for a fast reauth. A value of 0 will disable reauth. | 0
saslauthd_path | SASL Library | Path to saslauthd run directory (including the "/mux" named pipe) | system dependant (generally won't need to be changed)
sasldb_path | sasldb plugin | Path to sasldb file | `/etc/sasldb2` (system dependant)
sql_engine | SQL plugin | Name of SQL engine to use (possible values: 'mysql', 'pgsql', 'sqlite'). | `mysql`
sql_hostnames | SQL plugin | Comma separated list of SQL servers (in host[:port] format). | none (engine dependent)
sql_user | SQL plugin | Username to use for authentication to the SQL server. | none (engine dependent)
sql_passwd | SQL plugin | Password to use for authentication to the SQL server. | none (engine dependent)
sql_database | SQL plugin | Name of the database which contains the auxiliary properties. | none (engine dependent)
sql_select | SQL plugin | SELECT statement to use for fetching properties. This option is required in order to use the SQL plugin. | none
sql_insert | SQL plugin | INSERT statement to use for creating properties for new users. | none
sql_update | SQL plugin | UPDATE statement to use for modifying properties. | none
sql_usessl | SQL plugin | When set to 'yes', 'on', '1' or 'true', a secure connection will be made to the SQL server. | `no`
srp_mda | SRP | Message digest algorithm for SRP calculations (possible values: 'md5', 'sha1', 'rmd160') | `sha1`
srvtab | KERBEROS_V4 | Location of the srvtab file | `/etc/srvtab` (system dependant)

## Notes on SQL auxprop options

The `sql_insert` and `sql_update` options are optional and are only needed if you wish to allow the SASL library (e.g., saslpasswd2) and plugins (e.g., OTP) to write properties to the SQL server. If used, both statements MUST be provided so that properties can be added, changed and deleted. NOTE: The columns for writable properites MUST accept NULL values.

The SQL statements provided in the `sql_select`, `sql_insert` and `sql_update` options can contain arguments which will be substituted with the appropriate values. The valid arguments are:

`%u`
  Username whose properties are being fetched/stored.
`%p`
  Name of the property being fetched/stored. This could technically be anything, but SASL authentication will try userPassword and cmusaslsecretMECHNAME (where MECHNAME is the name of a SASL mechanism).
`%r`
  Realm to which the user belongs. This could be the kerberos realm, the FQDN of the computer the SASL application is running on or whatever is after the @ on a username. (read the realm documentation).
`%v`
  Value of the property being stored (INSERT or UPDATE only!). This could technically be anything depending on the property itself, but is generally a userPassword.

NOTE: DO NOT put quotes around the entire SQL statement, but each individual %u, %r and %v argument MUST be quoted.

### Examples:

         sql_select: SELECT %p FROM user_table WHERE username = '%u' and realm = '%r'

would send the following statement to SQL for user "bovik" and the default realm for the machine "madoka.surf.org.uk":

         SELECT userPassword FROM user_table WHERE username = 'bovik' and
         realm = 'madoka.surf.org.uk';

         sql_insert: INSERT INTO user_table (username, realm, %p) VALUES ('%u', '%r', '%v')

would generate the following statement to SQL for user "bovik" in realm "madoka.surf.org.uk" with userPassword "wert":

         INSERT INTO user_table (username, realm, userPassword) VALUES
         ('bovik', 'madoka.surf.org.uk', 'wert');

Note that all substitutions do not have to be used. For instance,

         SELECT password FROM auth WHERE username = '%u'

is a valid value for `sql_select`.

Back to the index