Postfix 突然开始记录“未知服务:smtp/tcp”

Postfix 突然开始记录“未知服务:smtp/tcp”

首先,是的,我知道其他帖子关于这一点,但它对我没有帮助。

不久前,我们的系统管理员意外离职,没有接替或交接,现在暂时由我来负责。我只是一个没有系统管理员经验的开发人员。

他离开后,我们更改了所有服务器上的 root 密码,还重启了运行 postfix 的服务器。但从那以后,再也没有发送过邮件。

/var/log/mail.log 中的日志充满了如下条目:

postfix/smtp[31834]: fatal: unknown service: smtp/tcp
postfix/smtpd[31815]: disconnect from unknown[IP censored]
postfix/qmgr[31806]: warning: private/smtp socket: malformed response
postfix/qmgr[31806]: warning: transport smtp failure -- see a previous     warning/fatal/panic logfile record for the problem description
postfix/master[31799]: warning: process /usr/lib/postfix/smtp pid 31834 exit status 1
postfix/master[31799]: warning: /usr/lib/postfix/smtp: bad command startup -- throttling

以下是重启时刻(发生在 10:37 到 10:38 之间)的日志:

10:31:36  postfix/qmgr[24341]: 1B4463E9C7E: from=<[email protected]>, size=1191, nrcpt=1 (queue active)
10:31:36  postfix/qmgr[24341]: E5F003F1132: from=<[email protected]>, size=12656, nrcpt=1 (queue active)
10:31:36  postfix/qmgr[24341]: 86E0E42A6A7: from=<>, size=5109, nrcpt=1 (queue active)
10:31:36  postfix/smtp[24765]: connect to b.zj.cn.x.ourdomain.tld[IP]:25: Connection refused
10:31:36  postfix/smtp[24766]: connect to b.zj.cn.x.ourdomain.tld[IP]:25: Connection refused
10:31:36  postfix/smtp[24765]: 1B4463E9C7E: to=<[email protected]>, relay=none, delay=29793, delays=29793/0.01/0/0, dsn=4.4.1, status=deferred (connect to b.zj.cn.x.ourdomain.tld[IP]:25: Connection refused)
10:31:36  postfix/smtp[24766]: E5F003F1132: to=<[email protected]>, relay=none, delay=29792, delays=29792/0.01/0/0, dsn=4.4.1, status=deferred (connect to b.zj.cn.x.ourdomain.tld[IP]:25: Connection refused)
10:31:57  postfix/smtp[24768]: connect to tmg-tmg-chn-shn-1-1.l.ourdomain.tld[IP]:25: Connection timed out
10:31:57  postfix/smtp[24768]: 86E0E42A6A7: to=<[email protected]>, relay=none, delay=29794, delays=29773/0.02/21/0, dsn=4.4.1, status=deferred (connect to tmg-tmg-chn-shn-1-1.l.ourdomain.tld[IP]:25: Connection timed out)
10:32:17  postfix/anvil[24722]: statistics: max connection rate 1/60s for (smtp:IP) at 10:28:55
10:32:17  postfix/anvil[24722]: statistics: max connection count 1 for (smtp:IP) at 10:28:55
10:32:17  postfix/anvil[24722]: statistics: max cache size 1 at 10:28:55
10:37:41  postfix/master[24334]: terminating on signal 15
10:37:45  opendkim[29682]: OpenDKIM Filter: mi_stop=1
10:37:45  opendkim[29682]: OpenDKIM Filter v2.0.1 terminating with status 0, errno = 0
10:38:51  opendkim[1188]: OpenDKIM Filter v2.0.1 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid -p inet:[email protected])
10:39:03  spamd[1179]: logger: removing stderr method
10:39:05  spamd[1415]: spamd: server started on port 783/tcp (running version 3.3.1)
10:39:05  spamd[1415]: spamd: server pid: 1415
10:39:05  spamd[1415]: spamd: server successfully spawned child process, pid 1422
10:39:05  spamd[1415]: spamd: server successfully spawned child process, pid 1423
10:39:05  spamd[1415]: prefork: child states: II
10:39:23  postfix/master[1646]: daemon started -- version 2.7.1, configuration /etc/postfix
10:39:24  postfix/qmgr[1661]: A80B73EA677: from=<[email protected]>, size=1069, nrcpt=1 (queue active)
10:39:24  postfix/smtp[1663]: fatal: unknown service: smtp/tcp
10:39:24  postfix/qmgr[1661]: 981B73EAB53: from=<[email protected]>, size=1034, nrcpt=1 (queue active)
10:39:24  postfix/qmgr[1661]: 91A0F42A8CC: from=<>, size=3722, nrcpt=1 (queue active)
10:39:24  postfix/smtp[1664]: fatal: unknown service: smtp/tcp
10:39:24  postfix/smtp[1665]: fatal: unknown service: smtp/tcp
10:39:24  postfix/qmgr[1661]: 3E73F42A8CB: from=<>, size=24898, nrcpt=1 (queue active)
10:39:24  postfix/smtp[1666]: fatal: unknown service: smtp/tcp
10:39:25  postfix/qmgr[1661]: warning: private/smtp socket: malformed response
10:39:25  postfix/qmgr[1661]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
10:39:25  postfix/master[1646]: warning: process /usr/lib/postfix/smtp pid 1663 exit status 1
10:39:25  postfix/master[1646]: warning: /usr/lib/postfix/smtp: bad command startup -- throttling

类似问题的答案都围绕着 smtp 是否运行 chroot。在我的 Debian Squeeze 服务器上,默认设置似乎是“是”,并且他们的所有建议都已在我的服务器上实现:

  • 我使用正确的脚本重新启动了 postfixservice postfix restart
  • 所有相关文件/etc被复制到/var/spool/postfix/etc
  • /var/spool/postfix/etc/services包含必需的

条目:

smtp        25/tcp      mail
ssmtp       465/tcp     smtps       # SMTP over SSL

我也尝试过让 smtp 不 chrooted,但什么都没变。有一点让我有点困惑,那就是除此之外,/etc/postfix/master.cf/usr/lib/postfix/master.cf.

为了完整起见,这里是人们通常要求的内容/输出。

输出postconf -n(已审查)

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
config_directory = /etc/postfix
html_directory = /usr/share/doc/postfix/html
inet_interfaces = mail.ourdomain.tld (...other IPs from our servers...) 127.0.0.1
lmtp_host_lookup = native
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = mail.ourdomain.tld tmg-aly-chn-hng-1-0.ourdomain.tld localhost
myhostname = mail.ourdomain.tld
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 (...other IPs from our servers...)
myorigin = mail.ourdomain.tld
non_smtpd_milters = inet:127.0.0.1:8891
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
smtp_host_lookup = native
smtp_sasl_path = smtpd
smtp_sasl_security_options = 
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject
smtpd_milters = inet:127.0.0.1:8891
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = 
smtpd_tls_cert_file = ...our cert path...
smtpd_tls_key_file = ...our key path...
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_use_tls = yes

内容/etc/postfix/master.cf

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_sasl_path=smtpd
#  -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
    -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -   n   n   -   2   pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

有什么想法我还可以尝试什么,在哪里可以查看?它一直在记录unknown service: smtp/tcp...

相关内容