0

I am just trying to run GNU Mailman3 with Postfix+Nginx+Postgres. This is the latest GNU/Linux Debian stable so I just apt-get installed mailman3-full and did some standard changes to the config files. The Nginx part is good, SSL works fine, I can access Postorius and Hyperkitty from my web browser. But when trying to login as admin I am getting the following error:

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)

And in the Postfix log file:

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

I thought: perhaps my local recipient table is somehow broken? But I can send mail using mail:

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

and it works just fine:

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

I can see it in root's Maildir indeed.

Any ideas?

If I remember correctly, root@localhost is the e-mail address I assigned to the Postorius' admin user during dpkg-reconfigure. I've never used GNU Mailman3 before, but I guess this e-mail must be login notification or something like that (you can also guess it by the send_email_confirmation function name). If I type in the wrong password, everything is fine (I just get a nice error in the web UI), so this only happens if the password is correct.

Thanks!

stf
  • 123
  • 1
  • 5

1 Answers1

0

The problem was that in the GNU Mailman docs it says:

To configure Postfix, add the following configuration to main.cf:

# Support the default VERP delimiter.
recipient_delimiter = +
unknown_local_recipient_reject_code = 550
owner_request_special = no
transport_maps =
    hash:/path-to-mailman/var/data/postfix_lmtp
local_recipient_maps =
    hash:/path-to-mailman/var/data/postfix_lmtp
relay_domains =
    hash:/path-to-mailman/var/data/postfix_domains

which is what I did. What I didn't realize, though, is that this configuration effectively disables /etc/aliases file, or even local delivery to root or root@localhost. Fixed by:

local_recipient_maps =
    proxy:unix:passwd.byname $alias_maps hash:/var/lib/mailman3/data/postfix_lmtp
stf
  • 123
  • 1
  • 5