Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
maxxer opened this issue Dec 1, 2021 · 3 comments
Closed

Comments

@maxxer
Copy link
Contributor

maxxer commented Dec 1, 2021

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.

@timabbott timabbott transferred this issue from zulip/zulip Dec 1, 2021
@timabbott
Copy link
Member

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

@timabbott
Copy link
Member

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

@timabbott
Copy link
Member

I'm pretty sure this is a case of Docker environment variable escaping discussed in #238. Closing as a duplicate, since the fix is likely to teach better how the docker-compose.yml format works.

@timabbott timabbott closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants