带有 Amavis 的 Postfix 在 mail.log 中返回“name=localhost type=A:未找到主机”

带有 Amavis 的 Postfix 在 mail.log 中返回“name=localhost type=A:未找到主机”

完整错误:

Dec 23 19:44:31 example.com postfix/pickup[5589]: 39332276875: uid=0 from=<fredflinstone>
Dec 23 19:44:31 example.com postfix/cleanup[5605]: 39332276875: message-id=<[email protected]>
Dec 23 19:44:31 example.com postfix/qmgr[5590]: 39332276875: from=<[email protected]>, size=300, nrcpt=1 (queue active)
Dec 23 19:44:31 example.com postfix/smtp[5607]: 39332276875: to=<[email protected]>, relay=none, delay=0.05, delays=0.03/0.01/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=localhost type=A: Host not found)
Dec 23 19:44:31 example.com postfix/cleanup[5605]: 453F3276876: message-id=<[email protected]>
Dec 23 19:44:31 example.com postfix/bounce[5608]: 39332276875: sender non-delivery notification: 453F3276876
Dec 23 19:44:31 example.com postfix/qmgr[5590]: 453F3276876: from=<>, size=2273, nrcpt=1 (queue active)
Dec 23 19:44:31 example.com postfix/qmgr[5590]: 39332276875: removed
Dec 23 19:44:31 example.com postfix/local[5609]: 453F3276876: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Dec 23 19:44:31 example.com postfix/qmgr[5590]: 453F3276876: removed

Localhost 位于 /etc/hosts 中。可以 ping 通它。可能是 nsswitch.conf 或 host.conf?当我从 postfix 禁用 amavis 时,邮件可以正常发送。这是我的 postfix 配置:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
content_filter = smtp-amavis:[localhost]:10024
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = $myhostname, example.com, localhost
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
policy-spf_time_limit = 3600s
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = , check_policy_service unix:private/policy-spf, check_policy_service unix:private/policy-spf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_auth_only = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = no
tls_random_source = dev:/dev/urandom

/etc/nsswitch.conf

hosts:          files resolv [!UNAVAIL=return] mdns4_minimal [NOTFOUND=return] dns myhostname

/etc/主机.conf

order hosts,bind
multi on

/etc/hosts

127.0.0.1 localhost
10.0.7.4  localhost example.com localhost.example.com
::1 localhost ip6-localhost ip6-loopback

/etc/postfix/master.conf

smtp      inet  n       -       y       -       -       smtpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
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}

policy-spf unix    -       n       n       -       0     spawn
      user=nobody argv=/usr/bin/policyd-spf

smtp-amavis unix    -       -       -       -       2     smtp
     -o smtp_data_done_timeout=1200
     -o smtp_send_xforward_command=yes
     -o smtp_tls_note_starttls_offer=no

127.0.0.1:10025 inet n    -       -       -       -     smtpd
     -o content_filter=
     -o smtpd_delay_reject=no
     -o smtpd_client_restrictions=permit_mynetworks,reject
     -o smtpd_helo_restrictions=
     -o smtpd_sender_restrictions=
     -o smtpd_recipient_restrictions=permit_mynetworks,reject
     -o smtpd_data_restrictions=reject_unauth_pipelining
     -o smtpd_end_of_data_restrictions=
     -o smtpd_restriction_classes=
     -o mynetworks=127.0.0.0/8
     -o smtpd_error_sleep_time=0
     -o smtpd_soft_error_limit=1001
     -o smtpd_hard_error_limit=1000
     -o smtpd_client_connection_count_limit=0
     -o smtpd_client_connection_rate_limit=0
     -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
     -o local_header_rewrite_clients=
     -o smtpd_milters=
     -o local_recipient_maps=
     -o relay_recipient_maps=

注意内容过滤器。如果我注释掉它,邮件就可以正常发送。所以问题出在 amavis 上?新服务器上的新安装。Ubuntu 16.10

答案1

您在 中遇到错误/etc/hosts

您已定义10.0.7.4 localhost,这是破坏 localhost 的绝佳方法。此内容不应存在,应立即删除。

答案2

将 main.cf 中的 amavisd 内容过滤器行从 localhost 更改为 127.0.0.1 解决了该问题。

相关内容