docker-mailman icon indicating copy to clipboard operation
docker-mailman copied to clipboard

jango.request Internal Server Error: /accounts/password/reset/

Open beardedfool opened this issue 4 years ago • 1 comments

Tag/version of Container Images 0.4.1

Maybe because I'm running it in a proxmox container (will try a full VM) but just in case it's something obvious please?

On initial install, when first trying to rest the password I get the following error in mailmanweb.log

ERROR 2021-10-08 01:18:35,478 1753 django.request Internal Server Error: /accounts/password/reset/
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/allauth/account/views.py", line 102, in post
    response = self.form_valid(form)
  File "/usr/lib/python3.8/site-packages/allauth/account/views.py", line 690, in form_valid
    form.save(self.request)
  File "/usr/lib/python3.8/site-packages/allauth/account/forms.py", line 561, in save
    get_adapter(request).send_mail(
  File "/usr/lib/python3.8/site-packages/allauth/account/adapter.py", line 136, in send_mail
    msg.send()
  File "/usr/lib/python3.8/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
  File "/usr/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 62, in open
    self.connection = self.connection_class(self.host, self.port, **connection_params)
  File "/usr/lib/python3.8/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.8/smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.8/smtplib.py", line 310, in _get_socket
    return socket.create_connection((host, port), timeout,
  File "/usr/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Other, non admin passwords don't create the error and correctly say they've failed

docker-componse

version: '2'

services:
  mailman-core:
    image: maxking/mailman-core:0.4
    container_name: mailman-core
    hostname: mailman-core
    volumes:
    - /opt/mailman/core:/opt/mailman/
    stop_grace_period: 30s
    links:
    - database:database
    depends_on:
    - database
    environment:
    - MTA=postfix
    - DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
    - DATABASE_TYPE=postgres
    - DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
    - HYPERKITTY_API_KEY=XXXXXXXXXXXXXX
    ports:
    - "127.0.0.1:8001:8001" # API
    - "127.0.0.1:8024:8024" # LMTP - incoming emails
    networks:
      mailman:

  mailman-web:
    image: maxking/mailman-web:0.4
    container_name: mailman-web
    hostname: mailman-web
    depends_on:
    - database
    links:
    - mailman-core:mailman-core
    - database:database
    volumes:
    - /opt/mailman/web:/opt/mailman-web-data
    environment:
    - DATABASE_TYPE=postgres
    - DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
    - HYPERKITTY_API_KEY=XXXXXXXXXXXXXX
    - SECRET_KEY=XXXXXXXXXXXXXX
    - MAILMAN_ADMIN_USER=admin
    - SERVE_FROM_DOMAIN=mm.<correct domain name>
    - MAILMAN_ADMIN_EMAIL=<correct email address>
    ports:
    - "127.0.0.1:8000:8000" # HTTP
    - "127.0.0.1:8080:8080" # uwsgi
    networks:
      mailman:

  database:
    environment:
    - POSTGRES_DB=mailmandb
    - POSTGRES_USER=mailman
    - POSTGRES_PASSWORD=mailmanpass
    image: postgres:9.6-alpine
    volumes:
    - /opt/mailman/database:/var/lib/postgresql/data
    networks:
      mailman:

networks:
  mailman:
    driver: bridge
    ipam:
      driver: default
      config:
      -
        subnet: 172.19.199.0/24`

postfix main.cf - using relay but tested as working on host

myhostname = mm.<correct domain name>
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, mailman.rml, rmlmailman.rml, localhost.rml, localhost
relayhost = [mail.gandi.net]:587
# enable SASL authentication
smtp_sasl_auth_enable = yes
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# disallow methods that allow anonymous authentication
#smtp_sasl_security_options = noanonymous
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_CApath = /etc/ssl/certs
# Enable STARTTLS encryption
smtp_use_tls = yes
mynetworks = 127.0.0.0/8, 172.19.199.0/24, 172.19.199.2/24, 172.19.199.3/24, 172.19.199.4/24, mailman-web, mailman-core
inet_interfaces = loopback-only
recipient_delimiter = +
fallback_transport = relay
#limit the relay
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myorigin = /etc/mailname
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
inet_protocols = ipv4
home_mailbox = Maildir/
compatibility_level = 2


# mailman3 settings
# Support the default VERP delimiter.
#recipient_delimiter = +
#unknown_local_recipient_reject_code = 550
#owner_request_special = no

transport_maps =
    regexp:/opt/mailman/core/var/data/postfix_lmtp
local_recipient_maps =
    regexp:/opt/mailman/core/var/data/postfix_lmtp
relay_domains =
    regexp:/opt/mailman/core/var/data/postfix_domains

but perhpas /opt/mailman/core/var/data/postfix_domains should have something in it?

or can I test the connection to the postfix through an exec command?

beardedfool avatar Oct 08 '21 01:10 beardedfool

I have the same error. I assume the problem is in my postfix configuration, because I am trying to channel all mail through a dedicated mailserver machine.

My mailserver is mail.assembled.app, and I am running docker-mailman on relay.assembled.app. Here is my /etc/postfix/main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

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

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = relay.assembled.app
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = relay.assembled.app, $myhostname, localhost, localhost.localdomain, localhost
relayhost = mail.assembled.app
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
inet_interfaces = loopback-only
inet_protocols = all

recipient_delimiter = +
unknown_local_recipient_reject_code = 550
owner_request_special = no

transport_maps =
    regexp:/opt/mailman/core/var/data/postfix_lmtp
local_recipient_maps =
    regexp:/opt/mailman/core/var/data/postfix_lmtp
relay_domains =
    regexp:/opt/mailman/core/var/data/postfix_domains

Thinking there was a problem with the mailserver, I changed my postfix configuration to send over SendGrid, based on https://www.linode.com/docs/guides/postfix-smtp-debian7/#postfix-configuration-with-mandrill-and-sendgrid

No luck.

As @beardedfool said, a bash command that sends an email based on a postfix configuration can help us decide if the error is in the configuration or someplace else in the mailman-core process.

Please lend a hand! G

c4lliope avatar Dec 17 '21 14:12 c4lliope

This issue has not been updated for more than 1year

github-actions[bot] avatar Dec 17 '22 22:12 github-actions[bot]

Just tried all this again and ran into the same problem, in case anyone can give a hand

beardedfool avatar May 03 '23 19:05 beardedfool