I use courier-imap and sqwebmail, with authmysql and postfix for my mail, and it works great, including [EMAIL PROTECTED] for login. Getting it configured is not for the faint of heart. I know mine is not completely correct, because I still have to push my uid/gid implementation into production for quota support.

Here's the Info I have for postfix.

I have a table (email_forwards) for forwarders.
CREATE TABLE `email_forwards` (
 `forw_to` varchar(128) NOT NULL default '',
 `address` varchar(128) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and this is the config file for postfix for this.

--- mysql-forwarders.cf ---
hosts=localhost
user=dbname
password=password
dbname=dbname
table=email_forwards
select_field=forw_to
where_field=address


I have a table (users) for email addresses
CREATE TABLE `user` (
 `crypt` varchar(128) NOT NULL default '',
 `clear` varchar(128) NOT NULL default '',
 `name` varchar(128) NOT NULL default '',
 `uid` int(10) unsigned NOT NULL default '89',
 `gid` int(10) unsigned NOT NULL default '65534',
 `quota` varchar(255) NOT NULL default '',
 `options` varchar(255) NOT NULL default '',
 `domain` varchar(64) default NULL,
 `is_active` int(11) default '1',
 `address` varchar(254) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

a couple of config files for this in postfix

--- mysql_virtual_mailbox_domains.cf  ---
hosts=localhost
user=dbname
password=password
dbname=dbname
table=user
select_field='1'
where_field=domain

--- mysql-virtual_mailbox_maps.cf  ---
hosts=localhost
user=dbname
password=password
dbname=dbname
table=user
select_field=CONCAT(domain,'/',name,'/')
where_field=address


and in the main postfix config file, you include the above files....
--- top of main.cf ---
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf
virtual_mailbox_base = /var/spool/mail/domains
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_minimum_uid = 88
virtual_uid_maps = static:89
virtual_gid_maps = static:12
virtual_alias_maps = mysql:/etc/postfix/mysql-forwarders.cf

then whenever you add a domain, you create it to /var/spool/mail/domains/thedomain.com whenevery you add an email user, you add it to the database and maildirmake /var/spool/mail/domains/thedomain.com/[EMAIL PROTECTED]

If I remember correctly, I didn't have to change anything in the courier imap or sqwebmail packages, but I did have to change the config files for authlib. Here goes...

in authdaemonrc
authmodulelist="authmysql"

--- authmysqlrc ---
MYSQL_SERVER            localhost
MYSQL_USERNAME          dbname
MYSQL_PASSWORD          password
MYSQL_SOCKET            /var/lib/mysql/mysql.sock
MYSQL_PORT              0
MYSQL_OPT               0
MYSQL_DATABASE          dbname
MYSQL_USER_TABLE        user
MYSQL_CRYPT_PWFIELD     crypt
MYSQL_CLEAR_PWFIELD     clear
MYSQL_UID_FIELD         uid
MYSQL_GID_FIELD         gid
MYSQL_LOGIN_FIELD       CONCAT(name,'@',domain)
MYSQL_HOME_FIELD CONCAT('/var/spool/mail/domains/',domain,'/',name,'/')
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD CONCAT('/var/spool/mail/domains/',domain,'/',name,'/')

Tha did it. I can send and recieve mail without incident. If you're feeling really ambitious, you can add pop-before smtp support to postfix, but that's a drop-in installation.

Good Luck.

Ejay Hire
Systems Admin, Hostsouth.com
Professional Web and Email hosting

----- Original Message ----- From: "Brian Candler" <[EMAIL PROTECTED]>
To: "Tom Lee" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Thursday, February 02, 2006 2:38 AM
Subject: Re: [Courier-imap] login with [EMAIL PROTECTED]


On Wed, Feb 01, 2006 at 06:57:49PM +0000, Tom Lee wrote:
I used cyrus sasl library with postfix, can I use /etc/sasldb2 with
courier-authlib?

No (unless you write your own authentication module, or some glue in
authpipe)

I am thinking if it will work if I change 'username' in /etc/passwd to
'[EMAIL PROTECTED]'?

That would be scary. Many Unix systems have a maximum of 8 or 16 characters
in a username.

It would be better, in my opinion, just to use authuserdb. There is a tool
provided which converts /etc/passwd into userdb format. You then just tweak
the userdb entries in whatever way you want (such as adding domains to the
username), run makeuserdb, and hey presto.

Of course you can use authmysql or whatever as has been suggested, but
that's a much more heavyweight setup. If you are happy with /etc/passwd as
an authentication source, then I guess you'll be equally happy with
/etc/userdb

Regards,

Brian.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Courier-imap mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to