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.
NOTE: this authentication module should NOT be used if you are using the
vpopmail virtual mailing list manager. You should select the
authvchkpw
authentication module instead (which should happen
automatically). It may be necessary to use the
--without-authmysql
flag to the configure
script,
because configure
by default will include authmysql
if it finds MySQL client libraries..
Edit authmysqlrc
, and initialize the following variables:
MYSQL_SERVER
- MySQL server name (required).MYSQL_PORT
- server port where MySQL accepts
connections.MYSQL_SOCKET
- If MySQL is running on the same machine and
can accept connections from a filesystem socket, enter the path to the
filesystem socket here, and do not initialize SERVER/PORT.MYSQL_USERNAME
- MySQL username with log in with
(required).MYSQL_PASSWORD
- MySQL password with log in with
(required).MYSQL_DATABASE
- MySQL database to log in to
(required).MYSQL_USER_TABLE
- name of the MySQL with the
authentication information (see below) (required).MYSQL_LOGIN_FIELD
- field that contains the login id for
this account.MYSQL_CRYPT_PWFIELD
- name of the field containing the
crypt-ed password (either MYSQL_CRYPT_PWFIELD
or
MYSQL_CLEAR_PWFIELD
is required). NOTE: this password must
be crypt-ed using the operating system's crypt function, NOT MySQL's crypt
function. MySQL's crypt() function is non-standard and is not generally
compatible with the operating system's crypt function.MYSQL_CLEAR_PWFIELD
- name of the field containing the
cleartext password (either MYSQL_CRYPT_PWFIELD
or
MYSQL_CLEAR_PWFIELD
is required).MYSQL_UID_FIELD
- field that contains the system userid for
this account.MYSQL_GID_FIELD
- field that contains the system groupid
for this account.MYSQL_MAILDIR_FIELD
- name of the field containing a
non-default location of the account's system mailbox (optional).MYSQL_QUOTA_FIELD
- name of the field containing a maildir
quota (optional).DEFAULT_DOMAIN
- if the user logs in without specifying
@domain
, use the following domain (in this case the id field
must always contain user@host
) (optional).MYSQL_WHERE_CLAUSE
- optional freeform SQL that is appended
to the SQL query string.The table specified by MYSQL_USER_TABLE
should look as follows
(recommended):
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, quota char(255) DEFAULT '' NOT NULL, KEY id (id(128)) );