Courier-Authlib|Home|Release notes|Installation|Documentation

Courier MySQL authentication module

This module allows authentication information to be stored in a MySQL database.

When authmysql is installed, a default configuration file, authmysqlrc will be installed too. You must edit this file to set up your MySQL authentication.


Edit authmysqlrc, and initialize the following variables:

Here's a recommended definition of MYSQL_USER_TABLE:

CREATE TABLE passwd (
        id                    char(128) DEFAULT '' NOT NULL,
        crypt                 char(128) DEFAULT '' NOT NULL,
        clear                 char(128) DEFAULT '' NOT NULL,
        name                  char(128) DEFAULT '' NOT NULL,
        uid                   int(10) unsigned DEFAULT '65534' NOT NULL,
        gid                   int(10) unsigned DEFAULT '65534' NOT NULL,
        home                  char(255) DEFAULT '' NOT NULL,
        maildir               char(255) DEFAULT '' NOT NULL,
        defaultdelivery       char(255) DEFAULT '' NOT NULL,
        quota                 char(255) DEFAULT '' NOT NULL,
        options               char(255) DEFAULT '' NOT NULL,
        KEY id (id(128))
);

Observe that a valid SQL expression may be used in place of any field setting, since all that happens is that the contents of the settings are inserted into an SQL SELECT statement. Specifically, the options field may be replaced by several normal fields, such as "disablepop3", "disableimap", "disablewebmail", and "sharedgroup"; then MYSQL_AUXOPTIONS would be set to:

CONCAT("disableimap=",disableimap,",disablepop3=",disablepop3,",disablewebmail=",disablewebmail,",sharedgroup=",sharedgroup)

This results in the expected comma-delimited options list, which is built up from individual table fields.