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

Unable to configure email account having the % special character in password

Open maxxer opened this issue 3 years ago • 2 comments

Foreword: using docker-zulip, version 4.7.

I'm unable to configure an email account for outgoing mails which have a percent % character in the password. The log always report authentication faluire:

2021-12-01 10:05:18.739 INFO [process_queue] Worker 0 connecting to queue email_senders                                                                    [58/1873]
Traceback (most recent call last):
  File "/home/zulip/deployments/current/manage.py", line 52, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in
execute_from_command_line
    utility.execute()
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in
execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_
from_argv
    self.execute(*args, **cmd_options)
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in exec
ute
    output = self.handle(*args, **options)
  File "/home/zulip/deployments/2021-11-29-11-02-26/zerver/management/commands/process_queue.py", line 82, in handle
    worker = get_worker(queue_name)
  File "/home/zulip/deployments/2021-11-29-11-02-26/zerver/worker/queue_processors.py", line 162, in get_worker                                            [40/1873]
    return worker_classes[queue_name]()
  File "/home/zulip/deployments/2021-11-29-11-02-26/zerver/worker/queue_processors.py", line 640, in __init__
    self.connection: EmailBackend = initialize_connection(None)
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/home/zulip/deployments/2021-11-29-11-02-26/zerver/lib/send_email.py", line 279, in initialize_connection
    if connection.open():
  File "/srv/zulip-venv-cache/15c765f7404b30056169b3f53d3160f98ec1147d/zulip-py3-venv/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 69, in op
en
    self.connection.login(self.username, self.password)
  File "/usr/lib/python3.8/smtplib.py", line 743, in login
    raise last_exception
  File "/usr/lib/python3.8/smtplib.py", line 732, in login
    (code, resp) = self.auth(
  File "/usr/lib/python3.8/smtplib.py", line 655, in auth
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Error: authentication failed: authentication failure')

The password is written correctly into secrets file.

I've no experience with Python, I made some searches and found out that the ConfigParser library needs special management for the % character. What looks to me the most pertinent explanation is this:

Looks like the % character is the problem here. It has special meaning if you are using ConfigParser. If you are not using interpolation, then use just RawConfigParser instead, otherwise you must escape the % by doubling it.

I tried doubling it, enclosing into single quotes, unfortunately without success. From what I could see, the secrets file is always written correctly as declared in docker-compose.yml, so doesn't appear a Docker issue.

Some discussion done here.

maxxer avatar Dec 01 '21 10:12 maxxer

Transferring the issue to docker-zulip, since it seems likely to somehow be docker specific.

timabbott avatar Dec 01 '21 20:12 timabbott

(As noted in the chat.zulip.org thread, we are already using RawConfigParser, so that isn't the problem.)

timabbott avatar Dec 01 '21 20:12 timabbott