Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TLS 1.3? #375

Open
esabol opened this issue Dec 4, 2024 · 28 comments
Open

Support TLS 1.3? #375

esabol opened this issue Dec 4, 2024 · 28 comments

Comments

@esabol
Copy link

esabol commented Dec 4, 2024

@ifrh wrote:

Okay it seems to me, that DavMail do not support TLS 1.3 - or is there some way to activate TLS 1.3 via "propertie"-file?

2024-12-04 23:13:48,607 DEBUG [CaldavConnection-54261] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
[...]
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection request: [route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection leased: [id: 1][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://OWA-SERVER.DOMAIN.TLD:443
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to OWA-SERVER.DOMAIN.TLD/SOME-IP-ADDRESS:443
2024-12-04 23:13:48,752 DEBUG [CaldavConnection-54261] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to OWA-SERVER.DOMAIN.TLD/SOME-IP-ADDRESS:443 with timeout 10000
2024-12-04 23:13:48,814 DEBUG [CaldavConnection-54261] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWA-SERVER.DOMAIN.TLD 443
2024-12-04 23:13:48,814 DEBUG [CaldavConnection-54261] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
2024-12-04 23:13:48,824 DEBUG [CaldavConnection-54261] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-04 23:13:48,824 DEBUG [CaldavConnection-54261] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-04 23:13:48,897 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-2: Shutdown connection
2024-12-04 23:13:48,948 DEBUG [CaldavConnection-54261] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-04 23:13:48,948 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 1][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-04 23:13:48,948 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager is shutting down
2024-12-04 23:13:48,957 DEBUG [CaldavConnection-54261] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager shut down
2024-12-04 23:13:48,957 ERROR [CaldavConnection-54261] davmail.exchange.ExchangeSession  - Exchange login exception: Received fatal alert: handshake_failure
2024-12-04 23:13:48,969 ERROR [CaldavConnection-54261] davmail  - Exchange login exception: Received fatal alert: handshake_failure
davmail.exception.DavMailException: Exchange login exception: Received fatal alert: handshake_failure
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:208)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

Originally posted by @ifrh in #374 (comment)

@ifrh
Copy link

ifrh commented Dec 4, 2024

Found some information

I think davmail-6.2.2-3546-windows-standalone\jre\conf\security\java.security could somehow modified...
But did not get it, what to change.

@esabol
Copy link
Author

esabol commented Dec 5, 2024

I don't know if it would help or not, but maybe just add , "TLSv1.3" to the SUPPORTED_PROTOCOLS array here:

static final String[] SUPPORTED_PROTOCOLS = new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"};

@ifrh
Copy link

ifrh commented Dec 5, 2024

perhaps in intermediate time one can use STUNNEL (https://www.stunnel.org/docs.html) to "translate" TLSv1.2 to TLSv1.3


Thunderbird <=> DavMail <=> STUNNEL <=> OWA
           CalDav     TLSv1.2    TLSv1.3
        localhost   localhost    localhost   <=> server

@ifrh
Copy link

ifrh commented Dec 5, 2024

Thunderbird <=> DavMail <=> STUNNEL <=> OWA

Using STUNNEL as adapter between DavMail and OWA helps around the TLS problem, but an other DavMail exception raises


2024-12-05 19:25:30,242 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "HTTP/1.1 403 Forbidden[\r][\n]"
2024-12-05 19:25:30,242 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "Date: Thu, 05 Dec 2024 18:25:31 GMT[\r][\n]"
2024-12-05 19:25:30,243 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "X-Frame-Options: SAMEORIGIN[\r][\n]"
2024-12-05 19:25:30,243 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "X-XSS-Protection: 1; mode=block[\r][\n]"
2024-12-05 19:25:30,243 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "X-Content-Type-Options: nosniff[\r][\n]"
2024-12-05 19:25:30,243 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "Connection: close[\r][\n]"
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "Content-Length: 75[\r][\n]"
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "Content-Type: text/html[\r][\n]"
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "[\r][\n]"
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.wire  - http-outgoing-91 << "<html><head><title>403 Forbidden</title></head><body>Access denied</body>[\r][\n]"
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << HTTP/1.1 403 Forbidden
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << Date: Thu, 05 Dec 2024 18:25:31 GMT
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << X-Frame-Options: SAMEORIGIN
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << X-XSS-Protection: 1; mode=block
2024-12-05 19:25:30,244 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << X-Content-Type-Options: nosniff
2024-12-05 19:25:30,245 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << Connection: close
2024-12-05 19:25:30,245 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << Content-Length: 75
2024-12-05 19:25:30,245 DEBUG [CaldavConnection-55779] org.apache.http.headers  - http-outgoing-91 << Content-Type: text/html
2024-12-05 19:25:30,245 DEBUG [CaldavConnection-55779] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-91: Close connection
2024-12-05 19:25:30,246 DEBUG [CaldavConnection-55779] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-05 19:25:30,246 DEBUG [CaldavConnection-55779] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 89][route: {s}->https://localhost:1143][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-05 19:25:30,246 DEBUG [CaldavConnection-55779] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager is shutting down
2024-12-05 19:25:30,246 DEBUG [CaldavConnection-55779] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager shut down
2024-12-05 19:25:30,246 ERROR [CaldavConnection-55779] davmail.exchange.ExchangeSession  - Exchange login exception: Forbidden
2024-12-05 19:25:30,247 ERROR [CaldavConnection-55779] davmail  - Exchange login exception: Forbidden
davmail.exception.DavMailException: Exchange login exception: Forbidden
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:208)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

@esabol
Copy link
Author

esabol commented Dec 5, 2024

Using STUNNEL as adapter between DavMail and OWA helps around the TLS problem, but an other DavMail exception raises

This is not relevant to this issue.

@ifrh
Copy link

ifrh commented Dec 12, 2024

esabol wrote:

I don't know if it would help or not, but maybe just add , "TLSv1.3" to the SUPPORTED_PROTOCOLS array here:

static final String[] SUPPORTED_PROTOCOLS = new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"};

I changed that line localy and build from source code:
Sadly the handshake_failure remains.


C:\Downloads\DavMailSelfe\davmail-src-6.2.2>ant
Buildfile: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\build.xml

check-encoding:

check-java8:

svnrelease:

gitsvnrelease:

defaultrelease:

init:
     [echo] Creating DavMail 6.2.2 dist package
     [echo] Java 1.8 and JavaFX available

compile-java:

compile:

jar:
   [delete] Deleting directory C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
    [mkdir] Created dir: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
      [jar] Building jar: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davma
il.jar

prepare-dist:
     [copy] Copying 24 files to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\lib
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\lib\log4j-1.2.17.jar
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist

dist:
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-6.2.2-trunk.zip
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-6.2.2-trunk-windows-noinstall.zip

download-build-jre:
      [get] Getting: https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=15&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx
      [get] To: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip
      [get] https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=15&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx moved to https://cdn.azul.com/zulu/bin/zulu15.46.17-ca-fx-jdk15.0.10-win_x64.zip
    [unzip] Expanding: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip into C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdk
   [delete] Deleting: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip

     [echo] Create custom jre
   [delete] Deleting directory C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdk
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-6.2.2-trunk-windows-standalone.zip

dist-nsis:
     [nsis] Successfully compiled script C:\Downloads\DavMailSelfe\davmail-src-6.2.2\davmail-setup.nsi
     [nsis] Successfully compiled script C:\Downloads\DavMailSelfe\davmail-src-6.2.2\davmail-setup64.nsi

dist-deb:
      [deb] Building tar: C:\Users\rhartm2m\AppData\Local\Temp\deb3767945429265513035.dir\data.tar.gz
      [deb] Building tar: C:\Users\rhartm2m\AppData\Local\Temp\deb3767945429265513035.dir\control.tar.gz
      [deb] Writing deb file to: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail_6.2.2-trunk-1_all.deb

dist-osx:
     [copy] Copying 22 files to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\DavMail.app\Contents\Java
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\DavMail.app\Contents\Resources
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\DavMail.app\Contents\MacOS
     [copy] Copying 1 file to C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\DavMail.app\Contents
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\DavMail-MacOSX-6.2.2-trunk.app.zip
      [tar] Building tar: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-src-6.2.2-trunk.tgz
      [tar] Building tar: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-srconly-6.2.2-trunk.tgz

BUILD SUCCESSFUL
Total time: 1 minute 56 seconds

C:\Downloads\DavMailSelfe\davmail-src-6.2.2>

But sadly the Davmail log contains



2024-12-12 11:44:43,031 INFO  [AWT-EventQueue-0] davmail  - DavMail Gateway 6.2.2-trunk listening on CALDAV port 1080 
2024-12-12 11:44:43,032 DEBUG [CheckRelease] davmail.http.HttpClientAdapter  - GET https://davmail.sourceforge.net/version.txt
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.impl.conn.BasicHttpClientConnectionManager  - Get connection for route {s}->https://davmail.sourceforge.net:443
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-1: set socket timeout to 0
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://davmail.sourceforge.net:443
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to davmail.sourceforge.net/104.18.13.149:443
2024-12-12 11:44:43,032 DEBUG [CheckRelease] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to davmail.sourceforge.net/104.18.13.149:443 with timeout 10000
2024-12-12 11:44:43,040 DEBUG [CheckRelease] davmail.http.DavGatewaySSLSocketFactory  - createSocket davmail.sourceforge.net 443
2024-12-12 11:44:43,041 DEBUG [CheckRelease] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-12 11:44:43,041 DEBUG [CheckRelease] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-12 11:44:43,041 DEBUG [CheckRelease] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-12 11:44:43,058 DEBUG [CheckRelease] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-1: Shutdown connection
2024-12-12 11:44:43,059 DEBUG [CheckRelease] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-12 11:44:43,059 DEBUG [CheckRelease] org.apache.http.impl.conn.BasicHttpClientConnectionManager  - Releasing connection [Not bound]
2024-12-12 11:44:43,059 DEBUG [CheckRelease] davmail  - Unable to get released version
2024-12-12 11:44:47,801 DEBUG [davmail.caldav.CaldavServer] davmail  - Connection from /127.0.0.1 on port 1080
2024-12-12 11:44:47,805 INFO  [davmail.caldav.CaldavServer] davmail.connection  - CONNECT - 127.0.0.1:64967 
[...]
2024-12-12 11:44:57,859 DEBUG [CaldavConnection-64971] davmail.exchange.ExchangeSession  - OWA authentication in EWS mode
2024-12-12 11:44:57,867 DEBUG [CaldavConnection-64971] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-12 11:44:57,867 DEBUG [CaldavConnection-64971] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-12 11:44:57,868 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection request: [route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-12 11:44:57,868 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection leased: [id: 0][route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-12 11:44:57,869 DEBUG [CaldavConnection-64971] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://OWASERVER.DOMAIN.TLD:443
2024-12-12 11:44:57,871 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to OWASERVER.DOMAIN.TLD/SERVER_IP:443
2024-12-12 11:44:57,871 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to OWASERVER.DOMAIN.TLD/SERVER_IP:443 with timeout 10000
2024-12-12 11:44:57,873 DEBUG [CaldavConnection-64971] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWASERVER.DOMAIN.TLD 443
2024-12-12 11:44:57,873 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-12 11:44:57,873 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-12 11:44:57,873 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-12 11:44:57,881 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-2: Shutdown connection
2024-12-12 11:44:57,881 DEBUG [CaldavConnection-64971] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-12 11:44:57,881 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 0][route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-12 11:44:57,881 DEBUG [CaldavConnection-64971] davmail.http.HttpClientAdapter  - Creating NTCredentials for user [email protected] workstation pc-2m69 domain 
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] davmail.http.HttpClientAdapter  - GET https://OWASERVER.DOMAIN.TLD/
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection request: [route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection leased: [id: 1][route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-12 11:44:57,883 DEBUG [CaldavConnection-64971] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://OWASERVER.DOMAIN.TLD:443
2024-12-12 11:44:57,884 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to OWASERVER.DOMAIN.TLD/SERVER_IP:443
2024-12-12 11:44:57,884 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to OWASERVER.DOMAIN.TLD/SERVER_IP:443 with timeout 10000
2024-12-12 11:44:57,885 DEBUG [CaldavConnection-64971] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWASERVER.DOMAIN.TLD 443
2024-12-12 11:44:57,886 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-12 11:44:57,886 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-12 11:44:57,886 DEBUG [CaldavConnection-64971] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-12 11:44:57,893 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-3: Shutdown connection
2024-12-12 11:44:57,893 DEBUG [CaldavConnection-64971] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-12 11:44:57,893 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 1][route: {s}->https://OWASERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-12 11:44:57,893 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager is shutting down
2024-12-12 11:44:57,893 DEBUG [CaldavConnection-64971] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager shut down
2024-12-12 11:44:57,893 ERROR [CaldavConnection-64971] davmail.exchange.ExchangeSession  - Exchange login exception: Received fatal alert: handshake_failure
2024-12-12 11:44:57,894 ERROR [CaldavConnection-64971] davmail  - Exchange login exception: Received fatal alert: handshake_failure
davmail.exception.DavMailException: Exchange login exception: Received fatal alert: handshake_failure
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:199)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

@esabol
Copy link
Author

esabol commented Dec 12, 2024

@ifrh wrote:

I changed that line localy and build from source code:
Sadly the handshake_failure remains.

Ah, sorry, it didn't work. Thanks for trying it.

@ifrh
Copy link

ifrh commented Dec 14, 2024

grafik
Enabled cipher suites on server as shown in above testoutput generated by https://testconnectivity.microsoft.com

 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

Used cipher suites by DavMail in own build using changes mentioned in #375 (comment)

2024-12-12 11:44:57,873 DEBUG [CaldavConnection-64971]   org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:
[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, 
TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, 
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, 
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, 
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, 
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, 
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, 
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 
TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 
TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, 
TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, 
TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, 
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]

If I don't have overlook something : No match available.

@esabol
Copy link
Author

esabol commented Dec 14, 2024

If I don't have overlook something : No match available.

What version of Java (JDK) do you have installed? You might need Java 13 for those ciphers? See https://www.java.com/en/configure_crypto.html

@ifrh
Copy link

ifrh commented Dec 15, 2024

I have multiple JDK installed on my windows machine.

The lines of build output - complete see above in #375 (comment) - let me think, that JDK 15 is used.

download-build-jre:
      [get] Getting: https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=15&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx
      [get] To: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip
      [get] https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=15&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx moved to https://cdn.azul.com/zulu/bin/zulu15.46.17-ca-fx-jdk15.0.10-win_x64.zip
    [unzip] Expanding: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip into C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdk
   [delete] Deleting: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdkfx.zip

     [echo] Create custom jre
   [delete] Deleting directory C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\jdk
      [zip] Building zip: C:\Downloads\DavMailSelfe\davmail-src-6.2.2\dist\davmail-6.2.2-trunk-windows-standalone.zip

@ifrh
Copy link

ifrh commented Dec 15, 2024

What version of Java (JDK) do you have installed? You might need Java 13 for those ciphers? See https://www.java.com/en/configure_crypto.html

Access Denied
You don't have permission to access "http://www.java.com/en/configure_crypto.html" on this server.

Reference #18.8fb10f17.1734260275.34286122

https://errors.edgesuite.net/18.8fb10f17.1734260275.34286122

@ifrh
Copy link

ifrh commented Dec 15, 2024

What version of Java (JDK) do you have installed? You might need Java 13 for those ciphers? See https://www.java.com/en/configure_crypto.html

Access Denied You don't have permission to access "http://www.java.com/en/configure_crypto.html" on this server.

Reference #18.8fb10f17.1734260275.34286122

https://errors.edgesuite.net/18.8fb10f17.1734260275.34286122

But there is an information site, which points to the same URLs, so perhaps java.com has some trouble at current time.

Release Note: Enable TLSv1.3 by Default on JDK 8 for Client Roles
https://bugs.openjdk.org/browse/JDK-8282859
Resolution: Delivered
Fix Version/s: 8u341

@ifrh
Copy link

ifrh commented Dec 15, 2024

[...] You might need Java 13 for those ciphers?[...]

Found a bugreport https://bugs.openjdk.org/browse/JDK-8257825
where is mentioned, that
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 have problems by regression,
and fixed in JDK 17.

So DavMails build-script should use JDK 17 / JRE 17 or at least give an option, to use systemwide installed JDK/JRE without downloading it from api.azul.com .

@esabol
Copy link
Author

esabol commented Dec 15, 2024

@ifrh : That java.com URL works for me. Try it with a different browser, like Firefox or Chrome.

So DavMails build-script should use JDK 17 / JRE 17 or at least give an option, to use systemwide installed JDK/JRE without downloading it from api.azul.com .

I think the non-standalone version of DavMail will use the systemwide JDK when executed.

Regardless, you can edit the build.xml file and change lines 556 and 545 from where it says "jdk_version=15" to "jdk_version=17" or whatever version you want.

@ifrh
Copy link

ifrh commented Dec 15, 2024

@esabol you wrote

That java.com URL works for me. Try it with a different browser, like Firefox or Chrome.

@esabol : Which browser did you use. I did it with Firefox
grafik

@esabol
Copy link
Author

esabol commented Dec 15, 2024

@ifrh : The error mentioned "edgesuite", so I thought you were using Microsoft Edge.

I've tested the URL in Firefox, Chrome, and Safari (iOS). It works in all of them. It must be your computer.

@ifrh
Copy link

ifrh commented Dec 20, 2024

@esabol : I've build DavMail with changes in build.xml , keeping the change for enabling TLSv1.3 in davmail/src/java/davmail/http/HttpClientAdapter.java as
static final String[] SUPPORTED_PROTOCOLS = new String[]{"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"};
I changed in build.xml line 545 and line 556 to jdk_version=21
I got build warnings because of code elements which are deprecated for removal.
And the davmail - Exchange login exception: Received fatal alert: handshake_failure remains.

DavMail did not try to use
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

Here the build output


Microsoft Windows [Version 10.0.19045.5247]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\user>cd C:\Tools\build

C:\Tools\build>set PATH=C:\Tools\build\NSIS;C:\Tools\build\apache-maven-3.9.9\bin;C:\Tools\build\apache-ant-1.10.15\bin;C:\Tools\build\NSIS;C:\Program Files\Java\jdk-21\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin

C:\Tools\build>echo %date% %time%  & tzutil /g
20.12.2024 14:26:39,90
W. Europe Standard Time
C:\Tools\build>java --version
java 21.0.5 2024-10-15 LTS
Java(TM) SE Runtime Environment (build 21.0.5+9-LTS-239)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.5+9-LTS-239, mixed mode, sharing)

C:\Tools\build>javac --version
javac 21.0.5

C:\Tools\build>ant -version
Apache Ant(TM) version 1.10.15 compiled on August 25 2024

C:\Tools\build>cd davmail-src-6.2.2-3546

C:\Tools\build\davmail-src-6.2.2-3546>ant
Buildfile: C:\Tools\build\davmail-src-6.2.2-3546\build.xml

check-encoding:

check-java8:

svnrelease:

gitsvnrelease:

defaultrelease:

init:
     [echo] Creating DavMail 6.2.2 dist package
     [echo] Java 21 and JavaFX missing
    [mkdir] Created dir: C:\Tools\build\davmail-src-6.2.2-3546\target\classes

compile-java:
    [javac] Compiling 168 source files to C:\Tools\build\davmail-src-6.2.2-3546\target\classes
    [javac] Warnung: [options] Bootstrap Classpath nicht zusammen mit -source 8 festgelegt
    [javac] Warnung: [options] Quellwert 8 ist veraltet und wird in einem zukünftigen Release entfernt
    [javac] Warnung: [options] Zielwert 8 ist veraltet und wird in einem zukünftigen Release entfernt
    [javac] Warnung: [options] Verwenden Sie -Xlint:-options, um Warnungen zu veralteten Optionen zu unterdrücken.
    [javac] C:\Tools\build\davmail-src-6.2.2-3546\src\java\davmail\http\DavMailSPNegoScheme.java:123: Warnung: [removal] <T>doAs(Subject,PrivilegedAction<T>) in Subject ist veraltet und wurde zum Entfernen markiert
    [javac]         return Subject.doAs(clientLoginContext.getSubject(), (PrivilegedAction<Object>) () -> {
    [javac]                       ^
    [javac]   Dabei ist T eine Typvariable:
    [javac]     T erweitert Object, deklariert in Methode <T>doAs(Subject,PrivilegedAction<T>)
    [javac] C:\Tools\build\davmail-src-6.2.2-3546\src\java\davmail\http\KerberosHelper.java:201: Warnung: [removal] <T>doAs(Subject,PrivilegedAction<T>) in Subject ist veraltet und wurde zum Entfernen markiert
    [javac]         return Subject.doAs(clientLoginContext.getSubject(), (PrivilegedAction<Object>) () -> {
    [javac]                       ^
    [javac]   Dabei ist T eine Typvariable:
    [javac]     T erweitert Object, deklariert in Methode <T>doAs(Subject,PrivilegedAction<T>)
    [javac] C:\Tools\build\davmail-src-6.2.2-3546\src\java\davmail\http\KerberosHelper.java:286: Warnung: [removal] <T>doAs(Subject,PrivilegedAction<T>) in Subject ist veraltet und wurde zum Entfernen markiert
    [javac]         Object result = Subject.doAs(serverLoginContext.getSubject(), (PrivilegedAction<Object>) () -> {
    [javac]                                ^
    [javac]   Dabei ist T eine Typvariable:
    [javac]     T erweitert Object, deklariert in Methode <T>doAs(Subject,PrivilegedAction<T>)
    [javac] Hinweis: Einige Eingabedateien verwenden oder überschreiben eine veraltete API.
    [javac] Hinweis: Wiederholen Sie die Kompilierung mit -Xlint:deprecation, um Details zu erhalten.
    [javac] Hinweis: C:\Tools\build\davmail-src-6.2.2-3546\src\java\davmail\ui\tray\SwtGatewayTray.java verwendet nicht geprüfte oder unsichere Vorgänge.
    [javac] Hinweis: Wiederholen Sie die Kompilierung mit -Xlint:unchecked, um Details zu erhalten.
    [javac] 7 Warnungen

compile:
     [copy] Copying 23 files to C:\Tools\build\davmail-src-6.2.2-3546\target\classes

jar:
    [mkdir] Created dir: C:\Tools\build\davmail-src-6.2.2-3546\dist
      [jar] Building jar: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail.jar

prepare-dist:
     [copy] Copying 24 files to C:\Tools\build\davmail-src-6.2.2-3546\dist\lib
      [zip] Building zip: C:\Tools\build\davmail-src-6.2.2-3546\dist\lib\log4j-1.2.17.jar
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist

dist:
      [zip] Building zip: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail-6.2.2-trunk.zip
      [zip] Building zip: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail-6.2.2-trunk-windows-noinstall.zip

download-build-jre:
      [get] Getting: https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=21&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx
      [get] To: C:\Tools\build\davmail-src-6.2.2-3546\dist\jdkfx.zip
      [get] https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=21&ext=zip&os=windows&arch=x86&hw_bitness=64&bundle_type=jdk&features=fx moved to https://cdn.azul.com/zulu/bin/zulu21.38.21-ca-fx-jdk21.0.5-win_x64.zip
    [unzip] Expanding: C:\Tools\build\davmail-src-6.2.2-3546\dist\jdkfx.zip into C:\Tools\build\davmail-src-6.2.2-3546\dist\jdk
   [delete] Deleting: C:\Tools\build\davmail-src-6.2.2-3546\dist\jdkfx.zip
     [echo] Create custom jre
   [delete] Deleting directory C:\Tools\build\davmail-src-6.2.2-3546\dist\jdk
      [zip] Building zip: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail-6.2.2-trunk-windows-standalone.zip

dist-nsis:
     [nsis] Successfully compiled script C:\Tools\build\davmail-src-6.2.2-3546\davmail-setup.nsi
     [nsis] Successfully compiled script C:\Tools\build\davmail-src-6.2.2-3546\davmail-setup64.nsi

dist-deb:
      [deb] Building tar: C:\Users\user\AppData\Local\Temp\deb1814298945997039155.dir\data.tar.gz
      [deb] Building tar: C:\Users\user\AppData\Local\Temp\deb1814298945997039155.dir\control.tar.gz
      [deb] Writing deb file to: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail_6.2.2-trunk-1_all.deb

dist-osx:
     [copy] Copying 22 files to C:\Tools\build\davmail-src-6.2.2-3546\dist\DavMail.app\Contents\Java
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist\DavMail.app\Contents\Resources
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist\DavMail.app\Contents\MacOS
     [copy] Copying 1 file to C:\Tools\build\davmail-src-6.2.2-3546\dist\DavMail.app\Contents
      [zip] Building zip: C:\Tools\build\davmail-src-6.2.2-3546\dist\DavMail-MacOSX-6.2.2-trunk.app.zip
      [tar] Building tar: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail-src-6.2.2-trunk.tgz
      [tar] Building tar: C:\Tools\build\davmail-src-6.2.2-3546\dist\davmail-srconly-6.2.2-trunk.tgz

BUILD SUCCESSFUL
Total time: 2 minutes 30 seconds

C:\Tools\build\davmail-src-6.2.2-3546>

And here the DavMail log:

2024-12-20 14:43:31,881 DEBUG [CaldavConnection-61240] davmail.exchange.ExchangeSession  - OWA authentication in EWS mode
2024-12-20 14:43:31,893 DEBUG [CaldavConnection-61240] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-20 14:43:31,893 DEBUG [CaldavConnection-61240] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-20 14:43:31,893 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection request: [route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-20 14:43:31,893 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection leased: [id: 0][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-20 14:43:31,893 DEBUG [CaldavConnection-61240] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://OWA-SERVER.DOMAIN.TLD:443
2024-12-20 14:43:31,906 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to OWA-SERVER.DOMAIN.TLD/IP-ADDRESS:443
2024-12-20 14:43:31,906 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to OWA-SERVER.DOMAIN.TLD/IP-ADDRESS:443 with timeout 10000
2024-12-20 14:43:31,906 DEBUG [CaldavConnection-61240] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWA-SERVER.DOMAIN.TLD 443
2024-12-20 14:43:31,912 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-20 14:43:31,912 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-20 14:43:31,912 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-2: Shutdown connection
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 0][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] davmail.http.HttpClientAdapter  - Creating NTCredentials for user [email protected] workstation T14 domain 
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] davmail.http.HttpClientAdapter  - GET https://OWA-SERVER.DOMAIN.TLD/EWS
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected: default
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in the context
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection request: [route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection leased: [id: 1][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.execchain.MainClientExec  - Opening connection {s}->https://OWA-SERVER.DOMAIN.TLD:443
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connecting to OWA-SERVER.DOMAIN.TLD/IP-ADDRESS:443
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Connecting socket to OWA-SERVER.DOMAIN.TLD/IP-ADDRESS:443 with timeout 10000
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWA-SERVER.DOMAIN.TLD 443
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-20 14:43:31,915 DEBUG [CaldavConnection-61240] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-20 14:43:31,935 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-3: Shutdown connection
2024-12-20 14:43:31,935 DEBUG [CaldavConnection-61240] org.apache.http.impl.execchain.MainClientExec  - Connection discarded
2024-12-20 14:43:31,935 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 1][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 20]
2024-12-20 14:43:31,935 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager is shutting down
2024-12-20 14:43:31,935 DEBUG [CaldavConnection-61240] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager shut down
2024-12-20 14:43:31,935 ERROR [CaldavConnection-61240] davmail.exchange.ExchangeSession  - Exchange login exception: Received fatal alert: handshake_failure
2024-12-20 14:43:31,935 ERROR [CaldavConnection-61240] davmail  - Exchange login exception: Received fatal alert: handshake_failure
davmail.exception.DavMailException: Exchange login exception: Received fatal alert: handshake_failure
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:199)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

@esabol
Copy link
Author

esabol commented Dec 20, 2024

@iRFH wrote:

DavMail did not try to use
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

The Java documentation says that Java 17+ supports those ciphers, so that doesn't make any sense to me. I doubt this is a DavMail problem. I suspect it's something with your operating system or your Java configuration. To determine that, please try compiling the following simple Java code (save it to a file named SSLPoke.java, compile with javac SSLPoke.java, and execute it using java SSLPoke your.server.host 443) using Java 21 and test your connection to your server with this:

import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;

/** Establish a SSL connection to a host and port, writes a byte and
 * prints the response. See
 * http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
 */
public class SSLPoke {
    public static void main(String[] args) {
        if (args.length != 2) {
            System.out.println("Usage: "+SSLPoke.class.getName()+" <host> <port>");
            System.exit(1);
        }
        try {
            SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
            SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(args[0], Integer.parseInt(args[1]));

            SSLParameters sslparams = new SSLParameters();
            sslparams.setEndpointIdentificationAlgorithm("HTTPS");
            sslsocket.setSSLParameters(sslparams);

            InputStream in = sslsocket.getInputStream();
            OutputStream out = sslsocket.getOutputStream();

            // Write a test byte to get a reaction :)
            out.write(1);

            while (in.available() > 0) {
                System.out.print(in.read());
            }
            System.out.println("Successfully connected");

        } catch (Exception exception) {
            exception.printStackTrace();
            System.exit(1);
        }
    }
}

@ifrh
Copy link

ifrh commented Dec 21, 2024

Well some copy&paste errors ...

C:\Tools\build\ssltest>java --version
java 21.0.5 2024-10-15 LTS
Java(TM) SE Runtime Environment (build 21.0.5+9-LTS-239)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.5+9-LTS-239, mixed mode, sharing)

C:\Tools\build\ssltest>javac --version
javac 21.0.5

C:\Tools\build\ssltest>javac sslpoke.java
sslpoke.java:18: Fehler: ')' oder ',' erwartet
            SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(args[0], Integer.parseInt(ar
                                                                                                        ^
sslpoke.java:19: Fehler: Keine Anweisung
gs[1]));
  ^
sslpoke.java:19: Fehler: ';' erwartet
gs[1]));
     ^
3 Fehler

After fixing syntax error and renaming file befor compiling:
I got:

C:\Tools\build\ssltest>java SSLPoke
Usage: SSLPoke <host> <port>

C:\Tools\build\ssltest>java SSLPoke OWA-SERVER.DOMAIN.TLD 443
Successfully connected

@esabol
Copy link
Author

esabol commented Dec 21, 2024

Well, that's interesting!

@ifrh
Copy link

ifrh commented Dec 21, 2024

perhaps some lines in build.xml are the lines which are the reason.

<javac srcdir="src/java" destdir="target/classes" source="9" debug="on" encoding="UTF-8"

<javac srcdir="src/java" destdir="target/classes" source="1.8" target="1.8" debug="on" encoding="UTF-8"

<compilerarg value="java.base/sun.net.www.protocol.https=ALL-UNNAMED"/>

@ifrh
Copy link

ifrh commented Dec 22, 2024

Well I changed those source and targed information, mentioned in #375 (comment) , to value 21.

And I decide to not start davmail via exe. but start davmail via calling jar file directly from cmd.

The handshake worked! But later an other Exception rises.

2024-12-22 11:41:44,277 DEBUG [CaldavConnection-56361] davmail.http.DavGatewaySSLSocketFactory  - createSocket OWA-SERVER.DOMAIN.TLD 443
2024-12-22 11:41:44,277 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
2024-12-22 11:41:44,277 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2024-12-22 11:41:44,277 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Starting handshake
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  - Secure session established
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  -  negotiated protocol: TLSv1.3
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  -  negotiated cipher suite: TLS_AES_256_GCM_SHA384
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  -  peer principal: CN=OWA-SERVER.DOMAIN.TLD, O=ORGANIZATION, ST=state, C=TLD
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  -  peer alternative names: [OWA-SERVER.DOMAIN.TLD, attachment.OWA-SERVER.DOMAIN.TLD, autodiscover.DOMAIN.TLD,  exchange.DOMAIN.TLD, imaps.DOMAIN.TLD, mobile.DOMAIN.TLD, smtps.DOMAIN.TLD]
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.conn.ssl.SSLConnectionSocketFactory  -  issuer principal: CN=GEANT OV RSA CA 4, O=GEANT Vereniging, C=NL
2024-12-22 11:41:44,377 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator  - Connection established MY-IP-ADDRESS:56362<->OWA-IP-ADDRESS:443

So SSL-Handshake work starting via java -jar davmail.jar

But login failed. Perhaps I should query an other entry point?

2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "GET /EWS HTTP/1.1[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "Host: OWA-SERVER.DOMAIN.TLD[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.49[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "Authorization: Basic SOME-CRYPTIC-STRING==[\r][\n]"
2024-12-22 11:41:44,475 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 >> "[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "Cache-Control: private[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "Content-Type: text/html; charset=utf-8[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "Server: Microsoft-IIS/10.0[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "request-id: SOME-CRYPTIC-STRING[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "X-CalculatedBETarget: ex4.DOMAIN.local[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "X-AspNet-Version: 4.0.30319[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "X-Powered-By: ASP.NET[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "X-FEServer: EX1[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "Date: Sun, 22 Dec 2024 10:41:44 GMT[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "Content-Length: 109[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "[\r][\n]"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.wire  - http-outgoing-1 << "NegotiateSecurityContext failed with for host \u0027ex4.DOMAIN.local\u0027 with status \u0027LogonDenied\u0027"
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << HTTP/1.1 500 Internal Server Error
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << Cache-Control: private
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << Content-Type: text/html; charset=utf-8
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << Server: Microsoft-IIS/10.0
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << request-id: SOME-CRYPTIC-STRING
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << X-CalculatedBETarget: ex4.DOMAIN.local
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << X-AspNet-Version: 4.0.30319
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << X-Powered-By: ASP.NET
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << X-FEServer: EX1
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << Date: Sun, 22 Dec 2024 10:41:44 GMT
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.headers  - http-outgoing-1 << Content-Length: 109
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.impl.execchain.MainClientExec  - Connection can be kept alive indefinitely
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.impl.auth.HttpAuthenticator  - Authentication succeeded
2024-12-22 11:41:44,540 DEBUG [CaldavConnection-56361] org.apache.http.impl.client.TargetAuthenticationStrategy  - Caching 'basic' auth scheme for https://OWA-SERVER.DOMAIN.TLD:443
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection [id: 0][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443] can be kept alive indefinitely
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-1: set socket timeout to 0
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection released: [id: 0][route: {s}->https://OWA-SERVER.DOMAIN.TLD:443][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 20]
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager is shutting down
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.DefaultManagedHttpClientConnection  - http-outgoing-1: Close connection
2024-12-22 11:41:44,580 DEBUG [CaldavConnection-56361] org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection manager shut down
2024-12-22 11:41:44,580 ERROR [CaldavConnection-56361] davmail.exchange.ExchangeSession  - Exchange login exception: Internal Server Error
2024-12-22 11:41:44,580 ERROR [CaldavConnection-56361] davmail  - Exchange login exception: Internal Server Error
davmail.exception.DavMailException: Exchange login exception: Internal Server Error
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:199)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

@esabol
Copy link
Author

esabol commented Dec 22, 2024

So SSL-Handshake work starting via java -jar davmail.jar

Great! Now you are using the same Java installation that you used to compile and execute SSLPoke (instead of the "standalone" .exe build), and it makes sense that they would perform identically.

But login failed. Perhaps I should query an other entry point?

Yes, it's possible you just have a configuration problem now and you just need to put the proper settings into your davmail.properties file. There's a new davmail.tld setting, for example. But I'm not sure if that helps here or not. It's also possible DavMail just doesn't support custom endpoints yet. Refer to the following issues: #284 and #341.

Which davmail.mode are you using? O365Manual or something else? Is your O365 instance configured to allow DavMail's clientId? If not, you might need to use Outlook's, like so:

davmail.oauth.clientId=d3590ed6-52b3-4102-aeff-aad2292ab01c
davmail.oauth.redirectUri=urn:ietf:wg:oauth:2.0:oob

@esabol
Copy link
Author

esabol commented Dec 22, 2024

I see @mguessan has made some recent commits to the repository which may be relevant. Make sure the code you are compiling is up-to-date with the latest in the GitHub repository, @ifrh . See https://github.com/mguessan/davmail/commits/master/

You might need to change one or more of the following settings:

# base Exchange OWA or EWS url
davmail.url=https://outlook.office365.com/EWS/Exchange.asmx
# login url, default https://login.microsoftonline.com, China https://login.chinacloudapi.cn
davmail.loginUrl=https://login.microsoftonline.com
# Outlook O365 url, default https://outlook.office365.com, China https://partner.outlook.cn
davmail.outlookUrl=https://outlook.office365.com

@ifrh
Copy link

ifrh commented Dec 22, 2024

Changing in GUI the Setting "OWA or EWS (Exchange) URL"
from https://OWA-SERVER.DOMAIN.TLD/EWS to https://OWA-SERVER.DOMAIN.TLD
davmail was redirected to the loginpage. And davmail detected "Form based authentication".
@esabol : I'll try later again using your mentined "recent commits to the repository".

2024-12-22 14:32:00,401 DEBUG [CaldavConnection-54941] davmail.http.HttpClientAdapter  - Redirect https://OWA-SERVER.DOMAIN.TLD/ to /lm_auth_proxy?DoLMLogin?curl=L2fowa&curlid=SOME-NUMBERS&curlmode=0

And than some lines in logfile later the login page, where I can login via webbrowser is sent to davmail. :


2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "HTTP/1.1 200 OK[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Date: Sun, 22 Dec 2024 13:32:00 GMT[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "X-Frame-Options: SAMEORIGIN[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "X-XSS-Protection: 1; mode=block[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "X-Content-Type-Options: nosniff[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Connection: close[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Pragma: no-cache[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Cache-Control: no-cache,max-age=0,must-revalidate[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Content-Length: 6868 [\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "Content-Type: text/html[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "[\r][\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "<!DOCTYPE html>[\n]"
2024-12-22 14:32:00,515 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "<html>[\n]"
[....]
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << " </tbody>[\n]"
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "</table>[\n]"
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "</form>[\n]"
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "</body>[\n]"
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.wire  - http-outgoing-3 << "</html>[\n]"
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] org.apache.http.headers  - http-outgoing-3 << HTTP/1.1 200 OK
[....]
2024-12-22 14:32:00,533 DEBUG [CaldavConnection-54941] davmail.exchange.ExchangeSession  - Form based authentication detected
[....]
2024-12-22 14:32:00,845 ERROR [CaldavConnection-54941] davmail.exchange.ExchangeSession  - Exchange login exception: Forbidden
2024-12-22 14:32:00,861 ERROR [CaldavConnection-54941] davmail  - Exchange login exception: Forbidden
davmail.exception.DavMailException: Exchange login exception: Forbidden
	at davmail.exchange.auth.ExchangeFormAuthenticator.authenticate(ExchangeFormAuthenticator.java:238)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:208)
	at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:97)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:178)

@ifrh
Copy link

ifrh commented Dec 23, 2024

That's great thank you very much!
Calling davmail64.exe (from standalone) did not work because of handshake failure, but if I call java -jar davmail.jar the connection with TLS 1.3 works (using "recent commits to the repository").

And now I got access to my personal account calendar with the following values in

a) window "DavMail Gateway Setting" :

Exchange Protokoll : Auto
OWA or EWS (Echange) URL : owa-server.domain.tld/EWS/Exchange.asmx

b) window "new calendar" (Thunderbird 128.5.2esr (64-Bit))

username : [email protected]|domain\account
address : http://localhost:1080/

This creates a calendar in thunderbird for
http://localhost:1080/users/[email protected]/calendar/

That is great, thank you for your help and development!

Sadly Thunderbirds autodiscover did not find the shared group calendar.

Should it possible to get access to a shared "group calendar" via davmail, too?

I tried to subscribe the shared calendar as new calendar in Thunderbird two times using differend values as changed address

Both failed with java.io.IOException.

2024-12-23 23:40:05,363 INFO  [CaldavConnection-56908] davmail.connection  - LOGON - 127.0.0.1:56908 [email protected]|domain\account
2024-12-23 23:40:05,364 DEBUG [CaldavConnection-56907] davmail.exchange.ExchangeSession  - Got session davmail.exchange.ews.EwsExchangeSession@24619ddc from cache
2024-12-23 23:40:05,364 ERROR [CaldavConnection-56908] davmail  - Invalid message content: 
java.io.IOException: Invalid message content: 
	at davmail.exchange.ExchangeSession.createOrUpdateItem(ExchangeSession.java:2662)
	at davmail.caldav.CaldavConnection.handleFolderOrItem(CaldavConnection.java:299)
	at davmail.caldav.CaldavConnection.handleRequest(CaldavConnection.java:237)
	at davmail.caldav.CaldavConnection.run(CaldavConnection.java:180)

@esabol
Copy link
Author

esabol commented Dec 23, 2024

@ifrh : I'm glad you have persevered and achieved success!

Did you try http://localhost:1080/users/[email protected]/calendar/ ? I think that's the syntax you want. You can test that URL in your web browser while DavMail is running. The calendar needs to be "fully shared". If it's only partially shared, apparently, there could still be a problem with accessing it.

Seriously, please read the comments at the following issue:

#70 (comment)

Any additional shared calendars on another user's account can be accessed at
http://localhost:1080/users/[email protected]/calendar/another_shared_calendar/

I've also noticed that your language is German. If the language of the other user's shared calendar is not German, you might be encountering this very old bug (which may or may not have been addressed in the last 14 years – no idea!):

https://sourceforge.net/p/davmail/mailman/message/25407720/

@ifrh
Copy link

ifrh commented Dec 23, 2024

http://localhost:1080/users/[email protected]/calendar/
=> worked !

Some warings occure as Windows popup messages , like :

grafik

But as far as I can see the content of both calendars

  • my personal one
  • and the shared one
    all entries which I wanted to see are there.
    In the next days I will do a deeper compair of the content.

And I will think about how to get the standalone version running...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants