Postfix/Dovecot 错误:4.7.1 服务不可用 - 稍后再试

Postfix/Dovecot 错误:4.7.1 服务不可用 - 稍后再试

我的邮件服务器出了点问题。我无法发送或接收任何邮件。

以下是我看到的内容/var/log/mail.info

Aug 12 20:09:34 REDACTED postfix/submission/smtpd[23064]: connect from ***[***]
Aug 12 20:09:34 REDACTED postfix/submission/smtpd[23064]: Anonymous TLS connection established from ***[***]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Aug 12 20:09:34 REDACTED postfix/submission/smtpd[23064]: 9ADA33260108: client=***[***], sasl_method=PLAIN, sasl_username=***
Aug 12 20:09:34 REDACTED postfix/cleanup[23068]: 9ADA33260108: message-id=<***@mail.gmail.com>
Aug 12 20:09:34 REDACTED spamd[30569]: spamd: connection from localhost.localdomain [127.0.0.1] at port 36295
Aug 12 20:09:34 REDACTED spamd[30569]: spamd: setuid to spamass-milter succeeded
Aug 12 20:09:34 REDACTED spamd[30569]: spamd: processing message <*@mail.gmail.com> for spamass-milter:109
Aug 12 20:09:34 REDACTED spamd[30569]: spamd: clean message (-1.0/3.0) for spamass-milter:109 in 0.1 seconds, 1482 bytes.
Aug 12 20:09:34 REDACTED spamd[30569]: spamd: result: . 0 - ALL_TRUSTED,HTML_MESSAGE scantime=0.1,size=1482,user=spamass-milter,uid=109,required_score=3.0,rhost=localhost.localdomain,raddr=127.0.0.1,rport=36295,mid=<***@mail.gmail.com>,autolearn=unavailable
Aug 12 20:09:34 REDACTED postfix/cleanup[23068]: 9ADA33260108: milter-reject: END-OF-MESSAGE from ***[***]: 4.7.1 Service unavailable - try again later; from=<***> to=<***> proto=ESMTP helo=<mail-it0-f45.google.com>
Aug 12 20:09:34 REDACTED spamd[30568]: prefork: child states: II
Aug 12 20:09:34 REDACTED postfix/submission/smtpd[23064]: disconnect from mail-it0-f45.google.com[***]

以下是 Telnet 的一些输出:

*@*:/home/mydir# telnet localhost 25
Trying ::1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 * ESMTP Postfix
HELO example.com
250 *
MAIL FROM:<*@*>
250 2.1.0 Ok
RCPT TO:<*@*>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
test

.
451 4.7.1 Service unavailable - try again later

最后这是我的main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# 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_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = example
mydomain = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = localhost, localhost.example.com
relayhost =
mynetworks = 127.0.0.0/8, [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
default_process_limit = 3
inet_interfaces = all
queue_directory = /var/spool/postfix

# Virtual mailbox configuration
dovecot_destination_recipient_limit = 1
virtual_mailbox_base=/var/email
virtual_mailbox_domains=hash:/etc/postfix/vmail_domains
virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox
virtual_alias_maps=hash:/etc/postfix/vmail_aliases
virtual_minimum_uid=10
virtual_uid_maps=static:7788
virtual_gid_maps=static:7788
virtual_transport=dovecot

# SSL configuration
smtpd_tls_cert_file=/etc/letsencrypt/live/www.example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/www.example.com/privkey.pem
#smtpd_tls_CAfile=/etc/ssl/certs/ca-certificates.crt
#smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt
smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3
smtp_tls_mandatory_protocols=!SSLv2,!SSLv3
smtpd_tls_protocols=!SSLv2,!SSLv3
smtp_tls_protocols=!SSLv2,!SSLv3
smtp_use_tls=yes
smtpd_use_tls=yes
smtpd_tls_auth_only=no
smtpd_tls_loglevel=1
smtpd_tls_received_header=yes
smtpd_banner=$myhostname ESMTP $mail_name
tls_random_source=dev:/dev/urandom
smtp_tls_note_starttls_offer=yes
smtpd_tls_session_cache_timeout=3600s
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
queue_directory=/var/spool/postfix

# Anti-spam
smtpd_recipient_restrictions = permit_sasl_authenticated,
        permit_mynetworks,
        reject_non_fqdn_hostname,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_invalid_hostname,
        reject_unauth_destination,
        check_policy_service unix:private/policy,
        reject_unauth_pipelining,
        reject_rbl_client sbl.spamhaus.org,
        check_policy_service unix:private/policy,
        permit
smtpd_helo_restrictions = reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname
#       reject_unknown_helo_hostname
smtpd_client_restrictions = reject_rbl_client dnsbl.sorbs.net, permit

# Authentication settings, making use of SASL
smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth
smtpd_sasl_auth_enable=yes
broken_sasl_auth_clients=yes
smtpd_sasl_security_options=noanonymous
smtpd_sasl_tls_security_options=$smtpd_sasl_security_options
smtpd_sasl_local_domain=$myhostname
smtpd_helo_required=yes

# Milters and Filters (copyright by bgm for band reasons)
header_checks = pcre:/etc/postfix/header_checks.pcre
policy_time_limit = 3600s
policy-spf_time_limit = 3600s
non_smtpd_milters = unix:/milter-greylist/milter-greylist.sock, unix:/spamass/spamass.sock, unix:/clamav/clamav-milter.ctl, unix:/var/run/opendkim/opendkim.sock
#unix:/milter-greylist/milter-greylist.sock, unix:/clamav/clamav-milter.ctl, unix:/spamass/spamass.sock, unix:/var/run/opendkim/opendkim.sock
smtpd_milters = unix:/milter-greylist/milter-greylist.sock, unix:/spamass/spamass.sock, unix:/clamav/clamav-milter.ctl, unix:/var/run/opendkim/opendkim.sock
#unix:/milter-greylist/milter-greylist.sock, unix:/clamav/clamav-milter.ctl, unix:/spamass/spamass.sock
#, unix:/var/run/opendkim/opendkim.sock
milter_connect_macros = i b j _ {daemon_name} {if_name} {client_addr}
#milter_connect_macros = j {daemon_name} v {if_name} _
milter_protocol = 2
milter_default_action = accept

有人能对这个问题提供任何见解吗?我觉得我已经排除故障几个小时了,但我没有发现明显的问题。

更新:问题似乎出在 clamav 上。如果我找到解决方案,我将在下面更新。

更新 2:问题是 clamav-daemon 占用了太多内存,我的系统正在将其关闭。我想我们现在可以称这个问题已经解决了。

答案1

尝试删除灰名单邮件。灰名单是一种向所有人返回临时错误的做法,目的是阻止垃圾邮件发送者,因为垃圾邮件发送者通常不会重试发送邮件,但真正的邮件服务器会重试。

如果这不起作用,请尝试禁用所有邮件过滤器。Postfix 日志显示“milter-reject”,因此似乎其中一个邮件过滤器导致了问题。

相关内容