POSTFIX+Extmail邮件系统搭建(完整版)系列之八

 南宁团购大全  http://www.nntianye.com

第八部分:配置Cyrus-SASL

1、安装cyrus-sasl

删除系统的cyrus-sasl

# rpm -e cyrus-sasl –nodeps

 

安装新的支持authdaemon的软件包

# yum install cyrus-sasl

 

2、配置main.cf文件

PostfixSMTP认证需要透过Cyrus-SASL,连接到authdaemon获取认证信息。

编辑main.cf

# vi /etc/postfix/main.cf

 

增加如下内容:

# smtpd related config

smtpd_recipient_restrictions =

        permit_mynetworks,

        permit_sasl_authenticated,

        reject_non_fqdn_hostname,

        reject_non_fqdn_sender,

        reject_non_fqdn_recipient,

        reject_unauth_destination,

        reject_unauth_pipelining,

        reject_invalid_hostname,

 

# SMTP sender login matching config

smtpd_sender_restrictions =

        permit_mynetworks,

        reject_sender_login_mismatch,

        reject_authenticated_sender_login_mismatch,

        reject_unauthenticated_sender_login_mismatch

 

smtpd_sender_login_maps =

        mysql:/etc/postfix/mysql_virtual_sender_maps.cf,

        mysql:/etc/postfix/mysql_virtual_alias_maps.cf

 

# SMTP AUTH config here

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

 

3、编辑smtpd.conf文件

# vi /usr/lib/sasl2/smtpd.conf

 

确保其内容为:

pwcheck_method: authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/var/spool/authdaemon/socket

 

重新启动postfix

# service postfix restart

 

4、测试SMTP认证

通过以下命令获得[email protected]的用户名及密码的BASE64编码:

# perl -e use MIME::Base64; print encode_base64(postmaster\@extmail.org)

 

内容如下:

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==

# perl -e use MIME::Base64; print encode_base64(extmail)

 

内容如下:

ZXh0bWFpbA==

 

然后本机测试:

# telnet localhost 25

 

其过程如下:

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

ehlo demo.domain.tld     << 输入内容

250-mail.extmail.org

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

auth login     << 输入内容

334 VXNlcm5hbWU6

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==     << 输入内容

334 UGFzc3dvcmQ6

ZXh0bWFpbA==     << 输入内容

235 2.0.0 Authentication successful

quit     << 输入内容

221 2.0.0 Bye

 

最后出现235 Authentication Successful 表明认证成功了。

 南宁团购大全  http://www.nntianye.com

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章