mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-07 12:34:03 -05:00
[GH-ISSUE #1037] SMTP stopped working after Docker tag 2020626 #9545
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RainmakerRaw on GitHub (Jun 26, 2020).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1037
Subject of the issue
I run Synology Docker with bitwardenrs. My SMTP provider is iCloud, and the settings work fine (emails are successfully delivered, testing in the Admin page works). As soon as I upgrade the container from 2020626 to latest, emails no longer deliver. There are 'smtp error', 400 errors, and complaints about a self-signed certificate in the chain. If I revert back to 2020626 (same Docker config file, same settings, same data dir etc) things work fine again and I can send mail perfectly.
Your environment
Steps to reproduce
The container is launched with the following SMTP settings for iCloud (which work in 2020626):
Host: smtp.mail.me.com
Enable SSL: true
Explicit TLS: false
Port: 587
From address: My iCloud email address
From name: Bitwarden_RS
Username: My iCloud email address
Password: My secret password
Json form auth mechanism: (blank)
SMTP connection timeout: 15
Expected behaviour
A test email delivered to my own address should be sent and deliver successfully.
Actual behaviour
SMTP error.
The logs include 400 errors, and a complaint that there's a self-signed cert in the chain (this is Apple, and it doesn't complain on the older version. Other apps send mail just fine also).
As I said above, moving back to 2020626 resolves the issue immediately.
Relevant logs
Log file attached (HTML saved as PDF).
bitwardenrs-latest-log.pdf
@jjlin commented on GitHub (Jun 26, 2020):
It would help if you specified exact before/after versions, like 1.15.1-b34d5482. I assume 2020626 refers to something Synology-specific, but most people here are not Synology users and have no idea what that means. Also, it's hard to read logs that are in reverse order.
@RainmakerRaw commented on GitHub (Jun 26, 2020):
Apologies, I thought the tag on the Docker build was Docker-specific not Synology specific. The builds are as follows:
Working SMTP
1.14.2-08077833
Broken SMTP (latest available build on hub.docker.com)
1.15.1-b34d5482
I don't quite know what happened to the log file. It's ouput properly on the Synology's Docker log reader but exports in reverse. I've issued a
sudo docker logs bitwardenrs > ~/latest.txtand attached that below. This should be in the correct reading order, and is simply a snippet showing what outputs to stdout when trying to send a test email from the Admin panel.latest.txt
@BobWs commented on GitHub (Jun 26, 2020):
Have you tried another smtp e.g. google or something else?
@RainmakerRaw commented on GitHub (Jun 26, 2020):
No sir, not yet. The iCloud is the only mail account I have (aside from Proton Mail which is my main account, and doesn't allow using it this way). Since iCloud works in the (slightly) older version but not the newer one, it seems to be an issue with bitwardenrs rather than iCloud's SMTP? Since people are still using the latest bitwardenrs with eg Outlook/Live or GMail, clearly that would be a potential workaround.
However, I'd prefer to address the underlying issue if possible, and keep using my normal email account. I de-Googled myself purposefully so I'd rather not go back just becasue of a bug somewhere. :)
@RainmakerRaw commented on GitHub (Jun 26, 2020):
Some further info, perhaps? I made a completely new container, and (differently this time) also renamed the
config.jsonto start truly from the beginning. I span up the container:and tried to send a test email from the Admin page. Regardless of how I set the SMTP (including copying verbatim the settings that work on the previous 1.4.x version of bitwardenrs) I now get a slightly different error:
In case it was relevant, I also tried varying the smtp_auth_mechanism from blank to Plain to Login with no change in results. FWIW Apple says they support SSL, TLS and STARTTLS. As I said this works out of the box on the older 1.4.x release listed in my earlier reply.
I hope this is perhaps of some help in pinpointing any issue. For reference the test address I was sending to was the same as always -
myname@icloud.com. After seeing theAddressErrorI also tried other addresses likemyname@protonmail.comand got the same error.@RainmakerRaw commented on GitHub (Jun 26, 2020):
I made an outlook.com account with MS just for this purpose, and it sent an email successfully first time. I give up. Hopefully if there's an underlying issue with bwrs here (breaking between versions with no external factors) then this report helps you fix it for others. I've spent hours on this so I'm just happy I have a working solution. Many thanks for your time and attention, I'm happy to troubleshoot further if someone wishes to investigate this further.
@jjlin commented on GitHub (Jun 28, 2020):
There were quite a few SMTP-related changes between 1.14.2 and 1.15.0 (mostly from updating a library dependency), and I suspect this introduced some regressions with various SMTP servers. Unfortunately, this is an area that's hard to test given the lack of access to all these random SMTP servers.
@nicedevil007 commented on GitHub (Jul 14, 2020):
@RainmakerRaw so I got same error on a fresh new deployed BitwardenRS on my friends RaspberryPi.
I set it up like I did on my own environment with GMAIL. I tryed this with my own credentials that work like a charm on my environment.
So if I understand you right... you just made a new account on blablabla@outlook.com and then it worked? weird...,
@anoxi commented on GitHub (Aug 31, 2020):
I can confirm the SMTP errors on server 1.16.3, excerpt from log:
Im connecting to my mail provider via SSL, Port 465. The same mail configuration is working on another app container.
@nickbp commented on GitHub (Sep 17, 2020):
I am also seeing
WouldBlockSMTP errors on the arm64 docker image ofbitwardenrs/server:1.16.3. This is with Fastmail as the SMTP provider, using the settings provided here: https://www.fastmail.com/help/technical/servernamesandports.htmlI've tried:
Use explicit TLSdue to the note in the Fastmail docs around STARTTLS.In all cases, I see the same
WouldBlockerror. I've seen it both when testing a user signup, as well as when in theSMTP Settingsinterface in the admin panel. In both cases, bitwardenrs pauses for the duration of the default 15s timeout, and then displays the following error in its logs:I've tried setting
LOG_LEVEL=TRACEand didn't see anything that provided more detail.Given the symptoms, it looks like bitwardenrs is failing to open the connection at all.
@nickbp commented on GitHub (Sep 17, 2020):
I tried looking at this again this morning, and it turns out that I wasn't testing port 587 at all when trying things out via the admin panel, because I was just editing the SMTP fields in place and then trying to send a test email. Instead I should have SAVED the config by scrolling to the bottom of the admin panel, THEN going back into the SMTP section and sending a test email.
Once I had configured SMTP to use port 587 (and made sure that I was actually saving the config), the test email went through fine.
For reference, here's a full listing of the SMTP settings that I used to successfully send a test email via Fastmail SMTP:
truesmtp.fastmail.comtruefalse(setting this to true fails with SSL "wrong version number" error)587(setting this to 465 fails with aforementioned WouldBlock error)<anything>Bitwarden_RS(default)<username>@fastmail.com<fastmail-app-password-with-smtp-access><blank>(default)15(default)<blank>(default)Summary: It looks like the
WouldBlockerror indicates an issue with setting up the SSL handshake, and it may be possible by trying an alternate port? But don't forget to explicitly save the config before sending the test email!@BlackDex commented on GitHub (Sep 22, 2020):
@RainmakerRaw
I'm glad it is all working now :).
What i think happened is that when looking at your env variables you posted on the 26th of July is this
-e SMTP_FROM=Bitwarden_RS \.That variable should contain an email address instead of just a name. For that you need
SMTP_FROM_NAME. The error message indicates missing parts of the mail address.The second error seems to be a connectivity issue to the server, either the hostname or port or both were incorrect and would cause this error.
@tschoesi commented on GitHub (Oct 12, 2020):
This! I somehow expected the test email to go through whichever server is currently displayed... Didn't think to save and wondered why it wasn't working...
@BlackDex commented on GitHub (Oct 12, 2020):
That is a bit confusing indeed. Lets see if we can make that more clear or at least warn that you have to save first :).
So, it is working now then right?
@tschoesi commented on GitHub (Oct 12, 2020):
I didn't open this issue, I just came here looking because my "new configuration" didn't seem to work after switching email providers...
But yes, for me it's working fine now! just had to hit save first