Postfix

SMTP 錯誤 - Dovecot/Postfix

  • June 16, 2016

Dovecot 和 Postfix 都執行良好。特別是對於 Win 8+ 和 Mac OS 10.10+ 以及 iOS 8+ 的機器。

但是嘗試從 10.9 Mavericks Mac 連接會變得很奇怪……

這是我的 main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

readme_directory = no

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mydestination =
mailbox_size_limit = 5120000000000000
message_size_limit = 30720000
recipient_delimiter =
inet_interfaces = all
myorigin = example.ddns.net
inet_protocols = all

# specify SMTP relay host 
relayhost = [myhost]:587

##### TLS parameters ######
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


###### SASL Auth ######
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
  permit_sasl_authenticated,
  permit_mynetworks,
  check_relay_domains


###### Use Dovecot LMTP Service to deliver Mails to Dovecot ######
virtual_transport = lmtp:unix:private/dovecot-lmtp


##### Only allow mail transport if client is authenticated or in own network (PHP Scripts, ...) ######
#smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination


###### MySQL Connection ######

virtual_alias_maps = mysql:/etc/postfix/virtual/mysql-aliases.cf
virtual_mailbox_maps = mysql:/etc/postfix/virtual/mysql-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/virtual/mysql-domains.cf
local_recipient_maps = $virtual_mailbox_maps


# enable SASL authentication 
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication. 
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

日誌中的消息指出:

   Jun 16 11:36:43 example postfix/smtpd[8038]: SSL_accept error from unknown[xxx]: lost connection
Jun 16 11:36:43 example postfix/smtpd[8038]: lost connection after STARTTLS from unknown[xxx]
Jun 16 11:36:43 example postfix/smtpd[8038]: disconnect from unknown[xxx4]
Jun 16 11:36:47 example postfix/submission/smtpd[8022]: auto_clnt_close: disconnect private/tlsmgr stream

而我嘗試在 465 和 587 上使用 SSL 以及在 25 上不使用 SSL 進行連接。其他執行最新軟體版本的客戶端執行良好。

感謝@ychaouche,我找到了解決方案。

客戶端不接受證書。這意味著不允許 SSL 傳輸。在重新啟動客戶端郵件應用程序並信任這個不受信任的 openssl 證書後,一切都按預期工作!

謝謝!

引用自:https://serverfault.com/questions/784327