系统环境:redhat7.2+postfix-20010228-pl08+mysql-3.23.46+cyrus-imapd-2.0.16-4+pam_mysql
一、mysql安装略
二、postfix:
#make -f Makefile.init makefiles "CCARGS=-DUSE_SASL_AUTH -I/usr/include -DHAS_MYSQL -I/usr/local/mysql/include" "AUXLIBS=-L/usr/lib -lsasl -L/usr/local/mysql/lib -lmysqlclient -lz -lm"
注意mysql的路径
#make
#make install
三、安装pam_mysql:
需要mysql-libs-3.23.46-3.i386.rpm 从rpmfind.net下载
#rpm -ivh mysql-libs-3.23.46-3.i386.rpm
#rpm -ivh pam_mysql-0.4.7-1.i686.rpm
四、安装cyrus-imapd
从rpmfind.net上下载cyrus-imapd-2.0.16-4.i386.rpm
#rpm -ivh cyrus-imapd-2.0.16-4.i386.rpm
#saslpasswd -c cyrus (cyrus管理员账号)
添加邮件用户的命令:
#cyradm -u cyrus localhost
你的主机名>cm user.test
其中test为邮件用户
五、相关配置文件:
1、/etc/postfix/main.cf添加:
mailbox_transport = cyrus
fallback_transport = cyrus
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
2、/etc/postfix/master.cf
因为cyrus的路径设置有问题,所以需要修改
cyrus unix - n n - - pipe
flags=R user=cyrus argv=/usr/cyrus/bin/deliver -e -m ${extension} ${user}
3、/usr/lib/sasl/smtpd.conf
pwcheck_method:pam
4、/etc/pam.d/smtp /etc/pam.d/pop /etc/pam.d/imap相同
auth required /lib/security/pam_mysql.so user=sendmail passwd=teste host=localhost db=sendmail table=users usercolumn=username passwdcolumn=passwd crypt=0
account required /lib/security/pam_mysql.so user=sendmail passwd=teste host=localhost db=sendmail table=users usercolumn=username passwdcolumn=passwd crypt=0
5、/etc/imapd.conf
configdirectory: /var/imap
partition-default: /var/spool/imap
admins: cyrus
allowanonymouslogin: no
sasl_pwcheck_method: pam
六、根据3中的字段建立sendmail数据库
七、启动
#/ec/rc.d/init.d/cyrus start
#postfix start
八、存在的问题
现在的问题是非系统用户的邮件用户能够通过smtp发送邮件,通过pop、imap收取邮件,但是postfix能接收系统用户的Mail,并且也发送到了cyrus建立的邮箱中,但是不能接收非系统用户的邮件,当然DNS已经设置正确设置,已通过cyradm建立邮件用户。
有哪位高手能解决系统用户和邮件用户的完全分离,请指教?