Email

GNU Mailman3 + Postfix:550 5.1.1 <root@localhost>:收件人地址被拒絕:本地收件人表中的使用者未知

  • March 2, 2022

我只是想用 Postfix+Nginx+Postgres 執行 GNU Mailman3。這是最新的 GNU/Linux Debian 穩定版,所以我剛剛apt-get安裝mailman3-full並對配置文件進行了一些標準更改。Nginx 部分很好,SSL 工作正常,我可以從我的網路瀏覽器訪問 Postorius 和 Hyperkitty。但是當嘗試以管理員身份登錄時,我收到以下錯誤:

ERROR 2022-02-25 21:39:55,302 118475 django.request Internal Server Error: /accounts/login/
Traceback (most recent call last):
 File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 34, in inner
   response = get_response(request)
 File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 115, in _get_response
   response = self.process_exception_by_middleware(e, request)
 File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 113, in _get_response
   response = wrapped_callback(request, *callback_args, **callback_kwargs)
 File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 71, in view
   return self.dispatch(request, *args, **kwargs)
 File "/usr/lib/python3/dist-packages/django/utils/decorators.py", line 45, in _wrapper
   return bound_method(*args, **kwargs)
 File "/usr/lib/python3/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
   return view(request, *args, **kwargs)
 File "/usr/lib/python3/dist-packages/allauth/account/views.py", line 146, in dispatch
   return super(LoginView, self).dispatch(request, *args, **kwargs)
 File "/usr/lib/python3/dist-packages/allauth/account/views.py", line 74, in dispatch
   response = super(RedirectAuthenticatedUserMixin, self).dispatch(
 File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 97, in dispatch
   return handler(request, *args, **kwargs)
 File "/usr/lib/python3/dist-packages/allauth/account/views.py", line 102, in post
   response = self.form_valid(form)
 File "/usr/lib/python3/dist-packages/allauth/account/views.py", line 159, in form_valid
   return form.login(self.request, redirect_url=success_url)
 File "/usr/lib/python3/dist-packages/allauth/account/forms.py", line 195, in login
   ret = perform_login(
 File "/usr/lib/python3/dist-packages/allauth/account/utils.py", line 175, in perform_login
   send_email_confirmation(request, user, signup=signup, email=email)
 File "/usr/lib/python3/dist-packages/allauth/account/utils.py", line 346, in send_email_confirmation
   email_address.send_confirmation(request, signup=signup)
 File "/usr/lib/python3/dist-packages/allauth/account/models.py", line 62, in send_confirmation
   confirmation.send(request, signup=signup)
 File "/usr/lib/python3/dist-packages/allauth/account/models.py", line 169, in send
   get_adapter(request).send_confirmation_mail(request, self, signup)
 File "/usr/lib/python3/dist-packages/allauth/account/adapter.py", line 464, in send_confirmation_mail
   self.send_mail(email_template, emailconfirmation.email_address.email, ctx)
 File "/usr/lib/python3/dist-packages/allauth/account/adapter.py", line 136, in send_mail
   msg.send()
 File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 306, in send
   return self.get_connection(fail_silently).send_messages([self])
 File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 110, in send_messages
   sent = self._send(message)
 File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 126, in _send
   self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
 File "/usr/lib/python3.9/smtplib.py", line 885, in sendmail
   raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'root@localhost': (550, b'5.1.1 &lt;root@localhost&gt;: Recipient address rejected: User unknown in local recipient table')}
[pid: 118475|app: 0|req: 35/35] 2001:xxxx:xxxx:xxxx:xxxx:xxxx () {62 vars in 1133 bytes} [Fri Feb 25 21:39:55 2022] POST /accounts/login/ =&gt; generated 1156 bytes in 173 msecs (HTTP/1.1 500) 5 headers in 182 bytes (1 switches on core 1)

在 Postfix 日誌文件中:

Feb 25 21:39:55 vps-xxx postfix/smtpd[122820]: connect from localhost[::1]
Feb 25 21:39:55 vps-xxx postfix/smtpd[122820]: NOQUEUE: reject: RCPT from localhost[::1]: 550 5.1.1 &lt;root@localhost&gt;: Recipient address rejected: User unknown in local recipient table; from=&lt;root@MYDOMAIN&gt; to=&lt;root@localhost&gt; proto=ESMTP helo=&lt;vps-xxx&gt;
Feb 25 21:39:55 vps-xxx postfix/smtpd[122820]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=0/1 rset=1 quit=1 commands=4/5

我想:也許我的本地收件人表不知何故壞了?但我可以使用以下方式發送郵件mail

$ mail -r 'root@localhost' -s 'just a test' 'root@localhost'

它工作得很好:

Feb 25 21:44:12 vps-xxx postfix/pickup[124104]: 9ABB540516: uid=1000 from=&lt;root@localhost&gt;
Feb 25 21:44:12 vps-xxx postfix/cleanup[124763]: 9ABB540516: message-id=&lt;20220225214412.9ABB540516@MYDOMAIN&gt;
Feb 25 21:44:12 vps-xxx opendkim[14611]: 9ABB540516: no signing table match for 'root@localhost'
Feb 25 21:44:12 vps-xxx opendkim[14611]: 9ABB540516: no signature data
Feb 25 21:44:12 vps-xxx postfix/qmgr[118558]: 9ABB540516: from=&lt;root@localhost&gt;, size=412, nrcpt=1 (queue active)
Feb 25 21:44:12 vps-xxx postfix/local[124765]: 9ABB540516: to=&lt;root@localhost&gt;, relay=local, delay=0.04, delays=0.03/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Feb 25 21:44:12 vps-xxx postfix/qmgr[118558]: 9ABB540516: removed

root確實可以在 ’s Maildir 中看到它。

有任何想法嗎?

如果我沒記錯root@localhost的話,是我admindpkg-reconfigure. 我以前從未使用過 GNU Mailman3,但我猜這封電子郵件一定是登錄通知或類似的東西(您也可以通過send_email_confirmation函式名稱猜測它)。如果我輸入了錯誤的密碼,一切都很好(我只是在 Web UI 中得到一個很好的錯誤),所以只有當密碼正確時才會發生這種情況。

謝謝!

問題是在GNU Mailman 文件中它說:

要配置 Postfix,請將以下配置添加到 main.cf:

# 支持預設的VERP分隔符。
收件人分隔符 = +
unknown_local_recipient_reject_code = 550
owner_request_special = 否
運輸地圖 =
雜湊:/path-to-mailman/var/data/postfix_lmtp
local_recipient_maps =
雜湊:/path-to-mailman/var/data/postfix_lmtp
中繼域=
hash:/path-to-mailman/var/data/postfix_domains

這就是我所做的。但是,我沒有意識到的是,此配置有效地禁用了/etc/aliases文件,甚至禁用了本地傳送到rootor root@localhost。修復者:

local_recipient_maps =
代理:unix:passwd.byname $alias_maps 雜湊:/var/lib/mailman3/data/postfix_lmtp

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