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

Admin / password reset fails

Open fsantiago07044 opened this issue 7 years ago • 13 comments

I configured my SMTP settings in mailman web and created the default admin account. When I tried resetting my email, it errors out:

SMTPRecipientsRefused at /accounts/password/reset/ {u'': (504, '5.5.2 : Helo command rejected: need fully-qualified hostname')} Request Method: POST Request URL: http://lists.garbage-juice.com/accounts/password/reset/ Django Version: 1.10 Exception Type: SMTPRecipientsRefused Exception Value: {u'': (504, '5.5.2 : Helo command rejected: need fully-qualified hostname')} Exception Location: /usr/local/lib/python2.7/smtplib.py in sendmail, line 747 Python Executable: /usr/local/bin/uwsgi Python Version: 2.7.13 Python Path: ['/usr/local/lib/python2.7/site-packages/django_q', '.', '', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages'] Server time: Mon, 23 Oct 2017 23:07:26 +0000

Any ideas?

fsantiago07044 avatar Oct 23 '17 23:10 fsantiago07044

It looks like the email address for your admin account is not a valid email, can you check that?

Other than that, I can't see any thing else that would cause this error.

maxking avatar Oct 23 '17 23:10 maxking

On October 23, 2017 7:28:21 PM EDT, Abhilash Raj [email protected] wrote:

It looks like the email address for your admin account is not a valid email, can you check that?

Other than that, I can't see any thing else that would cause this error.

Definitely valid.

When I defined mailman_admin_email, I didn't use any quotes. Is correct?

I also defined it for the variable under settings.py admin email. Correct thing to do?

--

Thanks,

Fabian S.

OpenPGP: 3C3FA072ACCB7AC5DB0F723455502B0EEB9070FC

fsantiago07044 avatar Oct 23 '17 23:10 fsantiago07044

A quick google search gave me this:

https://unix.stackexchange.com/a/91753

Can you check if that is indeed the problem?

maxking avatar Oct 23 '17 23:10 maxking

Just as an FYI, I am just guessing what could be the problem, I never seen it before.

maxking avatar Oct 23 '17 23:10 maxking

On October 23, 2017 7:41:50 PM EDT, Abhilash Raj [email protected] wrote:

Just as an FYI, I am just guessing what could be the problem, I never seen it before.

My email server is already appropriately set. Still errors out.

Thanks,

Fabian S.

OpenPGP: 3C3FA072ACCB7AC5DB0F723455502B0EEB9070FC

fsantiago07044 avatar Oct 24 '17 00:10 fsantiago07044

On October 23, 2017 7:41:50 PM EDT, Abhilash Raj [email protected] wrote:

Just as an FYI, I am just guessing what could be the problem, I never seen it before.

So I figured out the hostname business.

Now I'm stuck on this:

SMTPRecipientsRefused at /accounts/password/reset/

{u'': (450, '4.1.8 [email protected]: Sender address rejected: Domain not found')}Request Method:POSTRequest URL:http://lists.garbage-juice.com/accounts/password/reset/Django Version:1.10Exception Type:SMTPRecipientsRefusedException Value:{u'': (450, '4.1.8 [email protected]: Sender address rejected: Domain not found')}Exception Location:/usr/local/lib/python2.7/smtplib.py in sendmail, line 747Python Executable:/usr/local/bin/uwsgiPython Version:2.7.13Python Path:['/usr/local/lib/python2.7/site-packages/django_q', '.', '', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']Server time:Tue, 24 Oct 2017 00:57:04 +0000

My issue seems to be I'm having trouble deciphering what needs to be configured and what to leave alone. Not sure what I've missed this time.

Thanks,

Fabian S.

OpenPGP: 3C3FA072ACCB7AC5DB0F723455502B0EEB9070FC

fsantiago07044 avatar Oct 24 '17 01:10 fsantiago07044

Can you tell me what was wrong the first time so that I can help others if they face a similar problem? Thanks!

The default address to send emails from is defined by DEFAULT_FROM_EMAIL variable in settings_local.py in the configuration of mailman-web. Alternatively, you can set SERVE_FROM_DOMAIN environment variable and the sender address will be set to postorius@$(SERVE_FROM_DOMAIN) address.

https://github.com/maxking/docker-mailman/blob/master/web/mailman-web/settings.py#L221 ^ This is where this setting is defined.

maxking avatar Oct 24 '17 01:10 maxking

On October 23, 2017 9:18:11 PM EDT, Abhilash Raj [email protected] wrote:

Can you tell me what was wrong the first time so that I can help others if they face a similar problem? Thanks!

The default address to send emails from is defined by DEFAULT_FROM_EMAIL variable in settings_local.py in the configuration of mailman-web. Alternatively, you can set SERVE_FROM_DOMAIN environment variable and the sender address will be set to postorius@$(SERVE_FROM_DOMAIN) address.

https://github.com/maxking/docker-mailman/blob/master/web/mailman-web/settings.py#L221 ^ This is where this setting is defined.

It was not setting my hostname from mailman-web.

My issue seems to be here somewhere:

Use SERVE_FROM_DOMAIN as the default domain in the email.

hostname = os.environ.get('SERVE_FROM_DOMAIN', 'localhost.local')

DEFAULT_FROM_EMAIL = 'postorius@{}'.format(hostname)

SERVER_EMAIL = 'root@{}'.format(hostname)

Change this when you have a real email backend

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

EMAIL_HOST = os.environ.get('SMTP_HOST', '172.19.199.1')

EMAIL_PORT = os.environ.get('SMTP_PORT', 25)

EMAIL_HOST_USER = ''

EMAIL_HOST_PASSWORD = ''

EMAIL_USE_TLS = False

Assuming I'm using a custom address and it's the same for both addresses their, can you give me an example?

Thanks,

Fabian S.

OpenPGP: 3C3FA072ACCB7AC5DB0F723455502B0EEB9070FC

fsantiago07044 avatar Oct 24 '17 01:10 fsantiago07044

EMAIL_BACKEND and related settings don't have anything to do with the sender address, they define how mailman-web connects to your SMTP relay service (Postfix or such).

The emails generated by mailman-web are set to sender address specified by the setting DEFAULT_FROM_EMAIL. By default, if no SERVE_FROM_DOMAIN environment variable is defined, its value is [email protected] which is causing your error.

You can do two things to fix this:

  • Set SERVE_FROM_DOMAIN environment variable, this will change the sender address to postorius@SERVE_FROM_DOMAIN [1]

  • Set DEFAULT_FROM_EMAIL setting in settings_local.py and that will override whatever is the default value. [2]

[1]: Add a new entry here.

[2]: settings_local.py is the external configuration file for mailman-web container, it should be present at /opt/mailman/web/settings_local.py on your host and the container will pick it up.

maxking avatar Oct 24 '17 01:10 maxking

October 23, 2017 9:56 PM, "Abhilash Raj" [email protected] wrote:

EMAIL_BACKEND and related settings don't have anything to do with the sender address, they define how mailman-web connects to your SMTP relay service (Postfix or such).

The emails generated by mailman-web are set to sender address specified by the setting DEFAULT_FROM_EMAIL. By default, if no SERVE_FROM_DOMAIN environment variable is defined, its value is [email protected] which is causing your error.

You can do two things to fix this:

  • Set SERVE_FROM_DOMAIN environment variable, this will change the sender address to postorius@SERVE_FROM_DOMAIN [1]

  • Set DEFAULT_FROM_EMAIL setting in settings_local.py and that will override whatever is the default value. [2]

[1]: Add a new entry here.

[2]: settings_local.py is the external configuration file for mailman-web container, it should be present at /opt/mailman/web/settings_local.py on your host and the container will pick it up.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ok,

this is where I'm at now:

SMTPRecipientsRefused at /accounts/password/reset/ {u'': (554, '5.7.1 : Recipient address rejected: SMTP AUTH is required, or it is a spam with forged sender domain')}

see my config files on pastebin (sanitized of course):

docker-compose.yaml: https://pastebin.com/VbnGrdB4

web/mailman-web/settings.py: https://pastebin.com/kG0f896D

my apache https config: https://pastebin.com/pQdd46h7

thanks. I've been going back and forth trying different combinations, but with no luck. I guess my issue is I don't have a good read on the MM3 configurations and what all needs to be adjusted, left alone, created from scratch, etc...

thanks for any help you can offer.

--

Thanks,

Fabian S.

OpenPGP: 3C3FA072ACCB7AC5DB0F723455502B0EEB9070FC

fsantiago07044 avatar Oct 24 '17 12:10 fsantiago07044

i got it. i had to properly configure my email server to allow relaying by the postorius user and the docker network. now, in web/../settings.py, what are those email MTA server settings meant for? when do they come into play?

fsantiago07044 avatar Oct 25 '17 14:10 fsantiago07044

You need to configure emails at two places right now, once for Core and another time for Django(mailman-web).

Django usually sends out account confirmation emails and other error tracebacks if you have it configured that way. Core handles the actual emails in the Mailing list.

maxking avatar Oct 25 '17 20:10 maxking

but the other day when i started down this road i had MTA settings configured there and it was still sending the confirmation email out as a relay through my smtp port 25. shouldn't it have then used my provided mta values?

fsantiago07044 avatar Oct 25 '17 20:10 fsantiago07044

This issue has not been updated for more than 1year

github-actions[bot] avatar Nov 14 '22 22:11 github-actions[bot]