GNU Mailman3 + Postfix:550 5.1.1:收件人地址被拒绝:本地收件人表中的用户未知

GNU Mailman3 + Postfix:550 5.1.1:收件人地址被拒绝:本地收件人表中的用户未知

我只是想用 Postfix+Nginx+Postgres 运行 GNU Mailman3。这是最新的 GNU/Linux Debian 稳定版,所以我刚刚apt-get安装mailman3-full并对配置文件做了一些标准更改。Nginx 部分很好,SSL 工作正常,我可以从我的 Web 浏览器访问 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 <root@localhost>: 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/ => 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 <root@localhost>: Recipient address rejected: User unknown in local recipient table; from=<root@MYDOMAIN> to=<root@localhost> proto=ESMTP helo=<vps-xxx>
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=<root@localhost>
Feb 25 21:44:12 vps-xxx postfix/cleanup[124763]: 9ABB540516: message-id=<20220225214412.9ABB540516@MYDOMAIN>
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=<root@localhost>, size=412, nrcpt=1 (queue active)
Feb 25 21:44:12 vps-xxx postfix/local[124765]: 9ABB540516: to=<root@localhost>, 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我确实可以在 的 Maildir中看到它。

有任何想法吗?

如果我记得正确的话,是我在 期间分配给 Postorius 用户root@localhost的电子邮件地址。我以前从未使用过 GNU Mailman3,但我猜这封电子邮件一定是登录通知或类似的东西(您也可以通过函数名称猜出它)。如果我输入了错误的密码,一切都很好(我只是在 Web UI 中收到一个很好的错误),所以这只有在密码正确的情况下才会发生。admindpkg-reconfiguresend_email_confirmation

谢谢!

答案1

问题是GNU Mailman 文档它说:

要配置 Postfix,请将以下配置添加到 main.cf:

# 支持默认VERP分隔符。
收件人分隔符 = +
未知本地收件人拒绝代码 = 550
所有者请求特殊 = 否
运输地图=
    哈希:/路径到 mailman/var/data/postfix_lmtp
本地收件人地图 =
    哈希:/路径到 mailman/var/data/postfix_lmtp
中继域 =
    哈希:/path-to-mailman/var/data/postfix_domains

我就是这么做的。但我没有意识到的是,这种配置实际上禁用了/etc/aliases文件传输,甚至禁用了本地传输到rootroot@localhost。修复者:

本地收件人地图 =
    代理:unix:passwd.byname $alias_maps 哈希:/var/lib/mailman3/data/postfix_lmtp

相关内容