配置认证

在邮箱中加入认证功能,那么不在relay配置范围内的用户,只要用户名和密码正确,就可以发送邮件

1、安装sasl 

[root@localhost ~]# rpm -qa | grep sasl

[root@localhost ]# yum install -y sasl

Loaded plugins: fastestmirror, refresh-packagekit, security                                                 

Complete!

[root@localhost]#

 

2、配置postfix,编辑配置文件“/etc/postfix/main.cf”

[root@localhost ~]# gedit /etc/postfix/main.cf

smtpd_sasl_auth_enable = yes

broken_sasl_auth_clients = yes

smtpd_sasl_local_domain = $myhostname 

smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination

 

3、启动sasl和postfix 

[root@localhost ~]# service saslauthd start

启动postfix                                            [确定]

 

[root@localhost ~]# service postfix start

启动postfix                                            [确定]

 

4、验证

[root@localhost ~]# telnet 192.168.0.113 25

Trying 192.168.0.113...

Connected to 192.168.0.113.

Escape character is '^]'.

220 mailsrv.david.cn ESMTP Postfix

ehlo 192.168.0.113

250-mailsrv.david.cn

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN    //这两句说明成功了

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN