Postfix

如果通過 SMTP 注入,Postfix 會拒絕未知電子郵件地址,但如果通過 /usr/sbin/sendmail 注入則接受它們

  • April 12, 2013

我正在使用PostfixMailman來處理我的一台伺服器上的郵件列表。Postfix 中定義了一種傳遞方法來處理郵件列表的傳入郵件,“mailman”。此傳遞方法用於兩個僅託管郵件列表的域:

  • charmides.phl.univie.ac.at
  • lists.girlsrock.at

據我所知,這兩個域的設置是相同的。然而,雖然 mailing 適用於charmides.phl.univie.ac.at工作,但不適用於lists.girlsrock.at。也就是說,當且僅當電子郵件通過 SMTP 注入時,Postfix才會回复:“收件人地址被拒絕:中繼收件人表中的使用者未知”。

詳細錯誤

root@menon:/etc/postfix# telnet localhost smtp
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 menon.phl.univie.ac.at ESMTP Postfix (Debian/GNU)
helo localhost
250 menon.phl.univie.ac.at
mail from:<root>
250 2.1.0 Ok
rcpt to:<postmaster@lists.girlsrock.at>
550 5.1.1 <postmaster@lists.girlsrock.at>: Recipient address rejected: User unknown in relay recipient table

但是,以下工作;也就是說,它會向 postmaster@lists.girlsrock.at 發送一條空消息:

sendmail postmaster@lists.girlsrock.at

相比之下,charmides.phl.univie.ac.at沒有這樣的問題:

root@menon:/etc/postfix# telnet localhost smtp
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 menon.phl.univie.ac.at ESMTP Postfix (Debian/GNU)
helo localhost
250 menon.phl.univie.ac.at
mail from:<root>
250 2.1.0 Ok
rcpt to:<postmaster@charmides.phl.univie.ac.at>
250 2.1.5 Ok

據我所知,這兩種配置是相同的。

我的設置

/etc/hosts

127.0.0.1   localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0     ip6-localnet
ff00::0     ip6-mcastprefix
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

131.130.46.92   menon.phl.univie.ac.at
131.130.46.92   charmides.phl.univie.ac.at
131.130.46.92   lists.girlsrock.at

/etc/postfix/main.cf

append_dot_mydomain = no
readme_directory = no
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_local_domain =
smtp_sasl_auth_enable = no
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_unknown_sender_domain, reject_non_fqdn_recipient, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:12525

myhostname = menon.phl.univie.ac.at
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = menon.phl.univie.ac.at, localhost.phl.univie.ac.at, localhost
relayhost = 

relay_domains = $mydestination, charmides.phl.univie.ac.at, lists.girlsrock.at
relay_recipient_maps = hash:/var/lib/mailman/data/virtual-mailman
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

recipient_delimiter = +
inet_interfaces = all

mail_spool_directory = /srv/mail/

mailbox_command = /usr/bin/procmail
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

/etc/postfix/master.cf

smtp      inet  n       -       -       -       -       smtpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
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_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

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}

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

/etc/後綴/傳輸

postmaster@charmides.phl.univie.ac.at   local:$myhostname
postmaster@lists.girlsrock.at       local:$myhostname

charmides.phl.univie.ac.at  mailman:
lists.girlsrock.at      mailman:

還:

root@menon:/etc/postfix# ls -l transport*
-rw-r--r-- 1 root root   171 11. Apr 11:19 transport
-rw-r--r-- 1 root root 12288 11. Apr 11:30 transport.db

DNS 回复

charmides.phl.univie.ac.at

root@menon:/etc/postfix# dig mx charmides.phl.univie.ac.at

; <<>> DiG 9.7.3 <<>> mx charmides.phl.univie.ac.at
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46201
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;charmides.phl.univie.ac.at.    IN  MX

;; ANSWER SECTION:
charmides.phl.univie.ac.at. 68400 IN    CNAME   menon.phl.univie.ac.at.

;; AUTHORITY SECTION:
phl.univie.ac.at.   68400   IN  SOA ns3.univie.ac.at. domain-admin.univie.ac.at. 2013041001 3600 600 604800 86400

;; Query time: 44 msec
;; SERVER: 131.130.1.11#53(131.130.1.11)
;; WHEN: Thu Apr 11 12:24:06 2013
;; MSG SIZE  rcvd: 117

lists.girlsrock.at

root@menon:/etc/postfix# dig mx lists.girlsrock.at

; <<>> DiG 9.7.3 <<>> mx lists.girlsrock.at
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37529
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;lists.girlsrock.at.        IN  MX

;; AUTHORITY SECTION:
girlsrock.at.       7070    IN  SOA ns1.issp.at. domains.issp.at. 2013033001 10800 3600 604800 38400

;; Query time: 0 msec
;; SERVER: 131.130.1.11#53(131.130.1.11)
;; WHEN: Thu Apr 11 12:24:55 2013
;; MSG SIZE  rcvd: 89

到目前為止,他們的 DNS 回复的區別是我能弄清的唯一區別。不過,我不確定它為什麼重要。我為lists.girlsrock.at添加了 MX 記錄,但更改尚未傳播到我的伺服器。

日誌

不包含任何與發送/拒絕的消息有關的內容。

系統

我正在使用帶有 Linux 2.6.32-5-xen-amd64 的 Debian/GNU Linux Wheezy/Sid。後綴版本是 2.7.1。

幫助!

我束手無策,非常感謝您的幫助!有人知道出了什麼問題嗎?

我的設置在lists.girlsrock.at中缺少對postmaster地址的定義。我隱含地假設 /etc/postfix/transport 中的定義就足夠了,當然,事實並非如此。如果沒有 postmaster,Postfix拒絕辨識域。不過,讓我感到困惑的是,Postfix如何設法將通過 sendmail API 注入的消息傳遞到 postmaster@lists.girlsrock.at

引用自:https://serverfault.com/questions/498343