mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-11 09:13:02 +03:00
Global Env parameter for SMTP #2002
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 @mikebakke on GitHub.
First a HUGE thank you for this capability - it is simply amazing.
My question (after checking wiki) is how to add a specific environment variable - globalSettings__mail__smtp__trustServer=true
to the SMTP configuration.
Prior to using your container I had installed from the 8bit site onto a Virtualbox VM. Initially configuring email to send via my Gmail didn't work but I found this parameter which I added to the global common file in /env and all was fine.
I've configure SMTP in the admin panel here but nothing is sent and I can't see how to add either via admin or at the command line. Is it possible?
Best Regards
Mike Bakke
@Ayitaka commented on GitHub:
Hmmm thats frustrasting! Well, if you wanna try to diagnose the issue you can try these steps and maybe we can figure out whats wrong:
docker ps -a- copy the CONTAINER ID for bitrwarden_rs from the results of this (i.e. b95c6ce69ef6 )docker exec -it b95c6ce69ef6 bash- using the CONTAINER ID to start a bash shell inside the containeropenssl s_client -connect smtp.gmail.com:587 -starttls smtp- to see the results of a TLS connection to smtp.gmail.com@Ayitaka commented on GitHub:
bitwarden_rs does not have a way to ignore certificate validation when using TLS for smtp, as far as I can tell.
what smtp_host and smtp_port are you using for gmail?
for TLS...
usual smtp host is: smtp.gmail.com (or smtp-relay.gmail.com for G Suite SMTP relay)
and port is: 587
@mikebakke commented on GitHub:
Hi - output here - looks reasonable?
root@c449ef3c2d6f:/# openssl s_client -connect smtp.gmail.com:587 -starttls smtp
CONNECTED(00000003)
depth=2 OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
verify return:1
depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = smtp.gmail.com
verify return:1
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=smtp.gmail.com
i:/C=US/O=Google Trust Services/CN=GTS CA 1O1
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raS5nb29n
L2d0czFvMTArBggrBgEFBQcwAoYfaHR0cDovL3BraS5nb29nL2dzcjIvR1RTMU8x
LmNydDAZBgNVHREEEjAQgg5zbXRwLmdtYWlsLmNvbTAhBgNVHSAEGjAYMAgGBmeB
DAECAjAMBgorBgEEAdZ5AgUDMC8GA1UdHwQoMCYwJKAioCCGHmh0dHA6Ly9jcmwu
cGtpLmdvb2cvR1RTMU8xLmNybDCCAQUGCisGAQQB1nkCBAIEgfYEgfMA8QB3AGPy
283oO8wszwtyhCdXazOkjWF3j711pjixx2hUS9iNAAABbL48nbwAAAQDAEgwRgIh
APtyANJl2kBkWjE/34ksZlmt4dVnsIvWGZtY6dRc94J+AiEAryVS2ywIu4Waq4E+
xnyEVTRTk66TmXKNG98Ik8xSqKAAdgB0ftqDMa0zEJEhnM4lT0Jwwr/9XkIgCMY3
NXnmEHvMVgAAAWy+PJ35AAAEAwBHMEUCIGeJmcrMxBZl7VFmDEj1FW2vpBNUYimL
Q7ezu5y5Z4z7AiEAkJi2XmC+u2qYndbiphKum9fB17sYySOprNzPRpBMtOMwDQYJ
KoZIhvcNAQELBQADggEBAJURiBdNhPCSHyXLyRRXFLg+LM+w5rX2UAG2QGkKebbd
EwNhJWLVo6D/NclwlS3ZJiLP0gd1y+u9ftv6NGiny+E57cwZJI2UtLSpE9FJzEyf
bjbKdS+6oFidD/wd1L92cUkpo3BVd4m65iivoeCkWb3vIl/clnCM6e7q7wMQE+D/
VWVqVo33uMqLO//nndSqq3oVMdfk5lvud8AGrQZFT/5DGx//wjIV7H448fFf7/z4
8Z6a5ojnFkL2+Lw2aliBP336GwQykpcnaWg1KSVazJYFyhzeWJlhhdXocI3EQP68
8ps5TR3B5kV9S7/JSzuticHQiCMmO6ND4Vt8WfUWN2M=
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google LLC/CN=smtp.gmail.com
issuer=/C=US/O=Google Trust Services/CN=GTS CA 1O1
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: X25519, 253 bits
SSL handshake has read 3453 bytes and written 294 bytes
Verification: OK
New, TLSv1.2, Cipher is ECDHE-RSA-CHACHA20-POLY1305
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-CHACHA20-POLY1305
Session-ID: 51EC553C55EC90A72FCB95D77EA308AAA4776CEA5BA3206D2FE532A29D681A4F
Session-ID-ctx:
Master-Key: 221E26799BA46D76789B2BC21E12A2872CFECC2F0C922E02BB2FE8394A894E039C46F4B8DBA78ADC95316DB758AB21A0
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 100800 (seconds)
TLS session ticket:
0000 - 00 c8 c9 40 cf 99 7e 6c-35 bb 52 12 3a 98 11 f3 ...@..
l5.R.:...@)=..a....0010 - cb 12 22 64 0d cd 5c a2-69 72 99 37 ae a6 d1 3e .."d...ir.7...>
0020 - b2 1b 91 24 8e 27 91 9b-9b 53 b2 e1 40 3c f5 59 ...$.'...S..@<.Y
0030 - ba c3 dc b3 5f 45 84 34-cd ac 91 29 87 b1 c9 f0 ...._E.4...)....
0040 - d0 09 78 e0 b9 a3 7d c2-28 4a 47 1b e6 2d 86 24 ..x...}.(JG..-.$
0050 - 89 97 f4 e6 59 d9 1e f8-d5 58 d5 99 ed aa 66 20 ....Y....X....f
0060 - bf e5 50 26 6e 86 0d e6-fa 0d 2b 54 84 a2 b1 95 ..P&n.....+T....
0070 - 88 e1 bf df 33 be 1f 28-da 2b 9b 02 aa b6 7d 05 ....3..(.+....}.
0080 - f9 99 ae bd 27 77 b6 39-c3 02 e0 40 31 98 b4 6d ....'w.9...@1..m
0090 - c5 fe f8 30 bf 93 e1 8f-8f 6c eb 57 69 a2 63 df ...0.....l.Wi.c.
00a0 - a4 fe 0b 84 88 e0 a6 15-7f 3f dd d5 0c 44 16 c6 .........?...D..
00b0 - 86 e5 54 1c 1f 7e 40 29-3d f7 ae 61 0c 15 a2 f4 ..T..
00c0 - b0 1d a4 d1 a0 da 22 76-54 8d d2 30 a2 7d e7 55 ......"vT..0.}.U
00d0 - b2 1b 7f ea f8 dc 0a 03-b2 c9 ..........
250 SMTPUTF8
@mikebakke commented on GitHub:
Apologies - closed by mistake but re-opened...
@mikebakke commented on GitHub:
Hi
Thanks for the response - yes, the settings you mention are exactly how I've configured in the admin page. This was exactly how I did it in my "official" VM instance on Linux mint and googling for the issue took me to these existing issues - hence my workaround using the parameter. I know it's not ideal but it worked ;-)
https://github.com/bitwarden/server/issues/451
https://github.com/bitwarden/server/issues/457
I did wonder if I could simply use -e=globalSettings__mail__smtp__trustServer=true but from your message it seems not.
My Letsencrypt certificates seem fine accessing online via web and apps so a bit stumped for now.
Thanks
Mike
@mikebakke commented on GitHub:
It's not a deal breaker - I love this tool regardless. I'm sure I'm doing something wrong somewhere and it'll get cleared up. Many thanks your your support.
Regards
Mike
@Ayitaka commented on GitHub:
Hmmmm indeed, it all looks correct on your end. I'm unsure why you're having an issue connecting to gmail, given the results. Perhaps you might want to try to create an account on yahoo or some other provider and see if that works better, at least for your bitwarden installation. :( Wish I had a better answer for you.