2013年6月2日 星期日

CentOS 6.4 設定 Dovecot (SMTP 認證 / smtp authentication / saslauthd )


參考 http://linux.vbird.org/linux_server/0380mail.php#adv_auth

yum install cyrus-sasl, cyrus-sasl-plain, cyrus-sasl-md5

vim /etc/sysconfig/saslauthd
MECH=pam   #use PAM

service saslauthd start


vim /etc/sasl2/smtpd.conf
log_level: 3                #log_level
pwcheck_method: saslauthd   #use saslauthd
mech_list: plain login      #support plain / login

vim /etc/postfix/main.cf


smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =       #依照順序 by order
     permit_mynetworks,              #信任內部網路(可以關閉) trust lan 
     permit_sasl_authenticated,      #預設啟用 sasl_authenticated
     reject_unknown_sender_domain,
     reject_unknown_recipient_domain,
     reject_unauth_destination,
     reject_rbl_client cbl.abuseat.org,
     reject_rbl_client bl.spamcop.net,
     reject_rbl_client cblless.anti-spam.org.cn,
     reject_rbl_client sbl-xbl.spamhaus.org,
     check_policy_service unix:/var/spool/postfix/postgrey/socket 

postfix check
service postfix restart


Testing ....

 telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 CentOS.localdomain ESMTP Postfix
ehlo localhost
250-CentOS.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN            #要出現 LOGIN PLAIN 
250-AUTH=LOGIN PLAIN            #要出現 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

Thunderbird,
SMTP 寄件伺服器

不安全傳輸的密碼
使用者名稱


嘗試寄信, 會跳出需要密碼的畫面
more /var/log/maillog

postfix/smtpd[5091]: E362C1A0128: client=unknown[192.168.226.1], sasl_method=PLAIN, sasl_username=myusername

有以上訊息就成功




沒有留言:

張貼留言