davmail icon indicating copy to clipboard operation
davmail copied to clipboard

Exception sending error to client Connection or outbound has closed

Open dannykorpan opened this issue 4 years ago • 1 comments

Hi,

I've setup davmail in server mode with a self signed certificate.

For the SSL certificate I've used this command keytool -genkey -keyalg rsa -keysize 2048 -keystore /opt/davmail/davmail.p12 -storetype pkcs12 -validity 3650 -dname cn=my.server.net,ou=my,o=server,o=net

Here is my davmail.probierties configuration file

# DavMail settings, see http://davmail.sourceforge.net/ for documentation

#############################################################
# Basic settings

# Server or workstation mode
davmail.server=true
# connection mode auto, EWS or WebDav
davmail.mode=EWS
# base Exchange OWA or EWS url
davmail.url=https://outlook.office365.com/EWS/Exchange.asmx

# Listener ports
davmail.caldavPort=1080
davmail.imapPort=1143
davmail.ldapPort=1389
#davmail.popPort=1110
davmail.smtpPort=1025

#############################################################
# Network settings

# Network proxy settings
davmail.enableProxy=false
davmail.useSystemProxies=false
davmail.proxyHost=
davmail.proxyPort=
davmail.proxyUser=
davmail.proxyPassword=

# proxy exclude list
davmail.noProxyFor=

# allow remote connection to DavMail
davmail.allowRemote=true
# bind server sockets to a specific address
davmail.bindAddress=192.168.178.201
# client connection timeout in seconds - default 300, 0 to disable
davmail.clientSoTimeout=

# DavMail listeners SSL configuration
davmail.ssl.keystoreType=PKCS12
davmail.ssl.keystorePass=password
davmail.ssl.keystoreFile=/opt/davmail/davmail.p12
davmail.ssl.keyPass=password

# Accept specified certificate even if invalid according to trust store
#davmail.server.certificate.hash=

# disable SSL for specified listeners
davmail.ssl.nosecurecaldav=false
davmail.ssl.nosecureimap=false
davmail.ssl.nosecureldap=false
davmail.ssl.nosecurepop=false
davmail.ssl.nosecuresmtp=false

# disable update check
davmail.disableUpdateCheck=false

# Send keepalive character during large folder and messages download
davmail.enableKeepalive=true
# Message count limit on folder retrieval
davmail.folderSizeLimit=0
# Default windows domain for NTLM and basic authentication
davmail.defaultDomain=

#############################################################
# Caldav settings

# override default alarm sound
davmail.caldavAlarmSound=
# retrieve calendar events not older than 90 days
davmail.caldavPastDelay=365
# EWS only: enable server managed meeting notifications
davmail.caldavAutoSchedule=true
# WebDav only: force event update to trigger ActiveSync clients update
davmail.forceActiveSyncUpdate=false

#############################################################
# IMAP settings

# Delete messages immediately on IMAP STORE \Deleted flag
davmail.imapAutoExpunge=true
# Enable IDLE support, set polling delay in minutes
davmail.imapIdleDelay=1
# Always reply to IMAP RFC822.SIZE requests with Exchange approximate message size for performance reas>
davmail.imapAlwaysApproxMsgSize=

#############################################################
# POP settings

# Delete messages on server after 30 days
davmail.keepDelay=30
# Delete messages in server sent folder after 90 days
davmail.sentKeepDelay=90
# Mark retrieved messages read on server
davmail.popMarkReadOnRetr=false

#############################################################
# SMTP settings

# let Exchange save a copy of sent messages in Sent folder
davmail.smtpSaveInSent=true

#############################################################
# Loggings settings

# log file path, leave empty for default path
davmail.logFilePath=/var/log/davmail.log
# maximum log file size, use Log4J syntax, set to 0 to use an external rotation mechanism, e.g. logrota>
davmail.logFileSize=1MB
# log levels
log4j.logger.davmail=WARN
log4j.logger.httpclient.wire=WARN
log4j.logger.org.apache.commons.httpclient=WARN
log4j.rootLogger=WARN

#############################################################
# Workstation only settings

# smartcard access settings
davmail.ssl.pkcs11Config=
davmail.ssl.pkcs11Library=

# SSL settings for mutual authentication
davmail.ssl.clientKeystoreType=
davmail.ssl.clientKeystoreFile=
davmail.ssl.clientKeystorePass=

# disable all balloon notifications
davmail.disableGuiNotifications=true
# disable tray icon color switch on activity
davmail.disableTrayActivitySwitch=true
# disable startup balloon notifications
davmail.showStartupBanner=false

# enable transparent client Kerberos authentication
davmail.enableKerberos=false

But once I've start davmail with davmail /etc/davmail.properties

I've got the following error as soon as an imap client tries to connect to davmail server 2020-10-20 20:39:24,027 WARN [ImapConnection-56181] davmail - Exception sending error to client Connection or outbound has closed java.net.SocketException: Connection or outbound has closed at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1190) at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) at davmail.AbstractConnection.sendClient(AbstractConnection.java:186) at davmail.AbstractConnection.sendClient(AbstractConnection.java:166) at davmail.imap.ImapConnection.run(ImapConnection.java:678)

Are there any hints or a solution for my problem?

Kind Regards, Danny

dannykorpan avatar Oct 20 '20 18:10 dannykorpan

Need more info on the client side to investigate.

You can check your DavMail configuration with:

openssl s_client -connect 192.168.178.201:1080

mguessan avatar Nov 28 '20 09:11 mguessan