后缀 - 连​​接到 127.0.0.1[127.0.0.1]:10024:连接被拒绝)

Postfix - connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

我经常遇到 postfix 问题(在 Debian Squeeze 上,还安装了 amavisd-new 和 fail2ban):突然之间,通常是在晚上(但并非总是如此),邮件停止投递并且队列已满.日志显示了一堆这种风格的条目:

May 18 19:54:16 ks4000003 postfix/error[6889]: 376352016039: to=<info@xxxxxxx>, relay=none, delay=0.62, delays=0.58/0.01/0/0.04, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

一旦我重新启动服务器,它就可以工作了(并且队列被全部清除)。直到下一次(通常每 1-2 周一次,但最近每天早上我都必须重新启动服务器)之前,它仍然没有任何问题。

如有任何想法,我们将不胜感激。我应该提到我真的是服务器管理的新手;我在 google/Whosebug 上搜索了类似的问题,但找不到真正的类似问题。

我的后缀配置文件:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
always_add_missing_headers = yes
append_dot_mydomain = no
biff = no
body_checks = regexp:/etc/postfix/body_checks
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
header_checks = regexp:/etc/postfix/header_checks
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
mailbox_size_limit = 0
message_size_limit = 0
mime_header_checks = regexp:/etc/postfix/mime_header_checks
mydestination = ks4000003.ip-198-245-60.net, localhost, localhost.localdomain
myhostname = ks4000003.ip-198-245-60.net
mynetworks = 127.0.0.0/8 [::1]/128
myorigin = /etc/mailname
nested_header_checks = regexp:/etc/postfix/nested_header_checks
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
readme_directory = /usr/share/doc/postfix
receive_override_options = no_address_mappings
recipient_delimiter = +
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
relayhost = 
smtp_destination_concurrency_limit = 5
smtp_destination_rate_delay = 1s
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
smtpd_error_sleep_time = 0
smtpd_recipient_restrictions = check_client_access hash:/etc/postfix/rbl_whitelist, permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unknown_recipient_domain, reject_unauth_destination, reject_unverified_sender, reject_unauth_destination,reject_unlisted_recipient, reject_invalid_hostname, reject_non_fqdn_sender, reject_rbl_client cbl.abuseat.org, reject_rbl_client bl.spamcop.net, reject_rbl_client sbl.spamhaus.org, reject_rbl_client truncate.gbudb.net
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_access mysql:/etc/postfix/mysql-virtual_sender.cf reject_non_fqdn_sender reject_unknown_sender_domain
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
unknown_local_recipient_reject_code = 550
virtual_alias_domains = 
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000

首先是 amavis 问题: 根据您的 pastebin:qmgr 从 amavis 请求一些东西并得到它不理解的响应。我假设 qmgr 向 amavis 发送了一封应该检查的邮件。 amavis 已关闭或邮件导致 amavis 产生损坏的响应。但是你怎么能检查这个呢?

最好的方法是停止 amavis 服务并使用

从控制台启动它
# amavisd debug

然后amavis会输出到控制台。 这是一个可能有帮助的 link:http://www.amavis.org/#faq

然后数据库问题:

根据您的 pastebin:dovecot 和 postfix 尝试连接到 mysql 数据库。 postfix 使用地址为 localhost 或 127.0.0.1 的 tcp 套接字,dovecot 使用 unix 套接字。如果您没有更改 mysql 端口的配置,地址 127.0.0.1:3306 应该有一个监听套接字。 监听地址有可能是IPv6地址,如::1:3306

您可以通过以下方式验证:netstat -ltn

如果您配置了不同的端口,则该端口必须显示在 netstat 输出中。您可能已将 mysql 配置为传出 IP 地址。然后你会发现类似 198.245.60.7:3306 的内容。在这种情况下,无法访问 127.0.0.1:3306。

"postfix" 错误消息说该端口没有侦听器或您没有访问权限。 "dovecot" 消息说您向 mysql 服务器提供了 none 或错误的密码,因此它不会验证 dovecot。请检查配置。