mirror of
https://github.com/lldap/lldap.git
synced 2026-04-25 08:15:52 +03:00
[GH-ISSUE #1151] [BUG] Can't use TLS with SMTP to reset password #412
Labels
No labels
backend
blocked
bug
cleanup
dependencies
docker
documentation
duplicate
enhancement
enhancement
frontend
github_actions
good first issue
help wanted
help wanted
integration
invalid
ldap
pull-request
question
rust
rust
tests
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/lldap-lldap#412
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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 @6C656C65 on GitHub (Apr 7, 2025).
Original GitHub issue: https://github.com/lldap/lldap/issues/1151
Describe the bug
I want to configure email sending with TLS to encrypt requests.
When I try to reset my password, I get this error on the web UI:
To Reproduce
Steps to reproduce the behavior:
Logs
I put the LLDAP log file in debug mode with attachment
Additional context
Even using STARTTLS (
587/tcp) I have the same problem.I have a firewall, which allows
465/tcpand587/tcpflows between LLDAP and the SMTP server.I also have a reverse proxy in front of LLDAP.
I also tried using these variables but nothing changed :
lldap_lops_redacted.txt
@nitnelave commented on GitHub (Apr 9, 2025):
That usually means a mismatch between the protocol (tls/starttls) and the port, but you seem to have them the right way around.
Do you have any other service that can send emails with a similar config, behind the same firewall?
@6C656C65 commented on GitHub (Apr 9, 2025):
I have a Vaultwarden running in another container on the same machine.
The Vaultwarden and the LLDAP use the same address IP to pass through the firewall, so they have the same filtering rules. Besides the vaultwarden I also have a backup that sends emails (
ttionya/vaultwarden-backup:latest)Both of these apps are good at sending emails.
For your information, I am using the
lldap/lldap:stableimage which is in version0.6.1.@nitnelave commented on GitHub (Apr 9, 2025):
It's a bit hard to debug without access to your system... We have had many users successfully send emails, with both tls and starttls.
What I would recommend is to go back to tls/465, and double check your settings as parsed by LLDAP: when you start it in verbose mode, the config is printed at the top, and it contains your SMTP settings. Make sure that they are correct; it's possible that you have a typo in your environment variables that prevents LLDAP from getting them.
@6C656C65 commented on GitHub (Apr 9, 2025):
I've set the LLDAP log file to debug mode with an attachment. The SMTP-related configurations are present.
Can you confirm that
fromandreply_tocan be empty?I will try to debug more deeply to see if it comes from the SMTP server, the libraries used or something else...
lldap_logs_startup.txt
@nitnelave commented on GitHub (Apr 9, 2025):
Everything looks correct. As long as the user is populated, from and reply-to should be optional.
I'm sorry I can't help you much more. If it helps, it's just a thin wrapper around the lettre library, maybe you can get help from them?
@6C656C65 commented on GitHub (Apr 9, 2025):
I quickly tried some Rust code with the
lettre 0.10.1andrustls 0.20libraries, using the same versions you're using inlldap 0.6.1, to test, and the email is successfully sent via TLS with my SMTP server.When I have more time, I'll test it by debugging LLDAP directly.
I also tested with the mail command directly in the container and it worked fine in TLS, so no filtering issues
Thank you for your time
Here is the code I tested with. If I missed a library you use or something else, please let me know. I didn't have time to dig into your code perfectly.
Cargo.toml
main.rs
@nitnelave commented on GitHub (Apr 9, 2025):
You can compare with what LLDAP does: https://github.com/lldap/lldap/blob/main/server%2Fsrc%2Fmail.rs
It looks similar at a glance, but I haven't carefully compared it
@6C656C65 commented on GitHub (Apr 12, 2025):
Well, I have good news: I was able to send emails.
After several tests, analyzing libraries and code, I have some clues as to what was causing the problem.
My SMTP server's host only accepts certain versions of TLS (
TLSv1.2andTLSv1.3). This caused theAlert ProtocolVersionmessage.But I still haven't figured out why the
Lettrelibrary can't always perform the TLS handshake with my SMTP server. So I have to click the button several times to send an email.I also changed the format of the variables, I removed the double quotes in my compose. I have things like that :
Before I had things like this because I deploy the application with
ansible:@mevgmbh commented on GitHub (Jul 30, 2025):
The SMTP setting are a bit "picky" as I tested with my local hosting company netcup.de, SMTP relay mailbaby https://www.mail.baby and with free=0US$ SMTP2Go https://www.smtp2go.com/, which works well with:
- LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET=true
- LLDAP_SMTP_OPTIONS__SERVER=mail.smtp2go.com
- LLDAP_SMTP_OPTIONS__PORT=587
- LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=STARTTLS
- LLDAP_SMTP_OPTIONS__USER=email@domain.com # The SMTP user, usually your email address
- LLDAP_SMTP_OPTIONS__PASSWORD=WhatEverItIs # The SMTP password of the SMTP2Go User
- LLDAP_SMTP_OPTIONS__FROM=WhereEver email@domain.com
- LLDAP_SMTP_OPTIONS__TO=WhereEver email@domain.com
@nitnelave commented on GitHub (Jul 30, 2025):
I found that usually, when people have an issue with the SMTP settings, it's due to quoting of the password (or lack thereof). Can you check whether that's the case here?
@mevgmbh commented on GitHub (Jul 30, 2025):
I tried Netcup and MailBaby, no special characters/only a-z/A-Z/0-9, with/without quotes and none worked on 587:STARTTLS, SMTP2Go works out of the box (and should be limitation due to 200 0€ emails/day) without ""
@mevgmbh commented on GitHub (Jul 30, 2025):
SMTP2Go works out of the box (and should be NO limitation due to 200 0€ emails/day) without "", password as well a-z/A-Z/0-9