cyrus-imapd -> very trivial Mysql authentication

Roger Grosswiler roger at gwch.net
Mon Jun 7 12:39:38 UTC 2004


i am sure, most of you know, so for all the others which don't know. HOWTO authenticate cyrus-imapd against a simple
mysql-database. This works with the default settings from mysqls user root.

1) set MECH=pam in /etc/sysconfig/saslauthd
2) create in /etc/pam.d a file called imap with its contents:
auth       sufficient   /lib/security/pam_mysql.so user=root host=localhost db=imapd table=users usercolumn=benutzer
passwdcolumn=password
account    required     /lib/security/pam_mysql.so user=root host=localhost db=imapd table=users usercolumn=benutzer
passwdcolumn=password
account    sufficient   /lib/security/pam_unix_acct.so

if you use another user than root, change user= to whatever you created. insert passwd=xxx for any password you
require for your database.

so, this is part 1...now, with this settings, you should create within a database called imapd with the table users
and their columns benutzer (means username, just has to be what you set in your /etc/pam.d/imap) and password (the
passwdcolumn-entry from /etc/pam.d/imap). Do this with phpmyadmin or in the shell:

mysql
create database imapd;
create table users (idx int(6) primary key auto_increment,benutzer varchar(10),password varchar(10));

for your users to insert, use also phpmyadmin or do in the shell
mysql
use imapd;
insert into users values ('','username','password');

you're finished....this is a basic mysql-authentication that works for me. just keep in mind:
- you're here using the mysql-root account
- your passwords are stored as plaintext, use crypt=1 in /etc/pam.d/imap if you want have them encrypted in your database
- this just serves imap-services. if you plan to use also pop, imaps, pop3s and smtp-auth you should copy
/etc/pam.d/imap to: /etc/pam.d.... pop,imaps,pop3s,smtp

this could not be without error, but it works on my fresh installation of fc2. However, do not forget to create your
mailboxes in cyradm :-)

HTH
Roger





More information about the fedora-list mailing list