Exception thrown after seting up SSL for client to DavMail
Brought to you by:
mguessan
After setting up SSL for Client to DavMail connections DavMail began
throwing connections:
Date: Wed Apr 27 19:29:04 CEST 2022 (1651080544976)
Thread: ImapConnection-53666
Message #: 57
Level: ERROR
NDC:
Category: davmail
Message: Received fatal alert: bad_certificate
Location:
davmail.ui.tray.DavGatewayTray.displayMessage(DavGatewayTray.java:117)
Thrown:
javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
at sun.security.ssl.Alert.createSSLException(Unknown Source)
at sun.security.ssl.Alert.createSSLException(Unknown Source)
at sun.security.ssl.TransportContext.fatal(Unknown Source)
at sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at sun.security.ssl.TransportContext.dispatch(Unknown Source)
at sun.security.ssl.SSLTransport.decode(Unknown Source)
at sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.ensureNegotiated(Unknown Source)
at sun.security.ssl.SSLSocketImpl.access$200(Unknown Source)
at sun.security.ssl.SSLSocketImpl$AppOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at davmail.AbstractConnection.sendClient(AbstractConnection.java:186)
at davmail.AbstractConnection.sendClient(AbstractConnection.java:166)
at davmail.imap.ImapConnection.run(ImapConnection.java:98)
and
Date: Wed Apr 27 19:29:04 CEST 2022 (1651080544976)
Thread: ImapConnection-53666
Message #: 58
Level: WARN
NDC:
Category: davmail
Message: Exception sending error to client Connection or outbound has
closed
Location:
davmail.ui.tray.DavGatewayTray.displayMessage(DavGatewayTray.java:117)
Thrown:
java.net.SocketException: Connection or outbound has closed
at sun.security.ssl.SSLSocketImpl$AppOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at davmail.AbstractConnection.sendClient(AbstractConnection.java:186)
at davmail.AbstractConnection.sendClient(AbstractConnection.java:166)
at davmail.imap.ImapConnection.run(ImapConnection.java:693)
Mail are not loaded from DavMail any more. It just stops working.
Turning SSL off makes it work again.
pkcs12 certificate store and certificates where created using
keytool -genkey -keyalg rsa -keysize 2048 -storepass password -keystore
davmail.p12 -storetype pkcs12 -validity 3650 -dname cn=<fqdn>
DavMail was configured to use:
davmail.ssl.keystoreType=PKCS12
davmail.ssl.keyPass=password
davmail.ssl.keystoreFile=<pathtoinstalleddavmail>\davmail.p12
davmail.ssl.keystorePass=password
Sorry for the late response...
Did you try to access https://localhost:1080 from a web browser to validate that DavMail was able to load certificate ?