检查下sendmail
#rpm -qa | grep sendmail
停止掉
#/etc/init.d/sendmail stop#chkconfig --level 0123456 sendmail off
#mv /usr/bin/newaliases /usr/bin/newaliases.orig
#mv /usr/bin/mailq /usr/bin/mailq.orig
#mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
安装postfix
#yum -y install postfix
#vim /etc/postfix/main.cf
修改
(企业域名 btroot.org 邮件服务器 mail. btroot.org Mail服务器名 mail.btroot.org ip:11.22.33.44)
修改内容如下:
myhostname = mail.btroot.org
mydomain = btroot.org
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mail.$mydomain, www.$mydomain, ftp.$mydomain
mynetworks_style = subnet
mynetworks = 127.0.0.0/8, localhost, 11.22.33.44
relay_domains = $mydestination
home_mailbox = Maildir/ //如果采用系统帐号作为邮件用户名,该目录为帐号下的目录
最后面添加(sasl加密算法支持)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks
smtpd_client_restrictions = permit_sasl_authenticated
安装saslauthd
必须先安装openssl 不然cyrus-sasl会报错 2.1.21的sasl版本,编译容易出错
#yum -y install openssl关于saslauthd ,可以参考这里.
http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/cyrus-sasl.html
下载saslauthd
#wget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.25.tar.gz
#tar -xzvf cyc....#/configure --prefix=/usr \
--sysconfdir=/etc \
--with-dbpath=/var/lib/sasl/sasldb2 \
--with-saslauthd=/var/run/saslauthd --diable-anon --enable-login --enable-ntlm
#make && make install
要修改的smtpd.conf文件在/etc/sasl2/smtpd.conf
做个符号链接
#ln -s /etc/sasl2/smtpd.conf /usr/lib/sasl2/smtpd.conf
#vim etc/sysconfig/saslauthd检查MECH=shadow
检查是否启动
#ps aux | grep saslauthd
#chklevel --2345 saslauthd on
#/etc/init.d/saslauthd start
验证下sasl
#/usr/sbin/testsaslauthd -u root -p '123456' -s smtp
0: OK "Success."
选择mta 会有两个一个sendmail 一个postfix
#alternatives --config mta
如果有sendmail 不要选它 我们用postfix 输入前面的数字既可vi /usr/lib/sasl2/smtpd.conf
修改或者添加
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
log_level:3
安装dovecot
#yum -y install dovecot
vi /etc/dovecot.conf修改或者添加
protocols = imap pop3 pop3s
listen = *
# /etc/init.d/postfix start
# /etc/init.d/dovecot start
# /etc/init.d/saslauthd start
设置开机自启
#chkconfig –level 2345 postfix on
#chkconfig –level 2345 dovecot on
#chkconfig –level 2345 saslauthd on