认安装CentOS,sasl2所需要的包和sendmail包;2.关闭selinux,否则会影响saslauthd使用shadow认证;
vi /etc/selinux/config
将SELINUX=enforce改成SELINUX=disabled,需要重新启动计算机生效;
3.修改saslauthd的配置文件,选择使用shadow方式认证;
vi /etc/sysconfig/saslauthd
将MECH=pam改成MECH=shadow;
4.启动saslauthd并验证是否正常工作;
service saslauthd start #启动saslauthd
chkconfig saslauthd on #设置saslauthd开机自动启动
testsaslauthd -u username -p password
如果显示0: OK “Success.”则表明saslauthd工作正常;
5. 设置postfix支持smtp认证
在main.cf文件中更改如下:
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = ''
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
broken_sasl_auth_clients=yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
6. 编辑/usr/lib/sasl2/smtpd.conf文件,确认其为:
pwcheck_method: saslauthd
测试smtp认证
telnet 127.0.0.1 25
输入:
ehlo 163.com
如果在返回的列表中有:
250-AUTH GSSAPI NTLM LOGIN PLAIN
250-AUTH=GSSAPI NTLM LOGIN PLAIN
两行,则表明postfix已经启用smtp认证了