CentOS+postfix+ExtMail+amavisd-new+Spam_Locker+DSpam配置指南:九、配置Cyrus-SASL

1、安装cyrus-sasl

 
删除系统的cyrus-sasl:
  1. shell 
  2. # rpm -e cyrus-sasl --nodeps 
 
安装新的支持authdaemon的软件包
  
  
  
  
  1. shell 
  2. # yum install cyrus-sasl 
2、配置main.cf文件
 
Postfix的SMTP认证需要透过Cyrus-SASL,连接到authdaemon获取认证信息。
 
编辑main.cf
   
   
   
   
  1. shell 
  2. # vi /etc/postfix/main.cf 
增加如下内容:
 
  
  
  
  
  1. # smtpd related config 
  2. smtpd_recipient_restrictions = 
  3.         permit_mynetworks
  4.         permit_sasl_authenticated, 
  5.         reject_non_fqdn_hostname, 
  6.         reject_non_fqdn_sender, 
  7.         reject_non_fqdn_recipient, 
  8.         reject_unauth_destination, 
  9.         reject_unauth_pipelining, 
  10.         reject_invalid_hostname, 
  11.  
  12. # SMTP sender login matching config 
  13. smtpd_sender_restrictions = 
  14.         permit_mynetworks
  15.         reject_sender_login_mismatch, 
  16.         reject_authenticated_sender_login_mismatch, 
  17.         reject_unauthenticated_sender_login_mismatch 
  18.  
  19. smtpd_sender_login_maps = 
  20.         mysql:/etc/postfix/mysql_virtual_sender_maps.cf, 
  21.         mysql:/etc/postfix/mysql_virtual_alias_maps.cf 
  22.    
  23. # SMTP AUTH config here 
  24. broken_sasl_auth_clients = yes 
  25. smtpd_sasl_auth_enable = yes 
  26. smtpd_sasl_local_domain = $myhostname 
  27. smtpd_sasl_security_options = noanonymous 
3、编辑smtpd.conf文件
 
  
  
  
  
  1. shell 
  2. # vi /usr/lib/sasl2/smtpd.conf 
确保其内容为:
 
  
  
  
  
  1. pwcheck_method: authdaemond 
  2. log_level: 3 
  3. mech_list: PLAIN LOGIN 
  4. authdaemond_path:/var/spool/authdaemon/socket 
重新启动postfix:
 
  
  
  
  
  1. shell 
  2. # service postfix start 
4、测试SMTP认证
 
通过以下命令获得[email protected]的用户名及密码的BASE64编码:
 
  
  
  
  
  1. shell 
  2. # perl -e ‘use MIME::Base64; print encode_base64(”postmaster\@extmail.org”)’ 
内容如下:
 
  
  
  
  
  1. cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
 
  
  
  
  
  1. shell 
  2. # perl -e ‘use MIME::Base64; print encode_base64(”extmail”)’ 
内容如下:
    
    
    
    
  1. ZXh0bWFpbA==
然后本机测试:
 
   
   
   
   
  1. shell 
  2. # telnet localhost 25 
其过程如下:
 
  
  
  
  
  1. Trying 127.0.0.1... 
  2. Connected to localhost.localdomain (127.0.0.1). 
  3. Escape character is '^]'. 
  4. 220 mail.extmail.org ESMTP Postfix - by extmail.org 
  5. ehlo demo.domain.tld     << 输入内容 
  6. 250-mail.extmail.org 
  7. 250-PIPELINING 
  8. 250-SIZE 10240000 
  9. 250-VRFY 
  10. 250-ETRN 
  11. 250-AUTH LOGIN PLAIN 
  12. 250-AUTH=LOGIN PLAIN 
  13. 250-ENHANCEDSTATUSCODES 
  14. 250-8BITMIME 
  15. 250 DSN 
  16. auth login     << 输入内容 
  17. 334 VXNlcm5hbWU6 
  18. cG9zdG1hc3RlckBleHRtYWlsLm9yZw==     << 输入内容 
  19. 334 UGFzc3dvcmQ6 
  20. ZXh0bWFpbA==     << 输入内容 
  21. 235 2.0.0 Authentication successful 
  22. quit     << 输入内容 
  23. 221 2.0.0 Bye 
  24. 最后出现235 Authentication Successful 表明认证成功了。 
 

 

你可能感兴趣的:(centos,postfix,安装配置,dspam,ExtMail,Amavisd-new)