kran0 / davmail-docker Goto Github PK
View Code? Open in Web Editor NEWDockerfile for DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange Gateway
License: GNU General Public License v2.0
Dockerfile for DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange Gateway
License: GNU General Public License v2.0
I'm using connectical/davmail:6.0.1
which is working fine but I wanted to find a more recent image, so trying with:
davmail:
image: kran0/davmail-docker:6.2.0
hostname: davmail
container_name: davmail
restart: always
volumes:
- ./davmail.properties:/davmail/davmail.properties
ports:
- "1025:1025"
- "1389:1389"
- "1110:1110"
- "1143:1143"
- "1080:1080"
The davmail.properties
is the one that was working with the previous image.
But as soon as I try to fetch mail I get a java exception:
davmail | 2024-01-04 17:50:42,934 ERROR [ImapConnection-57066] davmail - Authentication failed: invalid user or password
davmail | davmail.exception.DavMailAuthenticationException: Authentication failed: invalid user or password
davmail | at davmail.exchange.ews.EwsExchangeSession.checkEndPointUrl(EwsExchangeSession.java:228)
davmail | at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:237)
davmail | at davmail.exchange.ews.EwsExchangeSession.<init>(EwsExchangeSession.java:176)
davmail | at davmail.exchange.ews.EwsExchangeSession.<init>(EwsExchangeSession.java:205)
davmail | at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:192)
davmail | at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93)
davmail | at davmail.imap.ImapConnection.run(ImapConnection.java:155)
So not sure where to look. Any help welcome. I'm attaching the properties file (slightly redacted).
I need to configure the https listener vor carddav and seems to be not working:
compose.yaml:
version: '3'
services:
davmail:
image: kran0/davmail-docker:latest
hostname: davmail
volumes:
- /share/VirtualMachine/Container/DavMail/config:/davmail-config # To save persistent conf data
environment:
- DAVMAIL_SERVER=true
- DAVMAIL_ALLOWREMOTE=true
- DAVMAIL_DISABLEUPDATECHECK=true
- DAVMAIL_LOGFILEPATH=/dev/stdout
- DAVMAIL_CALDAVPORT=1080
- DAVMAIL_IMAPPORT=1143
- DAVMAIL_LDAPPORT=1389
- DAVMAIL_POPPORT=1110
- DAVMAIL_SMTPPORT=1025
- JAVA_OPTS=-Xmx512M -Dsun.net.inetaddr.ttl=30
# - DISABLE_DAVMAIL_PROPERTIES_PERSISTENCE=true
ports:
- 1080:1080
- 1143:1143
- 1389:1389
- 1110:1110
- 1025:1025
restart: on-failure
networks:
vlan:
ipv4_address: 172.16.10.99
volumes:
davmail-config:
networks:
vlan:
driver: macvlan
driver_opts:
parent: eth3.10 # schema is {INTERFACE}.{VLAN ID}
ipam:
driver: default
config:
- subnet: 172.16.10.0/24
gateway: 172.16.10.1
Files in - /share/VirtualMachine/Container/DavMail/config:/davmail-config
davmail.properties
davmail.p12
davmail.properties:
# DavMail listeners SSL configuration
davmail.ssl.keystoreType=PKCS12
davmail.ssl.keystoreFile=davmail.p12
davmail.ssl.keystorePass=password
davmail.ssl.keyPass=password
Log, if I try to request from the client:
2024-02-21 16:23:02,780 ERROR [CaldavConnection-53953] davmail - Invalid header, HTTPS connection to an HTTP listener ?
davmail.exception.DavMailException: Invalid header, HTTPS connection to an HTTP listener ?
at davmail.caldav.CaldavConnection.parseHeaders(CaldavConnection.java:108)
at davmail.caldav.CaldavConnection.run(CaldavConnection.java:163)
The key was generated by with:
keytool -genkey -keyalg rsa -keysize 2048 -storepass password -keystore davmail.p12 -storetype
pkcs12 -validity 3650 -dname cn=davmailhostname.company.com,ou=davmail,o=sf,o=net
direclley in davmail
The problem:
Accordong to the Dockerfile
the build process is repeated for all architectures.
It is cool, because we are testing build toolset for all archs every time,
but it is not cool because it is useless for java.
We are to build once and just copy result to any of JRE installation, not rebuild it every time.
And it slows the build time because of building many times and building using qemu.
And the problem number 2 is: That currently built jar is tested after push procedure and only as one build result (for default arch, which is x86_64 for github build infrastructure).
So, TODO is replace current build+test mechanism with new clean one. Fixing this problems.
The problem is: SSL-enabled case is not covered by tests, and is not very tricky. But many users asking if the case is implemented and how to use it.
TODO:
https://github.com/kran0/davmail-docker/tags is missing the tags for the recent DavMail releases, 6.1.0, 6.2.0, and 6.2.1.
Looks like your latest Dockerfile is using DavMail 6.1.0?
Hi, I've been struggling with an error related to Davmail SSL and found a solution, but since others might find the same error I thought I'd document it here.
I'm using docker-compose, pretty much like the sample, but with the relevant SSL settings. For good measure, here it is completely (albeit with a default password password
):
#!/usr/bin/env -S docker-compose -f
services:
davmail:
image: kran0/davmail-docker:latest
environment:
- DAVMAIL_SERVER=true
- DAVMAIL_URL=https://outlook.office365.com/EWS/Exchange.asmx # Not sure if this is needed
- DAVMAIL_CALDAVPORT=1080
- DAVMAIL_IMAPPORT=1143
- DAVMAIL_LDAPPORT=1389
- DAVMAIL_POPPORT=1110
- DAVMAIL_SMTPPORT=1025
- DAVMAIL_ALLOWREMOTE=true
- DAVMAIL_DISABLEUPDATECHECK=true
- DAVMAIL_LOGFILEPATH=/dev/stdout
- DAVMAIL_SSL_KEYSTORETYPE=PKCS12
- DAVMAIL_SSL_KEYSTOREFILE=/etc/davmail/davmail.p12
- DAVMAIL_SSL_KEYSTOREPASS=password
- DAVMAIL_SSL_KEYPASS=password
ports:
- 1080:1080
- 1143:1143
- 1389:1389
- 1110:1110
- 1025:1025
volumes:
- /mnt/apps/davmail:/etc/davmail
restart: on-failure
Note the volume mnt/apps/davmail:/etc/davmail
, and the Docker environment setting DAVMAIL_SSL_KEYSTOREFILE
. If you get a similar but different error, where it complains about a missing davmail.p12 file, make sure that you put the correct file in the correct spot, and ensure that Docker can read it. Please ensure that it isn't globally readable though!
Anyhow, back to my error. I generated the davmail.p12
according to the excellent davmail docs. keytool
wasn't installed on my machine, so I installed openjdk-18-jre-headless
(Debian), which includes it.
When starting the Docker container, I got the following output:
$ docker-compose --env-file .env up
Recreating davmail_davmail_1 ... done
Attaching to davmail_davmail_1
davmail_1 | 2022-10-13 15:28:38,363 ERROR [main] davmail - Unable to bind server socket for SMTP on port 1025: Exception creating secured server socket : parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 4
8)Unable to bind server socket for POP on port 1110: Exception creating secured server socket : parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)Unable to bind server socket for IMAP on port 1143: Except
ion creating secured server socket : parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)Unable to bind server socket for CALDAV on port 1080: Exception creating secured server socket : parseAlgParameters f
ailed: ObjectIdentifier() -- data isn't an object ID (tag = 48)Unable to bind server socket for LDAP on port 1389: Exception creating secured server socket : parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag =
48)
This SO answer by Bashir Onuche Okala III pointed me to the correct spot: I used the wrong JDK version! I installed openjdk-18-jre-headless
, it should be openjdk-8-jre-headless
. See the Dockerfile in this repo where it uses OpenJDK 8.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.