Postfix не отправляет почту на внешние серверы

Мой сервер Postfix не будет отправлять почту на любой другой сервер, кроме localhost.

Я использую пользователей и домены vitrual в системе Debian 8.5. Похоже, что исходящая почта доставляется spamassassin, который пытается доставить ее в локальный почтовый ящик. Я думаю, что что-то не так с моим postfix / master.cf, но я понятия не имею, что это может быть.

mail.log:

Aug 22 10:20:47 deepthought postfix/smtps/smtpd[16841]: connect from unknown[91.112.51.178]
Aug 22 10:20:47 deepthought dovecot: imap-login: Login: user=<gerald@zehetner.or.at>, method=PLAIN, rip=91.112.51.178, lip=176.9.82.151, mpid=16843, TLS, session=<56KmuaQ6mgBbcDOy>
Aug 22 10:20:47 deepthought postfix/smtps/smtpd[16841]: A202A2F00AA7: client=unknown[91.112.51.178], sasl_method=PLAIN, sasl_username=gerald@zehetner.or.at
Aug 22 10:20:47 deepthought postfix/cleanup[16846]: A202A2F00AA7: message-id=<>
Aug 22 10:20:47 deepthought postfix/qmgr[16670]: A202A2F00AA7: from=<gerald@zehetner.or.at>, size=493, nrcpt=1 (queue active)
Aug 22 10:20:47 deepthought spamd[18401]: spamd: connection from ip6-localhost [::1]:42002 to port 783, fd 6
Aug 22 10:20:47 deepthought spamd[18401]: spamd: setuid to vmail succeeded
Aug 22 10:20:47 deepthought spamd[18401]: spamd: processing message (unknown) for vmail:150
Aug 22 10:20:47 deepthought spamd[18401]: spamd: clean message (-0.9/3.0) for vmail:150 in 0.0 seconds, 480 bytes.
Aug 22 10:20:47 deepthought spamd[18401]: spamd: result: . 0 - ALL_TRUSTED,MISSING_MID,TVD_SPACE_RATIO scantime=0.0,size=480,user=vmail,uid=150,required_score=3.0,rhost=ip6-localhost,raddr=::1,rport=42002,mid=(unknown),autolearn=no autolearn_force=no
Aug 22 10:20:47 deepthought spamd[8044]: prefork: child states: II
Aug 22 10:20:48 deepthought postfix/pipe[16847]: A202A2F00AA7: to=<g.zehetner@precisma.at>, relay=spamassassin, delay=0.37, delays=0.28/0/0/0.09, dsn=5.1.1, status=bounced (user unknown)
Aug 22 10:20:48 deepthought postfix/cleanup[16846]: 009DF2F00C7D: message-id=<20160822082048.009DF2F00C7D@deepthought.zege.at>
Aug 22 10:20:48 deepthought postfix/bounce[16850]: A202A2F00AA7: sender non-delivery notification: 009DF2F00C7D
Aug 22 10:20:48 deepthought postfix/qmgr[16670]: 009DF2F00C7D: from=<>, size=2306, nrcpt=1 (queue active)
Aug 22 10:20:48 deepthought postfix/qmgr[16670]: A202A2F00AA7: removed
Aug 22 10:20:48 deepthought dovecot: lda(gerald@zehetner.or.at): sieve: msgid=<20160822082048.009DF2F00C7D@deepthought.zege.at>: stored mail into mailbox 'INBOX'
Aug 22 10:20:48 deepthought postfix/pipe[16851]: 009DF2F00C7D: to=<gerald@zehetner.or.at>, relay=dovecot, delay=0.13, delays=0.03/0/0/0.1, dsn=2.0.0, status=sent (delivered via dovecot service)
Aug 22 10:20:48 deepthought postfix/qmgr[16670]: 009DF2F00C7D: removed
Aug 22 10:20:48 deepthought postfix/smtps/smtpd[16841]: disconnect from unknown[91.112.51.178]

/etc/postfix/master.cf:

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# 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
#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_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o content_filter=spamassassin
smtps     inet  n       -       -       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  -o smtpd_client_restrictions=$mua_client_restrictions
  -o smtpd_helo_restrictions=$mua_helo_restrictions
  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o content_filter=spamassassin
#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  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  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       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}
#
# ====================================================================
#
# 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}
dovecot   unix  -       n       n       -       -       pipe flags=DRhu
  user=vmail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
spamassassin unix -     n       n       -       -       pipe
  user=vmail argv=/usr/bin/spamc -f -e /usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
  #user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

/ etc /postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no

smtpd_tls_cert_file=/etc/letsencrypt/live/relay.zege.at-0001/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/relay.zege.at-0001/privkey.pem
smtpd_use_tls=yes
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_sasl_authenticated
    permit_mynetworks
    reject_unauth_destination
    reject_non_fqdn_sender
    reject_non_fqdn_recipient
    reject_unknown_recipient_domain
    reject_non_fqdn_hostname
    reject_invalid_hostname
    reject_rbl_client zen.spamhaus.org
    reject_unauth_pipelining
    permit
smtpd_recipient_restrictions =
    permit_sasl_authenticated
    permit_mynetworks
    reject_invalid_hostname
    reject_non_fqdn_hostname
    reject_non_fqdn_recipient
    reject_non_fqdn_sender
    reject_unknown_sender_domain
    reject_unknown_recipient_domain
    reject_sender_login_mismatch
    reject_unauth_pipelining
    reject_unauth_destination
    reject_multi_recipient_bounce
    reject_non_fqdn_helo_hostname
    reject_invalid_helo_hostname
    reject_rbl_client zen.spamhaus.org
    permit
smtpd_sender_restrictions =
    permit_sasl_authenticated
    permit_mynetworks
    reject_unauth_destination
    reject_non_fqdn_sender
    reject_non_fqdn_recipient
    reject_unknown_recipient_domain
    reject_unauth_pipelining
    reject_rbl_client zen.spamhaus.org
    permit
smtpd_client_restrictions = reject_invalid_hostname
smtpd_data_restrictions =
    reject_unauth_pipelining
    reject_multi_recipient_bounce
    permit
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

spamassassin_destination_recipient_limit = 1

myhostname = deepthought.zege.at
myorigin = /etc/mailname
mydestination = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_alias_maps =
   proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
   proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
   proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps =
   proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf,
   proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
#virtual_create_maildirsize = yes
#virtual_mailbox_extended = yes
#virtual_mailbox_limit_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_limit_maps.cf
#virtual_mailbox_limit_override = yes
#virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
#virtual_overquota_bounce = yes
0
задан 22 August 2016 в 11:33
1 ответ

Хорошо. Я обнаружил проблему.

В postfix / master.cf служба spamassassin пыталась доставить с помощью dovecot-lda, поэтому после проверки на спам она попыталась доставить в локальный почтовый ящик.

поэтому я использовал вместо этого

spamassassin unix -     n       n       -       -       pipe
user=vmail argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

и теперь он работает отлично.

0
ответ дан 5 December 2019 в 09:40

Теги

Похожие вопросы