如果你是用gmail 當MUA, 也就是利用gmail 來收發外部的郵件
最近在寄信時出現這個錯誤訊息

郵件未傳送
你已設定使用「以這個地址寄送郵件」功能,透過其他電子郵件地址或別名傳送這封郵件。不過,該地址所屬帳戶的設定錯誤或已失效。請檢查相關設定,然後再嘗試重新傳送。
瞭解詳情
伺服器的回應如下:
TLS Negotiation failed, the certificate doesn't match the host.
image

以postfix + comodo wildcard ssl 為例
1. 取得合法的 ssl 憑證
免費或是購買1~2年憑證 (略)

2. 合併ca憑證
# cd /ssldir/example.com/
# cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ca-bundle.crt


3. 修改 postfix main.cf
# vi /usr/local/etc/postfix/main.cf
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /ssldir/example.com/example.com.key
smtpd_tls_cert_file = /ssldir/example.com/STAR_example_com.crt
smtpd_tls_CAfile = /ssldir/example.com/ca-bundle.crt
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

4. 重啟 postfix 服務
# /usr/local/etc/rc.d/postfix restart

5. 測試
# openssl s_client -connect mail.example.com:25 -starttls smtp
觀察 Certificate chain 是否有噴錯誤訊息,如果都正常的話,就開開心心的寄一封信到別的網域測試看看吧
 

arrow
arrow
    文章標籤
    gmail postfix tls ssl
    全站熱搜
    創作者介紹
    創作者 helloworld 的頭像
    helloworld

    Hello World

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