https://github.com/lldap/lldap logo
Simon | Player_Schark - Hi I just tried to conf...
# troubleshooting
p
Hi I just tried to configure the SMTP client. But LLDAP doesn't seem to accept the config. At least no emails are sent. I have no errors in the log. The login information I use for my SMTP server works for other services I use. The only thing I read about it on git is "[...] or request a password reset link (if you configured the SMTP client)." Do I need to configure anything other than the values below?
Copy code
[smtp_options]
## Whether to enabled password reset via email, from LLDAP.
enable_password_reset=true
## The SMTP server.
server="mail.my.server"
## The SMTP port.
port=587
## How the connection is encrypted, either "NONE" (no encryption), "TLS" or "STARTTLS".
smtp_encryption = "TLS"
## The SMTP user, usually your email address.
user="lldap@my.server"
## The SMTP password.
password="ABC_myPa$$Word_XYZ"
## The header field, optional: how the sender appears in the email. The first
## is a free-form name, followed by an email between <>.
from="LLDAP <lldap@my.server>"
## Same for reply-to, optional.
#reply_to="Do not reply <lldap@my.server>"
n
Hey! Can you run LLDAP in verbose mode? You should get some info about trying to send emails. You can also run the binary directly, there's a email troubleshooting command
p
n
There's nothing in the docker logs?
(and the test user exists?)
If found this at the top of the log
Copy code
lldap-1  |     smtp_options: MailOptions {
lldap-1  |         enable_password_reset: true,
lldap-1  |         from: Some(
lldap-1  |             Mailbox {
lldap-1  |                 name: Some(
lldap-1  |                     LDAP",
lldap-1  |                 ),
lldap-1  |                 email: Address {
lldap-1  |                     serialized: "my@mail.com",
lldap-1  |                     at_start: 4,
lldap-1  |                 },
lldap-1  |             },
lldap-1  |         ),
lldap-1  |         reply_to: None,
lldap-1  |         server: "mail.my.server",
lldap-1  |         port: 587,
lldap-1  |         user: "my@mail.com",
lldap-1  |         password: ***SECRET***,
lldap-1  |         smtp_encryption: Tls,
lldap-1  |         tls_required: None,
lldap-1  |     },
n
Yeah, that's the config dump
There should be some logs about sending an email as well
p
bt verbose mode is enabled
Copy code
lldap-1  |     ldap_user_pass: ***SECRET***,
lldap-1  |     database_url: "sqlite:///data/users.db?mode=rwc",
lldap-1  |     ignored_user_attributes: [],
lldap-1  |     ignored_group_attributes: [],
lldap-1  |     verbose: true,
lldap-1  |     key_file: "server_key",
lldap-1  |     key_seed: Some(
lldap-1  |         ***SECRET***,
lldap-1  |     ),
n
Did you find the email sending logs?
p
Unfortunately not. Are there any log files?
n
Everything should be in the logs you are looking at
p
I jsut have this
Copy code
lldap-1  | 2024-02-08T20:24:42.740234817+00:00  INFO     ┕━ i [info]: Starting the API/web server on port 17170
lldap-1  | 2024-02-08T20:24:42.740346878+00:00  INFO     i [info]: starting 1 workers
lldap-1  | 2024-02-08T20:24:42.740474468+00:00  INFO     i [info]: Actix runtime found; starting in Actix runtime
lldap-1  | 2024-02-08T20:24:42.741254396+00:00  INFO     i [info]: DB Cleanup Cron started
lldap-1  | 2024-02-08T20:24:51.605801549+00:00  DEBUG    HTTP request [ 148µs | 100.00% ] method: "GET" | uri: "/reset-password/step1"
lldap-1  | 2024-02-08T20:24:51.605951569+00:00  DEBUG    ┕━ 🐛 [debug]:  | status_code: 304
n
huh, I'm very surprised by the 304
oh, that might be related to https://github.com/lldap/lldap/issues/704
There's some caching involved, that I didn't expect
304 means "the requested document has not changed"
p
The request itself seems to be okay Request URL: https://my.server/auth/reset/step1/test Request Method: GET Status Code: 200 OK (from disk cache) Remote Address: 88.198.300.300:443
n
yeah, but it should be implemented as a POST request on the backend
and sent as such from the web UI
otherwise, yeah, you get caching
the bug was initially about security, I think? But caching is another problem
GET requests are supposed to be idempotent: you can send it as many times as you want and it'll do the same thing
p
I Disabled the cache in my local Browser
Copy code
`
lldap-1  | 2024-02-08T20:42:40.422578820+00:00  DEBUG    HTTP request [ 2.83ms | 1.11% / 100.00% ] method: "GET" | uri: "/auth/reset/step1/test"
lldap-1  | 2024-02-08T20:42:40.422594843+00:00  DEBUG    ┝━ get_password_reset_step1 [ 2.80ms | 65.29% / 98.89% ]
lldap-1  | 2024-02-08T20:42:40.422603850+00:00  DEBUG    │  ┝━ list_users [ 428µs | 15.12% ] filters: Some(Or([UserId(UserId("test")), Equality(Email, "test")])) | _get_groups: false
lldap-1  | 2024-02-08T20:42:40.423031039+00:00  DEBUG    │  │  ┕━ 🐛 [debug]:  | return: [UserAndGroups { user: User { user_id: UserId("test"), email: "my@email", display_name: None, creation_date: 2024-02-06T00:08:11.333360123, uuid: Uuid("3bb2deb0-e528-3738-b2f3-ae84454a8cef"), attributes: [] }, groups: Some([]) }]
lldap-1  | 2024-02-08T20:42:40.423036130+00:00  DEBUG    │  ┝━ start_password_reset [ 523µs | 18.48% ]
lldap-1  | 2024-02-08T20:42:40.423037612+00:00  DEBUG    │  │  ┕━ 🐛 [debug]:  | user: UserId("test")
lldap-1  | 2024-02-08T20:42:40.451464509+00:00  DEBUG    │  ┝━ 🐛 [debug]: Sending email to 'my@email' as 'ScharkIO LDAP <sender@my.email>' via 'sender@my.email'@'mail.server':'587'
lldap-1  | 2024-02-08T20:42:40.470184282+00:00  DEBUG    │  ┝━ 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("mail.server"))) | log.target: "rustls::client::hs" | log.module_path: "rustls::client::hs" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/hs.rs" | log.line: 55
lldap-1  | 2024-02-08T20:42:40.470492894+00:00  DEBUG    │  ┝━ 🐛 [debug]: Not resuming any session | log.target: "rustls::client::hs" | log.module_path: "rustls::client::hs" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/hs.rs" | log.line: 127
lldap-1  | 2024-02-08T20:42:41.023108062+00:00  WARN     │  ┝━ 🚧 [warn]: Error sending email: lettre::transport::smtp::Error {
lldap-1  |     kind: Connection,
lldap-1  |     source: lettre::transport::smtp::Error {
lldap-1  |         kind: Connection,
lldap-1  |         source: Custom {
lldap-1  |             kind: InvalidData,
lldap-1  |             error: CorruptMessage,
lldap-1  |         },
lldap-1  |     },
lldap-1  | }
lldap-1  | 2024-02-08T20:42:41.023110165+00:00  INFO     │  ┕━ i [info]: Reset token: ABCxxxTokenxxxYZ
lldap-1  | 2024-02-08T20:42:41.023265+00:00     DEBUG    ┕━ 🐛 [debug]:  | status_code: 500
https://cdn.discordapp.com/attachments/1205169040473985054/1205253377538134098/image.png?ex=65d7b2ad&is=65c53dad&hm=8d76c3255ff35f4b05d4a6974549ddf7c959beb198ed32b811b447a1c71fb383&
n
alright, there we go!
CorruptMessage usually means you're trying to send TLS/SSL message to a STARTTLS endpoint, or vice-versa
SMTP has this annoying convention that TLS means STARTTLS, where everywhere else it means SSL
so try the SSL port for your smtp provider
p
Changed it to "STARTTLS" and received the mail 😄 Thank you. But I think the GET should be a POST
n
yep, definitely
changing that right now
btw, if you can, it's safer to use TLS/SSL than STARTTLS
StartTls is basically starting off unencrypted and then asking "pretty please, can we upgrade to TLS?"
it makes more sense to directly go with TLS
p
Uasually I have TLS and My Provider says they only accepts TLS. I'm a little bit confused about this Szenario O.o