Configuring the Courier-auth module

This page is out of date, it has been replaced by a newer version which you can find here.

Next the configuration of the authentication module, it will be used by everything the mail-server does. SMTP authentication, access to the IMAP mailbox and eventually access to the web based mail program. To enable the authentication module to use the postfix database we created earlier configure it as follows:

Edit the file authmysqlrc in the directory /usr/local/etc/authlib, this will configure the database access like where it is, how to connect, which user and password and which tables and fields to use. You see here again that the configuration needs the UID and the GID from the postfix user as we needed for the postfix configuration, again I have taken the value 27.


MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix

# if you used the MySQL package from Server Logistics use the
# following settings otherwise check your MySQL installation.
MYSQL_SOCKET /private/tmp/mysql.sock
MYSQL_PORT 3306

# The name of the MySQL database we will use:
MYSQL_DATABASE postfix

# the table in the database with the users
MYSQL_USER_TABLE mailbox


# which field in the table has the password
MYSQL_CRYPT_PWFIELD password


# the numerical userid of the postfix account
MYSQL_UID_FIELD '27'

#the numerical groupid of the postfix account
MYSQL_GID_FIELD '27'

# the username as defined in the table mailbox
MYSQL_LOGIN_FIELD username

# the location of the mailboxes on the server
# Please change this is you are going to use a different location.
MYSQL_HOME_FIELD '/usr/local/virtual'

# The user's name (optional)
MYSQL_NAME_FIELD name

# The location where the user mailbox is defined in the table.
MYSQL_MAILDIR_FIELD maildir

Next is configuring the authentication module to use the MySQL based authentication module. Edit the file authdaemonrc in the same directory /usr/local/etc/authlib. We only are going to use the MySQL database for authentication s we need to remove the others:

# The authentication modules that are linked into authdaemond.
authmodulelist="authmysql"
# This setting is used by Courier's webadmin module,
# and should be left alone
authmodulelistorig="authuserdb authpam authldap authmysql authcustom authpipe"
# The number of daemons running concurrently on the server
daemons=3
# authdaemonvar is here, but is not used directly by authdaemond.
# It's used by various configuration and build scripts.
# So don't touch it !
authdaemonvar=/usr/local/var/spool/authdaemon
# when testing set the level at 2
# when everything runs smoothly set it to 0.
DEBUG_LOGIN=2
# keeping the defaults for the rest for now.
DEFAULTOPTIONS=""
LOGGEROPTS=""

Next page ->, configuring IMAP

4 Responses to “Configuring the Courier-auth module”

  1. Tim C Says:

    “Edit the file authdaemonc in the same directory /usr/local/etc/authlib.”

    Filename shoul be athdaemonrc I believe? Not trying to be spelling crazyguy, just pointing it out mainly since it’s a filename. Thanks again!

    Richard5: It is corrected, thanks for mentioning the error !

  2. Martijn Says:

    Should the file authmysqlrc already be present in the directory
    /usr/local/etc/authlib or do you need to create it? I have some issues authenticating users for Courier.

    Richard5: It is solved, Martijn was using a different installation of MySQL and forgot to change the parameters accordingly.

  3. Gavin Says:

    Hi,

    Sorry to be boring but I’ve got the same problem as Martijn – no such file as authmysqlrc. The files I have in /usr/local/etc/authlib are: authdaemonrc, authdaemonrc.dist, authldaprc, authldaprc.dist.

    What was the solution you came up with for Martijn? What parameters? Everything was going great until here.

    Bt the way this is exactly what I have been looking for to get an email server up and running. Tremendous stuff.

    Cheers,

    Gavin

    Richard5: It was the same issue as with Martijn, Gavin used a different MySQL install package and therefore the paths in the ./configure command for the authdaemon weren’t correct.

  4. Damien Says:

    Life saving guide. Not that if you installed mysql from a package from mysql.com you should comment out the socket line.