邮件系统:用户未知操作:失败状态:5.1.1诊断代码:x-unix;用户未知

邮件系统:用户未知操作:失败状态:5.1.1诊断代码:x-unix;用户未知

我在 Debian Jessie 8.5 上有一个来自 Postfix、Dovecot、Amavis、Spamassin 的邮件系统。

Imap 和 pop3 工作正常。通过 ssl 的 Smtp 端口 465 发送正常,投递正常,但端口 25 和 587 收到错误“所有本地收件人和 Internet 邮箱的未投递用户未知”。

我的master.cf是:

dovecot unix - n n - - pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
    -o content_filter=spamassassin
#    -o smtpd_tls_security_level=none
    -o smtpd_tls_security_level=may
    -o smtpd_sasl_auth_enable=yes


#    -o smtpd_sasl_auth_enable=no
#spamassassin unix -     n       n       -       -       pipe
#        user=spamd argv=/usr/bin/spamc -f -e
#        /usr/sbin/sendmail -oi -f ${sender} ${recipient}
spamassassin unix -     n   n   -   -   pipe
    flags=DROhu user=vmail:vmail argv=/usr/bin/spamc -f -e 
    /usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} 



#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       -       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
  -o smtpd_helo_restrictions=permit_mynetworks,reject_invalid_hostname,permit 
  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
#-o content_filter=
#-o receive_override_options=no_header_body_checks
#-o content_filter=
#-o receive_override_options=no_header_body_checks

cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       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  -       -       n      -       -       smtp
relay     unix  -       -       n       -       -       smtp
#       -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}

#dovecot   unix  -       n       n       -       -       pipe
#flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} -e


#dovecot unix - n n - - pipe
#flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} -e

#
# ====================================================================
#
# 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

#virtual_transport = lmtp:unix:private/dovecot-lmtp

# ====================================================================
#
# 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}


#smtp-amavis unix - - - - 2 smtp
#-o smtp_data_done_timeout=1200
#-o smtp_send_xforward_command=yes
#-o disable_dns_lookups=yes
#-o max_use=20

#amavis unix - - - - 2 smtp
#        -o smtp_data_done_timeout=1200
#        -o smtp_send_xforward_command=yes


#127.0.0.1:10025 inet n - - - - smtpd
#-o content_filter=
#-o local_recipient_maps=
#-o relay_recipient_maps=
#-o smtpd_restriction_classes=
#-o smtpd_client_restrictions=
#-o smtpd_helo_restrictions=
#-o smtpd_sender_restrictions=
#-o smtpd_recipient_restrictions=permit_mynetworks,reject
#-o mynetworks=127.0.0.0/8
#-o strict_rfc821_envelopes=yes
#-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
#-o smtpd_bind_address=127.0.0.1


#-o content_filter=
#-o local_recipient_maps=
#-o relay_recipient_maps=
#-o smtpd_restriction_classes=
#-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 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




smtp-amavis     unix    -       -       -       -       2       smtp
        -o smtp_data_done_timeout=1200
        -o smtp_send_xforward_command=yes
        -o disable_dns_lookups=yes
        -o max_use=20

127.0.0.1:10025 inet    n       -       -       -       -       smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_delay_reject=no
        -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
        -o smtpd_helo_restrictions=permit_mynetworks,reject_invalid_hostname,permit
        -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 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

policy-spf  unix  -       n       n       -       -       spawn
     user=nobody argv=/usr/sbin/postfix-policyd-spf-perl

vacation unix - n n - - pipe
     flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} ${recipient}

主文件

#/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)
biff = no

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

milter_protocol = 2
milter_default_action = accept

smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301

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

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

myhostname = mail.exapmle.net
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
virtual_mailbox_base = /mail/
mailbox_command = /usr/libexec/dovecot/deliver
mydestination = localhost, localhost.localdomain
relayhost = 
mynetworks = 127.0.0.0/8 
mailbox_size_limit = 600000000000
message_size_limit = 51200000
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
#net_protocols = all
virtual_minimum_uid = 7030
virtual_uid_maps = static:7030
virtual_gid_maps = static:7030

#relay_recipient_maps = 
#  mysql:/etc/postfix/mysql_virtual_alias_maps.cf, 
#  mysql:/etc/postfix/mysql_virtual_alias_domain_maps.cf, 
#  mysql:/etc/postfix/mysql_virtual_alias_domain_catchall_maps.cf


virtual_alias_maps = 
  mysql:/etc/postfix/mysql_virtual_alias_maps.cf, 
  mysql:/etc/postfix/mysql_virtual_alias_domain_maps.cf,  
#  mysql:/etc/postfix/mysql_virtual_alias_domain_catchall_maps.cf

virtual_mailbox_domains = 
  mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_mailbox_maps =
  mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf,
  mysql:/etc/postfix/mysql_virtual_alias_domain_mailbox_maps.cf

#irtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
#irtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
#irtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
#irtual_alias_domains = mysql:/etc/postfix/mysql_virtual_alias_domains_maps.cf

#virtual_transport = virtual
#local_recipient_maps = $virtual_mailbox_maps
local_transport = virtual
virtual_transport = dovecot
transport_maps = hash:/etc/postfix/transport
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = #$myhostname
 #smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
#smtpd_sasl_security_options = noplaintext
#smtpd_sasl_path = /var/spool/postfix/private/auth

# check_policy_service unix:private/policy is for spf filter
smtpd_recipient_restrictions =
    permit_mynetworks,
        check_client_access hash:/etc/postfix/client_checks,
        check_sender_access hash:/etc/postfix/sender_checks,
    permit_sasl_authenticated,
    reject_unauth_pipelining,
    reject_unauth_destination,
    check_policy_service unix:private/policy-spf,
    reject_invalid_hostname,
    reject_unknown_recipient_domain,
    reject_unauth_pipelining,
#   reject_non_fqdn_hostname,
#   reject_non_fqdn_sender,
 #  reject_non_fqdn_recipient,
    reject_unknown_sender_domain,
    reject_rbl_client sbl.spamhaus.org,
    reject_rbl_client blackholes.easynet.nl,
    reject_rbl_client dnsbl.njabl.org,

     #   reject_rbl_client bl.spamcop.net,
     #   reject_rbl_client sbl-xbl.spamhaus.org,
     #   reject_rbl_client multi.uribl.com,
     #   reject_rbl_client dsn.rfc-ignorant.org,
     #   reject_rbl_client dul.dnsbl.sorbs.net,
     #   reject_rbl_client list.dsbl.org,
     #   reject_rbl_client dnsbl.sorbs.net,
     #   reject_rbl_client cbl.abuseat.org,
     #   reject_rbl_client ix.dnsbl.manitu.net,
     #   reject_rbl_client combined.rbl.msrbl.net,
     #   reject_rbl_client rabl.nuclearelephant.com,
     #   reject_rbl_client dnsbl.sorbs.net,
     #   reject_rbl_client bad.psky.me,
     #   reject_rbl_client b.barracudacentral.org,
     #   reject_rbl_client truncate.gbudb.net,
     #   reject_rbl_client dnsbl-1.uceprotect.net,
     #   reject_rbl_client sbl.spamhaus.org,
     #  reject_rbl_client zen.spamhaus.org,
        permit


#smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,reject_invalid_hostname,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_rbl_client sbl-xbl.spamhaus.org
content_filter = smtp-amavis:[127.0.0.1]:10024
#receive_override_options = no_address_mappings

smtpd_tls_cert_file=/etc/ssl/certs/mail.pem
smtpd_tls_key_file=/etc/ssl/private/mail.key


smtpd_use_tls=yes
smtpd_tls_auth_only = no


smtpd_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA,3DES, MD5, DES+MD5

smtp_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA,3DES, MD5, DES+MD5

smtpd_tls_dh1024_param_file = /etc/ssl/private/dhparams.pem


smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
smtpd_sasl_security_options = noanonymous
#smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated

broken_sasl_auth_clients = yes
smtp_use_tls = yes
default_process_limit = 500
smtp_destination_recipient_limit = 1024
#policy_time_limit = 3600myorigin = /etc/mailname
#local_transport = local
#local_transport = virtual

#dovecot_destination_concurrency_limit = 2
#dovecot_destination_recipient_limit = 1
#content_filter = smtp-amavis:[127.0.0.1]:10024
policy-spf_time_limit = 3600


strict_rfc821_envelopes = yes
disable_vrfy_command = yes
smtpd_helo_required = yes
smtpd_client_restrictions =
smtpd_helo_restrictions =
     check_client_access hash:/etc/postfix/rbl_override,
     permit_mynetworks,
#     reject_non_fqdn_hostname,
#     reject_invalid_hostname,
     permit
smtpd_sender_restrictions =
     check_client_access hash:/etc/postfix/rbl_override,
     reject_unknown_sender_domain,
     reject_non_fqdn_sender,
smtpd_tls_security_level = may
smtp_tls_security_level = may
#smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
#smtpd_sasl_security_options = noplaintext
#smtpd_tls_auth_only = no

spamassassin_destination_recipient_limit = 1
vacation_destination_recipient_limit = 1
dovecot_destination_recipient_limit = 1

#smtpd_tls_loglevel = 3

#debug_peer_level = 5
#debug_peer_list = 127.0.0.1

#ebug_peer_level = 5

错误信息:

is is the mail system at host mail.domain

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<user@domain>: user unknown

Reporting-MTA: dns; mail.bookaa.net
X-Postfix-Queue-ID: B6D5FA0599
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Thu, 24 Nov 2016 14:40:43 +0100 (CET)

Final-Recipient: rfc822; user@domain
Original-Recipient: rfc822;user@domain
Action: failed
Status: 5.1.1
Diagnostic-Code: x-unix; user unknown

日志文件:

11 月 24 日 14:40:44 邮件 postfix/qmgr[21146]:B6D5FA0599:from=,size=1137,nrcpt=1(队列活动) 11 月 24 日 14:40:44 邮件 postfix/smtpd[27356]:与邮件断开连接。 domail[IP SERVER] 11 月 24 日 14:40:44 邮件 postfix/pipe[2422]:B6D5FA0599:to=,中继=spamassassin,延迟=0.54,延迟=0.37/0/0/0.17,dsn=5.1.1,状态=已退回(用户未知)11 月 24 日 14:40:44 邮件 postfix/cleanup[2442]:2C4A1A05DE:message-id=<[电子邮件受保护]> 11 月 24 日 14:40:44 邮件 postfix/bounce[3155]:B6D5FA0599:发件人未送达通知:2C4A1A05DE 11 月 24 日 14:40:44 邮件 postfix/qmgr[21146]:2C4A1A05DE:from=<>,大小=3257 ,nrcpt=1(队列活动)11 月 24 日 14:40:44 邮件 postfix/qmgr[21146]:B6D5FA0599:删除 11 月 24 日 14:40:44 邮件 postfix/pipe[3015]:2C4A1A05DE:to=,relay=dovecot,延迟=0.23,延迟=0/0/0/0.22,dsn=2.0.0,状态=已发送(通过dovecot服务传递)11月24日14:40:44邮件postfix/qmgr[21146]:2C4A1A05DE:已删除

答案1

master.cf在 postfix 中添加这两行后,一切都开始工作:

smtp unix - - n - - smtp -v -v
smtp inet n - n - - smtpd -v -v

postfix/smtpd - 这通常是 SMTP 守护进程,用于处理传入邮件并路由到适当的内部位置。 postfix/smtp - 这通常是用于向全世界发送邮件的 SMTP 守护进程。

smtp inet n - n - - smtpd 这一行告诉 postfix 通过 25 端口发送邮件

相关内容