为什么 postfix 不发送或接收邮件?

为什么 postfix 不发送或接收邮件?

咬牙坚持,升级到 Debian Stretch。几个月甚至几年来,一切都运行良好。

我关注了https://jschumacher.info/2017/06/upgrading-to-debian-stretch-with-dovecot-postfix-opendkim/解决我最初遇到的两个问题。

当一切似乎都运行正常后,我就没再发送测试邮件了。

现在我发现我既无法发送也无法接收电子邮件。

连接只是超时而没有错误,邮件日志(即使有调试输出)也没有显示任何有用的信息。

发送电子邮件会产生以下日志行以及许多其他不太相关的日志行:

postfix/smtpd[16428]: connect from unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]
...
postfix/smtpd[16428]: report connect to all milters
postfix/smtpd[16428]: milter_macro_lookup: "i"
postfix/smtpd[16428]: milter_macro_lookup: "j"
postfix/smtpd[16428]: milter_macro_lookup: result "domain.com"
postfix/smtpd[16428]: milter_macro_lookup: "{daemon_name}"
postfix/smtpd[16428]: milter_macro_lookup: result "domain.com"
postfix/smtpd[16428]: milter_macro_lookup: "v"
postfix/smtpd[16428]: milter_macro_lookup: result "Postfix 3.1.8"
postfix/smtpd[16428]: milter_macro_lookup: "{if_name}"
postfix/smtpd[16428]: milter_macro_lookup: "_"
postfix/smtpd[16428]: milter_macro_lookup: result "unknown [2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]"
...
postfix/smtpd[16428]: milter8_conn_event: milter unix:/spamass/spamass.sock: connect unknown/2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64
postfix/smtpd[16428]: event: SMFIC_CONNECT; macros: j=domain.com {daemon_name}=domain.com v=Postfix 3.1.8 _=unknown [2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]
postfix/smtpd[16428]: reply: SMFIR_CONTINUE data 0 bytes
...
postfix/smtpd[16428]: milter8_conn_event: milter local:/opendkim/opendkim.sock: connect unknown/2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64
postfix/smtpd[16428]: event: SMFIC_CONNECT; macros: j=domain.com {daemon_name}=domain.com v=Postfix 3.1.8 _=unknown [2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]
postfix/smtpd[16428]: reply: SMFIR_CONTINUE data 0 bytes
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 220 domain.com ESMTP Postfix (Debian/GNU)
postfix/smtpd[16428]: < unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: EHLO [IPv6:2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]
...
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-domain.com
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-PIPELINING
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-SIZE 52428800
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-VRFY
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-ETRN
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-STARTTLS
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-ENHANCEDSTATUSCODES
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-8BITMIME
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250 DSN
postfix/smtpd[16428]: < unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: STARTTLS
...
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 220 2.0.0 Ready to start TLS
...
postfix/smtpd[16428]: Anonymous TLS connection established from unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
...
postfix/smtpd[16428]: < unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: EHLO [IPv6:2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64
...
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-domain.com
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-PIPELINING
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-SIZE 52428800
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-VRFY
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-ETRN
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-ENHANCEDSTATUSCODES
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250-8BITMIME
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 250 DSN
postfix/smtpd[16428]: < unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: AUTH PLAIN xxxx=
...
postfix/smtpd[16428]: > unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: 235 2.7.0 Authentication successful
postfix/smtpd[16428]: < unknown[2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64]: MAIL FROM:<[email protected]> BODY=8BITMIME SIZE=5184

然后就完了。它只是停止做任何事情,Thunderbird 最终抱怨操作超时,但邮件日志没有注意到(没有关于断开连接或类似情况的记录)。

如果我进一步增加详细程度,实际上发生的最后一件事是:

postfix/smtpd[30091]: vstream_fflush_some: fd 23 flush 42

如果我把最后发生的事情-v全部加起来的话,那就是:master.cf

postfix/trivial-rewrite[18140]: dict_mysql_get_active: attempting to connect to host 127.0.0.1
postfix/trivial-rewrite[18140]: dict_mysql: successful connection to host 127.0.0.1

这是我的postconf -n

alias_maps = $alias_database
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
compatibility_level = 2
debug_peer_level = 9999
debug_peer_list = [2a02:xxxx:xxxx:9880:b5f0:b045:109d:4b64], otherdomain.net
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
default_destination_concurrency_limit = 20
dovecot_destination_recipient_limit = 1
inet_interfaces = all
local_destination_concurrency_limit = 2
local_transport = local
mailbox_size_limit = 0
message_size_limit = 52428800
mydestination = localhost
mydomain = domain.com
myhostname = domain.com
mynetworks = 127.0.0.0/8, 192.168.0.0/16
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/etc/postfix/rbl_override, reject_unauth_destination, reject_unauth_pipelining, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_hostname
smtpd_reject_unlisted_sender = yes
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/etc/postfix/rbl_override reject_unauth_destination, reject_unauth_pipelining, reject_non_fqdn_recipient
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual_sender_permissions.cf
smtpd_sender_restrictions = permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated, reject_unknown_recipient_domain, reject_unknown_sender_domain, reject_unknown_helo_hostname
smtpd_tls_cert_file = /etc/letsencrypt/live/domain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/domain.com/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
tls_high_cipherlist = AES128+EECDH:AES128+EDH:AES256-SHA256:HIGH:!aNULL:!eNULL:!DES:!MD5:!PSK:!RC4
tls_random_source = dev:/dev/urandom
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/kunden/mail/
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_mailbox_limit = 0
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
virtual_transport = dovecot
virtual_uid_maps = static:2000

我不知道还能尝试或观察什么,我所看到的一切对我来说都很好。

我的堆栈是:

  • 后缀
  • 鸽舍
  • 垃圾邮件刺客
  • spamass milter - 垃圾邮件过滤器
  • opendkim
  • mysql (postfix-mysql、dovecot-mysql)(用于账户和别名)

我如何再次发送和接收电子邮件?

答案1

通过重新启动MySQL服务器解决了该问题:

systemctl restart mysql postfix

相关内容