参考文档:
http://blog.5ilinux.com/archives/2006/05/postfix_cyrussa.html
http://www.extmail.org/forum/archive/2/0510/563.html
wget http://kent.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.58.tar.bz2
tar jvxf courier-authlib-0.58.tar.bz2
./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir \
--without-authuserdb --without-authpam --without-authldap --without-authpwd \
--without-authshadow --without-authvchkpw --without-authpgsql --without-authcustom \
--with-authmysql --with-mysql-libs=/usr/local/mysql/lib/ \
--with-mysql-includes=/usr/local/mysql/include/ --with-redhat
一个关键点:
如果courier-authlib安装到非标准位置(例如安装到/usr/local下),一定记得在./configure时增加-- without-stdheaderdir,这样以后在编译Courier-IMAP和maildrop的时候,不用特别指定courier- authlib的库文件位置
make
make install
make install-configure
增加"/usr/local/courier-authlib/lib/courier-authlib"到你的"/etc/ld.so.conf",并执行ldconfig命令。
chmod +x /usr/local/courier-authlib/var/spool/authdaemon
vi /usr/local/courier-authlib/etc/authlib/authdaemonrc 可以不修改
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
vi /usr/local/courier-authlib/etc/authlib/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD yourpassword
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD 1002
MYSQL_GID_FIELD 1002
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD '/opt/virtual' #设置postfix存储邮件的目录
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD quota
MYSQL_WHERE_CLAUSE active='1'
启动courier-authlib
/usr/local/courier-authlib/sbin/authdaemond start
设置Courier authentication library开机自动运行,在/etc/rc.local中增加“/usr/local/courier-authlib/sbin/authdaemond start”。
测试:
通过以下命令获得test@example.com的用户名及密码的BASE64编码:
perl -e 'use MIME::Base64; print encode_base64("test\@example.com")'
dGVzdEBleGFtcGxlLmNvbQ==
perl -e 'use MIME::Base64; print encode_base64("123")'
MTIz
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.xsbn.net ESMTP Postfix
auth login334 VXNlcm5hbWU6
dGVzdEBleGFtcGxlLmNvbQ==334 UGFzc3dvcmQ6
MTIz235 Authentication successful
quit221 Bye
注:
出现authentication error: Input/output error错误的时候
估计是查询mysql时,authdaemond出错了。具体要打开authdaemonrc里的:
DEBUG_LOGIN=2 原来默认是0
然后看看/var/log/maillog 在认证失败时有什么提示。根据提示去检查问题到底出在哪儿
posted on 2006-12-01 14:44
想飞的鱼 阅读(3138)
评论(2) 编辑 收藏 所属分类:
linux