當mail服務器架設好了之後,往往很容易被當成廣告信Server來寄信,利用SMTP Auth認證方式,只有透過帳號密碼認證過的User才能寄信

1.安裝SASL套件
$sudo apt-get install sasl2-bin

2.新增並編輯此檔
$sudo vim /etc/postfix/sasl/smtpd.conf
log_level: 3
pwcheck_method: saslauthd
mech_list: plain login

3.編輯main.cf
$sudo vim /etc/postfix/main.cf
smtpd_sasl_path = smtpd

4.編輯saslauthd
$sudo vim /etc/default/saslauthd
START=yes
MECHANISMS="pam"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

5.把postfix加入sasl群組
$sudo addgroup postfix sasl

6.修改main.cf檔
$sudo vim /etc/postfix/main.cf
# 設定 Postfix 使用 SASL 認証
smtpd_sasl_auth_enable = yes
# 設定 SASL 支援非標準 E-mail Client 的認証動作
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
# 不使用 ANONYMOUS 這個認証
smtpd_sasl_security_options = noanonymous
# 設定 SASL 的認証方法
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

7.重新啟動
$sudo /etc/init.d/saslauthd  start
$sudo /etc/init.d/postfix reload
測試是否OK?
testsaslauthd -u 帳號 -p 密碼 -f /var/spool/postfix/var/run/saslauthd/mux

 

當IMAP未在外寄郵件需要認證輸入帳號密碼時,Outlook會收到以下的訊息:
554 5.7.1 <linadonis@gmail.com>: Relay access denied ==>預寄到gmail的信件存取失敗。

arrow
arrow
    全站熱搜

    蒼穹 發表在 痞客邦 留言(0) 人氣()