Configuring cyrus imap with postfix and mysql database

Matthew Schumacher matt.s at aptalaska.net
Fri Sep 8 12:14:35 EDT 2006


Sanchez Nicolas wrote:
> Hi !
> 
> First, I'm sorry but I'm french and I don't speak english very well, so
> if you don't understand all I write, say it to me.
> 
> So I would like to install on a server,
> postfix+cyrus-imap+saslauth+mysql database for authentification.
> 
> I've found this tuto but I think my server don't work:
> http://www.campworld.net/thewiki/pmwiki.php/LinuxServersFC5/FC5VirtMailServer
> 
> I explain...
> 
> In first, I've installed the packages cyrus-imapd cyrus-imapd-utils
> perl-Cyrus pam_mysql and pam_devel.
> Then,I've installed postfix with mysql support from here :
> http://www.campworld.net/downloads/postfix-2.2.8-1.2.i386.rpm
> After : fetchmail mdadm(don't know why, but it was in the tuto...).
> 
> Then, I've created my database with the files in attachment.
> 
> Then, lots of config files modifications I have done, but not really
> understand for pam and saslauthd(see the end of the mail for config files).
> After, the Cyrus IMAP configuration...
> I've created a "cyrus" user (adduser+passwd) and modified the cyrus conf
> files.
> After , I've configured postfix and sasl files.
> Then i've launched saslauthd and cyrus-imapd.
> 
> Now the pb (Ouch!):
> I don't know how to test my conf.
> I've send a mail to admin at sd-910.dedibox.fr and an other to
> cyrus at sd-910.dedibox.fr.
> Where can I found the mails i've send on my server?
> How can I configure thunderbird to get the mails?
> Let's see my account config:
> -Server type : imap
> -address : cyrus or admin @sd-910.dedibox.fr
> -server name : sd-910.dedibox.fr
> -account name : cyrus or admin
> -port: 143
> -no secure connexion
> -smtp: ??? (smtp.gmail.com cause I don't know what I have to write)
> 
> I'm sorry for this long, long mail, but It's my first mail server
> installation and I don't know at all where is my prblem in configuration.
> 
> Please, help me!
> 
> Thanks in advance,
> Nico
> 

Nico,

First of all your English isn't as bad as you say.  Your request made
perfect sense to me.

Anyway, I don't run this setup so I'm not going to be able to walk you
though it, but I can offer some insight on how to troubleshoot and how
this works.

The first thing I would do is setup mysql, pam_mysql, pam, and confirm
that is all working.  So make sure that your data is in your database,
then make sure that pam_mysql can query this information, then setup pam
to use pam_mysql as it's authentication module.  Once you are there you
can test everything by trying to chown a file as a user in your mysql
database.  Also, try to troubleshoot in order.  PAM uses pam_mysql as
it's authentication module, which queries mysql.

Once you have your mysql users available in pam then work on then
configuring cyrus to use saslauthd with this syntax in your imapd.conf:

sasl_pwcheck_method: saslauthd

Once cyrus is configured to check users against saslauthd, then you need
to start the saslauthd daemon and tell it you want it to resolve users
against pam:

# saslauthd -a pam

Now that saslauthd is checking against pam, you need to create a pam
config file to tell pam which modules to use when saslauthd trys to
authenticate:

Put this into your /etc/pam.d/imap

auth       sufficient   pam_mysql.so user=mail passwd=secret
host=localhost db=mail table=accountuser usercolumn=username
passwdcolumn=password crypt=1 logtable=log logmsgcolumn=msg
logusercolumn=user loghostcolumn=host logpidcolumn=pid log
timecolumn=time

account    required     pam_mysql.so user=mail passwd=secret
host=localhost db=mail table=accountuser usercolumn=username
passwdcolumn=password crypt=1 logtable=log logmsgcolumn=msg
logusercolumn=user loghostcolumn=host logpidcolumn=pid log
timecolumn=time

Make sure you use the correct host, user, database, table, columns, etc.....

So in order:  Your cyrus server talks to the saslauthd daemon, which
talks to the pam abstraction later, which talks to the pam_mysql module,
which makes queries against mysql.

Hope that helps,
schu







More information about the Info-cyrus mailing list