Continuing from issue #3395, I'm having trouble connecting to my postfix
SMTP server. I'd like to connect to it using a normal password over
SSL/TLS. I have successfully managed to connect to it using `msmtp` on
my Linux machine.

This is the relevant configuration values my postfix server has:

    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous, noplaintext
    smtpd_sasl_tls_security_options = noanonymous
    smtpd_tls_auth_only = yes
    smtpd_relay_restrictions = permit_sasl_authenticated, 
reject_unauth_destination, permit_tls_all_clientcerts
    smtpd_client_restrictions = permit_sasl_authenticated, 
reject_unauth_destination
    smtpd_tls_cert_file = # path...
    smtpd_tls_key_file = # path...
    smtpd_tls_security_level = encrypt

And `msmtp` has this configuration for this account:

    defaults
        auth on
        tls on
        tls_trust_file /etc/ssl/certs/ca-certificates.crt
        logfile ~/.msmtp.log
    account test
        host smtp.example.com
        from [email protected]
        user me
        auth plain
        password # Password here #
    account default : test

I use this command to test the client settings of `msmtp`:

    echo "testing msmtp from the command line" | msmtp -a test 
[email protected]

--------------------------------------------------------

However, K-9, configured with the following parameters for the outgoing
server:

- SMTP server: `smtp.example.com`
- Security: `SSL/TLS`
- Port: `25`
- [x] Require sign-in
- Username: `[email protected]`
- Authentication: `normal password`
- Password: # Password here #

Gives me the following error message when I try test the connection:

    Setup could not finish
    ---
    cannot connect to server
    ()

K-9 Mail version: F-droid Latest stable - `5.403`
Android version: LineageOS 14.1 nightly, (Android 7.1)
Account type: SMTP (outgoing server).

In order to debug the problem and since I'm the administrator of the
server, Here is the relevant log appended from postfix when I attempt to
establish a connection to it (private information removed):

    vps postfix/smtpd[12908]: connect from unknown[ip.address]
    vps postfix/smtpd[12908]: lost connection after CONNECT from 
unknown[ip.address]
    postfix/smtpd[12908]: disconnect from unknown[ip.address] commands=0/0

I've also tried to put my public IP address in the `debug_peer_list` in
`/etc/postfix/main.cf` and `debug_peer_level = 2`.

This made postfix produce a lot of output, but the relevant output (I
think) is this:

    May 18 09:21:37 vps postfix/smtpd[4866]: > unknown[ip.address]: 220 
vps.doronbehar.com ESMTP Postfix
    May 18 09:21:37 vps postfix/smtpd[4866]: watchdog_pat: 0x561fe76cc010
    May 18 09:21:37 vps postfix/smtpd[4866]: < unknown[ip.address]: ???
    May 18 09:21:37 vps postfix/smtpd[4866]: > unknown[ip.address]: 500 5.5.2 
Error: bad UTF-8 syntax
    May 18 09:21:37 vps postfix/smtpd[4866]: watchdog_pat: 0x561fe76cc010
    May 18 09:21:37 vps postfix/smtpd[4866]: < unknown[ip.address]: ????
    May 18 09:21:37 vps postfix/smtpd[4866]: > unknown[ip.address]: 500 5.5.2 
Error: bad UTF-8 syntax
    May 18 09:21:37 vps postfix/smtpd[4866]: watchdog_pat: 0x561fe76cc010
    May 18 09:21:37 vps postfix/smtpd[4866]: smtp_get: EOF

The full log can be found here:
https://gist.github.com/doronbehar/78b2246e25371d4ae35c510d00825139

I've also managed to get the relevant part of the log from K-9 using a
log-cat reader:

    Error while testing settings
    com.fsck.k9.mail.CertificateValidationException: Handshake failed
        at 
com.fsck.k9.mail.transport.smtp.SmtpTransport.open(SmtpTransport.java:320)
        at 
com.fsck.k9.activity.setup.AccountSetupCheckSettings$CheckAccountTask.checkOutgoing(AccountSetupCheckSettings.java:484)
        at 
com.fsck.k9.activity.setup.AccountSetupCheckSettings$CheckAccountTask.checkServerSettings(AccountSetupCheckSettings.java:471)
        at 
com.fsck.k9.activity.setup.AccountSetupCheckSettings$CheckAccountTask.doInBackground(AccountSetupCheckSettings.java:424)
        at 
com.fsck.k9.activity.setup.AccountSetupCheckSettings$CheckAccountTask.doInBackground(AccountSetupCheckSettings.java:402)
        at android.os.AsyncTask$2.call(AsyncTask.java:305)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
    Caused by: javax.net.ssl.SSLHandshakeException: Handshake failed
        at 
com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:429)
        at 
com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:682)
        at 
com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:644)
        at 
com.fsck.k9.mail.transport.smtp.SmtpTransport.open(SmtpTransport.java:142)
        ... 10 more
    Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: 
ssl=0x933d11c0: Failure in SSL library, usually a protocol error
    error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER 
(external/boringssl/src/ssl/tls_record.c:192 0xa8d9a872:0x00000000)
        at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native 
Method)
        at 
com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:357)
        ... 13 more

I'll be happy to get some help on this matter.

-- 
You received this message because you are subscribed to the Google Groups "K-9 
Mail" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to