[GH-ISSUE #968] [BUG] unable to send_test_email: ERROR 🚨 [error]: Could not send email: Connection error: Connection error: received corrupt message: Connection error: received corrupt message: received corrupt message #351

Closed
opened 2026-02-27 08:16:48 +03:00 by kerem · 13 comments
Owner

Originally created by @kelvtech-co-uk on GitHub (Sep 6, 2024).
Original GitHub issue: https://github.com/lldap/lldap/issues/968

Hi, sorry I cannot fathom this. I'm setting the SMTP values as docker environment variables. The host smpt.gmail.com responds to pings from inside the container without issue. Using a docker bridge network which houses other containers which can send emails fine with the same account e.g. authelia. Any help appreciated.

bash-5.1# ./lldap send_test_email -v --to my.email@gmail.com

Loading configuration from lldap_config.toml
Configuration: Configuration {
    ldap_host: "0.0.0.0",
    ldap_port: 3890,
    http_host: "0.0.0.0",
    http_port: 17170,
    jwt_secret: ***SECRET***,
    ldap_base_dn: "dc=mydomain,dc=local",
    ldap_user_dn: UserId(
        "admin",
    ),
    ldap_user_email: "",
    ldap_user_pass: ***SECRET***,
    database_url: "mysql://user:*********@mysql.mydomain.local/lldap",
    ignored_user_attributes: [],
    ignored_group_attributes: [],
    verbose: true,
    key_file: "server_key",
    key_seed: Some(
        ***SECRET***,
    ),
    smtp_options: MailOptions {
        enable_password_reset: true,
        from: Some(
            Mailbox {
                name: Some(
                    "LLDAP ADMIN",
                ),
                email: Address {
                    serialized: "my.email@gmail.com",
                    at_start: 16,
                },
            },
        ),
        reply_to: None,
        server: "smtp.gmail.com",
        port: 587,
        user: "my.email@gmail.com",
        password: ***SECRET***,
        smtp_encryption: Tls,
        tls_required: None,
    },
    ldaps_options: LdapsOptions {
        enabled: false,
        port: 6360,
        cert_file: "cert.pem",
        key_file: "key.pem",
    },
    http_url: Url {
        scheme: "http",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(
            Domain(
                "localhost",
            ),
        ),
        port: None,
        path: "/",
        query: None,
        fragment: None,
    },
    server_setup: None,
}

Got a key_seed, ignoring key_file
2024-09-06T20:15:46.326082997+00:00  DEBUG    🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587'
2024-09-06T20:15:46.406848515+00:00  DEBUG    🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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
2024-09-06T20:15:46.406940578+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
2024-09-06T20:15:46.446280341+00:00  ERROR    🚨 [error]: Could not send email: Connection error: Connection error: received corrupt message: Connection error: received corrupt message: received corrupt message
Originally created by @kelvtech-co-uk on GitHub (Sep 6, 2024). Original GitHub issue: https://github.com/lldap/lldap/issues/968 Hi, sorry I cannot fathom this. I'm setting the SMTP values as docker environment variables. The host smpt.gmail.com responds to pings from inside the container without issue. Using a docker bridge network which houses other containers which can send emails fine with the same account e.g. authelia. Any help appreciated. ``` bash-5.1# ./lldap send_test_email -v --to my.email@gmail.com Loading configuration from lldap_config.toml Configuration: Configuration { ldap_host: "0.0.0.0", ldap_port: 3890, http_host: "0.0.0.0", http_port: 17170, jwt_secret: ***SECRET***, ldap_base_dn: "dc=mydomain,dc=local", ldap_user_dn: UserId( "admin", ), ldap_user_email: "", ldap_user_pass: ***SECRET***, database_url: "mysql://user:*********@mysql.mydomain.local/lldap", ignored_user_attributes: [], ignored_group_attributes: [], verbose: true, key_file: "server_key", key_seed: Some( ***SECRET***, ), smtp_options: MailOptions { enable_password_reset: true, from: Some( Mailbox { name: Some( "LLDAP ADMIN", ), email: Address { serialized: "my.email@gmail.com", at_start: 16, }, }, ), reply_to: None, server: "smtp.gmail.com", port: 587, user: "my.email@gmail.com", password: ***SECRET***, smtp_encryption: Tls, tls_required: None, }, ldaps_options: LdapsOptions { enabled: false, port: 6360, cert_file: "cert.pem", key_file: "key.pem", }, http_url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some( Domain( "localhost", ), ), port: None, path: "/", query: None, fragment: None, }, server_setup: None, } Got a key_seed, ignoring key_file 2024-09-06T20:15:46.326082997+00:00 DEBUG 🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587' 2024-09-06T20:15:46.406848515+00:00 DEBUG 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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 2024-09-06T20:15:46.406940578+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 2024-09-06T20:15:46.446280341+00:00 ERROR 🚨 [error]: Could not send email: Connection error: Connection error: received corrupt message: Connection error: received corrupt message: received corrupt message ```
Author
Owner

@nitnelave commented on GitHub (Sep 6, 2024):

That's strange. Usually this error means that you're using STARTTLS instead of TLS or vice versa. Can you try switching around the SMTP ports and protocols? Try the 4 combinations of (465, 587) x (TLS, STARTTLS)

<!-- gh-comment-id:2334791878 --> @nitnelave commented on GitHub (Sep 6, 2024): That's strange. Usually this error means that you're using STARTTLS instead of TLS or vice versa. Can you try switching around the SMTP ports and protocols? Try the 4 combinations of (465, 587) x (TLS, STARTTLS)
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 6, 2024):

So TLS on 465 and STARTTLS on 587 get further. Think i have a bad password so will recheck tomorrow and follow up. However that port and protocol combo is odd right?

<!-- gh-comment-id:2334806402 --> @kelvtech-co-uk commented on GitHub (Sep 6, 2024): So TLS on 465 and STARTTLS on 587 get further. Think i have a bad password so will recheck tomorrow and follow up. However that port and protocol combo is odd right?
Author
Owner

@nitnelave commented on GitHub (Sep 6, 2024):

Yes, it should be the opposite.
Make sure you're using an app password for Gmail.

<!-- gh-comment-id:2334816286 --> @nitnelave commented on GitHub (Sep 6, 2024): Yes, it should be the opposite. Make sure you're using an app password for Gmail.
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 7, 2024):

I cannot find a working combination. I've tried both an existing app password I have for authelia which is quite old as well as a newly generated one for lldap, but I can't see how this can be a credential issue on my side.

Anything else I can do to tshoot this?

My test command, just in case... ./lldap send_test_email -v --to my.email@gmail.com

LLDAP_SMTP_OPTIONS__PORT=465
LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=STARTTLS

2024-09-07T14:40:43.011079187+00:00  DEBUG    🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'465'
2024-09-07T14:40:53.068603659+00:00  ERROR    🚨 [error]: Could not send email: response error: incomplete response: incomplete response
LLDAP_SMTP_OPTIONS__PORT=587
LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=STARTTLS

2024-09-07T14:43:36.682871383+00:00  DEBUG    🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587'
2024-09-07T14:43:36.826675572+00:00  DEBUG    🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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
2024-09-07T14:43:36.826759069+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
2024-09-07T14:43:36.848236175+00:00  DEBUG    🐛 [debug]: Using ciphersuite TLS13_AES_256_GCM_SHA384 | 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: 583
2024-09-07T14:43:36.848304964+00:00  DEBUG    🐛 [debug]: Not resuming | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 130
2024-09-07T14:43:36.848363747+00:00  DEBUG    🐛 [debug]: TLS1.3 encrypted extensions: [] | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 395
2024-09-07T14:43:36.848387221+00:00  DEBUG    🐛 [debug]: ALPN protocol is None | 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: 452
2024-09-07T14:43:36.912687038+00:00  DEBUG    🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050
2024-09-07T14:43:36.912720993+00:00  DEBUG    🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050
2024-09-07T14:43:37.128252152+00:00  ERROR    🚨 [error]: Could not send email: permanent error (535): 5.7.8 Username and Password not accepted. For more information, go to5.7.8  https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd523bfsm745078a12.53 - gsmtp: 5.7.8 Username and Password not accepted. For more information, go to5.7.8  https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd523bfsm745078a12.53 - gsmtp
LLDAP_SMTP_OPTIONS__PORT=587
LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS

2024-09-07T14:44:05.473417030+00:00  DEBUG    🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587'
2024-09-07T14:44:05.494492294+00:00  DEBUG    🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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
2024-09-07T14:44:05.494549469+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
2024-09-07T14:44:05.533125643+00:00  ERROR    🚨 [error]: Could not send email: Connection error: Connection error: received corrupt message: Connection error: received corrupt message: received corrupt message
LLDAP_SMTP_OPTIONS__PORT=465
LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS

2024-09-07T14:44:51.548344769+00:00  DEBUG    🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'465'
2024-09-07T14:44:51.570676912+00:00  DEBUG    🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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
2024-09-07T14:44:51.570729105+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
2024-09-07T14:44:51.592106330+00:00  DEBUG    🐛 [debug]: Using ciphersuite TLS13_AES_256_GCM_SHA384 | 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: 583
2024-09-07T14:44:51.592138231+00:00  DEBUG    🐛 [debug]: Not resuming | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 130
2024-09-07T14:44:51.592213578+00:00  DEBUG    🐛 [debug]: TLS1.3 encrypted extensions: [] | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 395
2024-09-07T14:44:51.592224209+00:00  DEBUG    🐛 [debug]: ALPN protocol is None | 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: 452
2024-09-07T14:44:51.720929158+00:00  DEBUG    🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050
2024-09-07T14:44:51.721000654+00:00  DEBUG    🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050
2024-09-07T14:44:51.979997464+00:00  ERROR    🚨 [error]: Could not send email: permanent error (535): 5.7.8 Username and Password not accepted. For more information, go to5.7.8  https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd8cc28sm742474a12.83 - gsmtp: 5.7.8 Username and Password not accepted. For more information, go to5.7.8  https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd8cc28sm742474a12.83 - gsmtp
<!-- gh-comment-id:2335363578 --> @kelvtech-co-uk commented on GitHub (Sep 7, 2024): I cannot find a working combination. I've tried both an existing app password I have for authelia which is quite old as well as a newly generated one for lldap, but I can't see how this can be a credential issue on my side. Anything else I can do to tshoot this? My test command, just in case... `./lldap send_test_email -v --to my.email@gmail.com` ``` LLDAP_SMTP_OPTIONS__PORT=465 LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=STARTTLS 2024-09-07T14:40:43.011079187+00:00 DEBUG 🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'465' 2024-09-07T14:40:53.068603659+00:00 ERROR 🚨 [error]: Could not send email: response error: incomplete response: incomplete response ``` ``` LLDAP_SMTP_OPTIONS__PORT=587 LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=STARTTLS 2024-09-07T14:43:36.682871383+00:00 DEBUG 🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587' 2024-09-07T14:43:36.826675572+00:00 DEBUG 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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 2024-09-07T14:43:36.826759069+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 2024-09-07T14:43:36.848236175+00:00 DEBUG 🐛 [debug]: Using ciphersuite TLS13_AES_256_GCM_SHA384 | 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: 583 2024-09-07T14:43:36.848304964+00:00 DEBUG 🐛 [debug]: Not resuming | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 130 2024-09-07T14:43:36.848363747+00:00 DEBUG 🐛 [debug]: TLS1.3 encrypted extensions: [] | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 395 2024-09-07T14:43:36.848387221+00:00 DEBUG 🐛 [debug]: ALPN protocol is None | 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: 452 2024-09-07T14:43:36.912687038+00:00 DEBUG 🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050 2024-09-07T14:43:36.912720993+00:00 DEBUG 🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050 2024-09-07T14:43:37.128252152+00:00 ERROR 🚨 [error]: Could not send email: permanent error (535): 5.7.8 Username and Password not accepted. For more information, go to5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd523bfsm745078a12.53 - gsmtp: 5.7.8 Username and Password not accepted. For more information, go to5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd523bfsm745078a12.53 - gsmtp ``` ``` LLDAP_SMTP_OPTIONS__PORT=587 LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS 2024-09-07T14:44:05.473417030+00:00 DEBUG 🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587' 2024-09-07T14:44:05.494492294+00:00 DEBUG 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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 2024-09-07T14:44:05.494549469+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 2024-09-07T14:44:05.533125643+00:00 ERROR 🚨 [error]: Could not send email: Connection error: Connection error: received corrupt message: Connection error: received corrupt message: received corrupt message ``` ``` LLDAP_SMTP_OPTIONS__PORT=465 LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS 2024-09-07T14:44:51.548344769+00:00 DEBUG 🐛 [debug]: Sending email to 'my.email@gmail.com' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'465' 2024-09-07T14:44:51.570676912+00:00 DEBUG 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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 2024-09-07T14:44:51.570729105+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 2024-09-07T14:44:51.592106330+00:00 DEBUG 🐛 [debug]: Using ciphersuite TLS13_AES_256_GCM_SHA384 | 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: 583 2024-09-07T14:44:51.592138231+00:00 DEBUG 🐛 [debug]: Not resuming | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 130 2024-09-07T14:44:51.592213578+00:00 DEBUG 🐛 [debug]: TLS1.3 encrypted extensions: [] | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 395 2024-09-07T14:44:51.592224209+00:00 DEBUG 🐛 [debug]: ALPN protocol is None | 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: 452 2024-09-07T14:44:51.720929158+00:00 DEBUG 🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050 2024-09-07T14:44:51.721000654+00:00 DEBUG 🐛 [debug]: Ticket saved | log.target: "rustls::client::tls13" | log.module_path: "rustls::client::tls13" | log.file: "/__w/lldap/lldap/${GITHUB_WORKSPACE}/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.20.8/src/client/tls13.rs" | log.line: 1050 2024-09-07T14:44:51.979997464+00:00 ERROR 🚨 [error]: Could not send email: permanent error (535): 5.7.8 Username and Password not accepted. For more information, go to5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd8cc28sm742474a12.83 - gsmtp: 5.7.8 Username and Password not accepted. For more information, go to5.7.8 https://support.google.com/mail/?p=BadCredentials 4fb4d7f45d1cf-5c3ebd8cc28sm742474a12.83 - gsmtp ```
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 7, 2024):

I turned on verbose logging to capture this but its not really saying much else I don't think?

2024-09-07T15:26:35.210583312+00:00  DEBUG    HTTP request [ 1.05ms | 4.78% / 100.00% ] method: "GET" | uri: "/auth/reset/step1/my.email@live.co.uk"
2024-09-07T15:26:35.210621568+00:00  DEBUG    ┝━ get_password_reset_step1 [ 1.00ms | 44.36% / 95.22% ]
2024-09-07T15:26:35.210635218+00:00  DEBUG    │  ┝━ list_users [ 337µs | 32.00% ] filters: Some(Or([UserId(UserId("my.email@live.co.uk")), Equality(Email, "my.email@live.co.uk")])) | _get_groups: false
2024-09-07T15:26:35.213254856+00:00  DEBUG    │  │  ┕━ 🐛 [debug]:  | return: [UserAndGroups { user: User { user_id: UserId("myuser"), email: "my.email@live.co.uk", display_name: None, creation_date: 2024-09-07T15:26:20, uuid: Uuid("022deaba-dbaa-366d-a7f4-01fa17f7f5bc"), attributes: [] }, groups: Some([]) }]
2024-09-07T15:26:35.213258299+00:00  DEBUG    │  ┝━ start_password_reset [ 199µs | 18.86% ]
2024-09-07T15:26:35.213259985+00:00  DEBUG    │  │  ┕━ 🐛 [debug]:  | user: UserId("myuser")
2024-09-07T15:26:35.229506681+00:00  DEBUG    │  ┝━ 🐛 [debug]: Sending email to 'my.email@live.co.uk' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587'
2024-09-07T15:26:35.276402808+00:00  DEBUG    │  ┝━ 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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
2024-09-07T15:26:35.276420888+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
2024-09-07T15:26:35.328612215+00:00  WARN     │  ┝━ 🚧 [warn]: Error sending email: lettre::transport::smtp::Error {
    kind: Connection,
    source: lettre::transport::smtp::Error {
        kind: Connection,
        source: Custom {
            kind: InvalidData,
            error: CorruptMessage,
        },
    },
}
2024-09-07T15:26:35.328613381+00:00  INFO     │  ┕━ i [info]: Reset token: zEyY2e4wV5G8nNpGRFxDcIGh77UZ1zwMc5SO3AWwb9q3zh0Bksa6gFLPVX8wYFTVBJyXEsWpZPa86SfeOcinrjLFNXXh45WfRhoE
<!-- gh-comment-id:2335529957 --> @kelvtech-co-uk commented on GitHub (Sep 7, 2024): I turned on verbose logging to capture this but its not really saying much else I don't think? ``` 2024-09-07T15:26:35.210583312+00:00 DEBUG HTTP request [ 1.05ms | 4.78% / 100.00% ] method: "GET" | uri: "/auth/reset/step1/my.email@live.co.uk" 2024-09-07T15:26:35.210621568+00:00 DEBUG ┝━ get_password_reset_step1 [ 1.00ms | 44.36% / 95.22% ] 2024-09-07T15:26:35.210635218+00:00 DEBUG │ ┝━ list_users [ 337µs | 32.00% ] filters: Some(Or([UserId(UserId("my.email@live.co.uk")), Equality(Email, "my.email@live.co.uk")])) | _get_groups: false 2024-09-07T15:26:35.213254856+00:00 DEBUG │ │ ┕━ 🐛 [debug]: | return: [UserAndGroups { user: User { user_id: UserId("myuser"), email: "my.email@live.co.uk", display_name: None, creation_date: 2024-09-07T15:26:20, uuid: Uuid("022deaba-dbaa-366d-a7f4-01fa17f7f5bc"), attributes: [] }, groups: Some([]) }] 2024-09-07T15:26:35.213258299+00:00 DEBUG │ ┝━ start_password_reset [ 199µs | 18.86% ] 2024-09-07T15:26:35.213259985+00:00 DEBUG │ │ ┕━ 🐛 [debug]: | user: UserId("myuser") 2024-09-07T15:26:35.229506681+00:00 DEBUG │ ┝━ 🐛 [debug]: Sending email to 'my.email@live.co.uk' as 'LLDAP ADMIN <my.email@gmail.com>' via 'my.email@gmail.com'@'smtp.gmail.com':'587' 2024-09-07T15:26:35.276402808+00:00 DEBUG │ ┝━ 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.gmail.com"))) | 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 2024-09-07T15:26:35.276420888+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 2024-09-07T15:26:35.328612215+00:00 WARN │ ┝━ 🚧 [warn]: Error sending email: lettre::transport::smtp::Error { kind: Connection, source: lettre::transport::smtp::Error { kind: Connection, source: Custom { kind: InvalidData, error: CorruptMessage, }, }, } 2024-09-07T15:26:35.328613381+00:00 INFO │ ┕━ i [info]: Reset token: zEyY2e4wV5G8nNpGRFxDcIGh77UZ1zwMc5SO3AWwb9q3zh0Bksa6gFLPVX8wYFTVBJyXEsWpZPa86SfeOcinrjLFNXXh45WfRhoE ```
Author
Owner

@nitnelave commented on GitHub (Sep 7, 2024):

I can't help but think that "Username and Password not accepted" has something to do with your problem :)

How do you specify the password? If it's in a docker compose as env, the double quotes are usually not interpreted (meaning that it'll start your password with double quotes, making it invalid)

<!-- gh-comment-id:2335783095 --> @nitnelave commented on GitHub (Sep 7, 2024): I can't help but think that "Username and Password not accepted" has something to do with your problem :) How do you specify the password? If it's in a docker compose as env, the double quotes are usually not interpreted (meaning that it'll start your password with double quotes, making it invalid)
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 7, 2024):

:-) I won't take offence...I'm expecting this to be a typo somewhere in my config lol. All settings are via a docker .env file as below. Ref the logouts above I shared, I had assumed the username/password messages were because of the protocol and port mismatch and Google declining the connections?

LLDAP_VERBOSE=true
LLDAP_LDAP_HOSt=0.0.0.0
LLDAP_LDAP_PORT=3890
LLDAP_HTTP_HOST=0.0.0.0
LLDAP_HTTP_PORT=17170
LLDAP_HTTP_URL="http://lldap.mydomain.local"

LLDAP_LDAP_BASE_DN=dc=mydomain,dc=local
LLDAP_DATABASE_URL=mysql://lldap:apassword@mysql.mydomain.local/lldap
LLDAP_LDAP_USER_DN=admin
LLDAP_LDAP_USER_EMAIL=my.email@gmail.com
LLDAP_LDAP_USER_PASS_FILE=/secrets/.lldap_user_pass_file
LLDAP_JWT_SECRET_FILE=/secrets/.lldap_jwt_secret_file
LLDAP_KEY_SEED_FILE=/secrets/.lldap_key_seed_file
UID=1000
GID=100
TZ=Europe/London

LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET=true
LLDAP_SMTP_OPTIONS__SERVER=smtp.gmail.com
LLDAP_SMTP_OPTIONS__PORT=587
LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS
LLDAP_SMTP_OPTIONS__USER=my.email@gmail.com
LLDAP_SMTP_OPTIONS__PASSWORD=gmailapppass
#LLDAP_SMTP_OPTIONS__PASSWORD_FILE=/secrets/.lldap_smtp_options__password_file
LLDAP_SMTP_OPTIONS__FROM="LLDAP ADMIN <my.email@gmail.com>"
LLDAP_SMTP_OPTIONS__REPLY_TO="DO NOT REPLY <noreply@lldap.mydomain.local>"

# If using LDAPS, set enabled true and configure cert and key path
# - LLDAP_LDAPS_OPTIONS__ENABLED=true
# - LLDAP_LDAPS_OPTIONS__CERT_FILE=/path/to/certfile.crt
# - LLDAP_LDAPS_OPTIONS__KEY_FILE=/path/to/keyfile.key

EDIT: Corrected the typo in the envirnonment variable name which was the source of my troubles.

<!-- gh-comment-id:2336400979 --> @kelvtech-co-uk commented on GitHub (Sep 7, 2024): :-) I won't take offence...I'm expecting this to be a typo somewhere in my config lol. All settings are via a docker .env file as below. Ref the logouts above I shared, I had assumed the username/password messages were because of the protocol and port mismatch and Google declining the connections? ``` LLDAP_VERBOSE=true LLDAP_LDAP_HOSt=0.0.0.0 LLDAP_LDAP_PORT=3890 LLDAP_HTTP_HOST=0.0.0.0 LLDAP_HTTP_PORT=17170 LLDAP_HTTP_URL="http://lldap.mydomain.local" LLDAP_LDAP_BASE_DN=dc=mydomain,dc=local LLDAP_DATABASE_URL=mysql://lldap:apassword@mysql.mydomain.local/lldap LLDAP_LDAP_USER_DN=admin LLDAP_LDAP_USER_EMAIL=my.email@gmail.com LLDAP_LDAP_USER_PASS_FILE=/secrets/.lldap_user_pass_file LLDAP_JWT_SECRET_FILE=/secrets/.lldap_jwt_secret_file LLDAP_KEY_SEED_FILE=/secrets/.lldap_key_seed_file UID=1000 GID=100 TZ=Europe/London LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET=true LLDAP_SMTP_OPTIONS__SERVER=smtp.gmail.com LLDAP_SMTP_OPTIONS__PORT=587 LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=TLS LLDAP_SMTP_OPTIONS__USER=my.email@gmail.com LLDAP_SMTP_OPTIONS__PASSWORD=gmailapppass #LLDAP_SMTP_OPTIONS__PASSWORD_FILE=/secrets/.lldap_smtp_options__password_file LLDAP_SMTP_OPTIONS__FROM="LLDAP ADMIN <my.email@gmail.com>" LLDAP_SMTP_OPTIONS__REPLY_TO="DO NOT REPLY <noreply@lldap.mydomain.local>" # If using LDAPS, set enabled true and configure cert and key path # - LLDAP_LDAPS_OPTIONS__ENABLED=true # - LLDAP_LDAPS_OPTIONS__CERT_FILE=/path/to/certfile.crt # - LLDAP_LDAPS_OPTIONS__KEY_FILE=/path/to/keyfile.key ``` **EDIT:** Corrected the typo in the envirnonment variable name which was the source of my troubles.
Author
Owner

@nitnelave commented on GitHub (Sep 7, 2024):

Erf, I got tricked again by the absolutely confusing general SMTP docs... They use TLS to mean STARTTLS, and they use SSL to mean (implicit) TLS. Whereas in LLDAP, the settings are the actual protocols of TLS or STARTTLS.
So yes, the best option is TLS, with port 465. STARTTLS with port 587 is also possible, but not recommended.

So we're back to the actual error of username/password not accepted, and that's a valid server-side response to a valid query (in the correct protocol, otherwise they wouldn't even be able to talk, thus the corrupted/incomplete messages when mixing up ports and protocols).

Can you try double-checking your settings, and maybe specifying the password in a file?

<!-- gh-comment-id:2336426059 --> @nitnelave commented on GitHub (Sep 7, 2024): Erf, I got tricked again by the absolutely confusing general SMTP docs... They use TLS to mean STARTTLS, and they use SSL to mean (implicit) TLS. Whereas in LLDAP, the settings are the actual protocols of TLS or STARTTLS. So yes, the best option is TLS, with port 465. STARTTLS with port 587 is also possible, but not recommended. So we're back to the actual error of username/password not accepted, and that's a valid server-side response to a valid query (in the correct protocol, otherwise they wouldn't even be able to talk, thus the corrupted/incomplete messages when mixing up ports and protocols). Can you try double-checking your settings, and maybe specifying the password in a file?
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 7, 2024):

Urk, appreciate you wading thru that. Sure will retest tomorrow and move the password into a file. Will also check that password in another container to be sure.

<!-- gh-comment-id:2336428559 --> @kelvtech-co-uk commented on GitHub (Sep 7, 2024): Urk, appreciate you wading thru that. Sure will retest tomorrow and move the password into a file. Will also check that password in another container to be sure.
Author
Owner

@nitnelave commented on GitHub (Sep 7, 2024):

The confusing docs are a "known issue". I had a small attempt at clarifying the error message already in place, but it seems it didn't have a great coverage. Thanks to the comprehensive logs in this issue, I improved it: https://github.com/lldap/lldap/pull/970

<!-- gh-comment-id:2336432884 --> @nitnelave commented on GitHub (Sep 7, 2024): The confusing docs are a "known issue". I had a small attempt at clarifying the error message already in place, but it seems it didn't have a great coverage. Thanks to the comprehensive logs in this issue, I improved it: https://github.com/lldap/lldap/pull/970
Author
Owner

@kelvtech-co-uk commented on GitHub (Sep 8, 2024):

Thank you @nitnelave, I'm now working using explicit TLS on port 465.

Once you cleared up the port confusion I spotted the problem 💩 was a typo with the naming of the env variable!

Apprecaite your time and help!

<!-- gh-comment-id:2336624848 --> @kelvtech-co-uk commented on GitHub (Sep 8, 2024): Thank you @nitnelave, I'm now working using explicit TLS on port 465. Once you cleared up the port confusion I spotted the problem :shit: was a typo with the naming of the env variable! Apprecaite your time and help!
Author
Owner

@nitnelave commented on GitHub (Sep 8, 2024):

I'll see if I can get a warning for typos in environment variables

<!-- gh-comment-id:2336638268 --> @nitnelave commented on GitHub (Sep 8, 2024): I'll see if I can get a warning for typos in environment variables
Author
Owner

@nitnelave commented on GitHub (Sep 8, 2024):

Here's for the next person with a typo in their env variable: https://github.com/lldap/lldap/pull/972

<!-- gh-comment-id:2336800523 --> @nitnelave commented on GitHub (Sep 8, 2024): Here's for the next person with a typo in their env variable: https://github.com/lldap/lldap/pull/972
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#351
No description provided.