docker-mailserver: [BUG]: Dovecot mail-dir and home locations shouldn't overlap
Preliminary Checks
- I checked that all ports are open and not blocked by my ISP / hosting provider.
- I know that SSL errors are likely the result of a wrong setup on the user side and not caused by DMS itself. I’m confident my setup is correct.
- I searched the issue tracker but was unable to find my issue.
- I read the extended documentation in general but found nothing to resolve the issue.
- I read the documentation on debugging, tried the proposed steps to debug the problem, but was still unable to resolve the issue.
- I have read this project’s Code of Conduct and I agree
Affected Component(s)
Dovecot errors when creating a filter rule to forward an email
What happened and when does this occur?
Logwatch reports the following (sanitized) error:
imap(<EMAIL_ADDRESS>)<1492788><5ivHyk/6QQSsOq3S>: Error: stat(/var/mail/<DOMAIN>/<USER>/.dovecot.lda-dupes/tmp) failed: Not a directory: 2 Time(s)
What did you expect to happen?
Clean log files in logwatch
How do we replicate the issue?
1.Using Roundcube I created a rule to forward specific emails from one local mail user to another mail user (error seems to have started when I did this) 2. This creates a file named .dovecot.lda-dupes in the users maildir folder 3. Dovecot appears to think this is an email folder because of it’s location and because it starts with a dot …
DMS version
v12.0
What operating system is DMS running on?
Linux
Which operating system version?
debian 11
What instruction set architecture is DMS running on?
AMD64 / x86_64
What container orchestration tool are you using?
Docker
docker-compose.yml
services:
mailserver:
image: docker.io/mailserver/docker-mailserver:latest
container_name: mailserver
# If the FQDN for your mail-server is only two labels (eg: example.com),
# you can assign this entirely to `hostname` and remove `domainname`.
hostname: mail
domainname: edmunds.email
env_file: mailserver.env
#dns:
# - 127.0.0.1
# More information about the mail-server ports:
# https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/
# To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks.
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS)
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
- "4190:4190" # Manage sieve
- "10110:10110" # POP3 (explicit TLS with HAProxy)
- "10123:10123" # Dovecot auth port for radicale
- "10143:10143" # IMAP4 (explicit TLS with HAProxy)
- "10993:10993" # IMAP4 (implicit TLS with HAProxy)
- "10995:10995" # POP3S (implicit TLS with HAProxy)
- "11334:11334" # Rspamd web interface
- "14190:14190" # Manage sieve
volumes:
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
- /etc/localtime:/etc/localtime:ro
- ./docker-data/dms/certs/:/tmp/dms/certs/:ro
# ./docker-data/dms/cron/sa-learn:/etc/cron.d/sa-learn
- ./docker-data/dms/config/dovecot/10-custom.conf:/etc/dovecot/conf.d/10-custom.conf
- ./docker-data/dms/config/rspamd/:/etc/rspamd/override.d/
restart: unless-stopped
stop_grace_period: 1m
cap_add:
- NET_ADMIN
healthcheck:
test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
timeout: 3s
retries: 0
Relevant log output
imap([<EMAIL_ADDRESS>](mailto:<EMAIL_ADDRESS>))<1492788><5ivHyk/6QQSsOq3S>: Error: stat(/var/mail/<DOMAIN>/<USER>/.dovecot.lda-dupes/tmp) failed: Not a directory: 2 Time(s)
Other relevant information
According to this post the location of this file is an issue: https://dovecot.dovecot.narkive.com/BRuWMv1g/problem-with-lda-dupes-file
Because it starts with a dot and is located where your Maildir-root
directory is and the IMAP demon tries to access a mailbox called
"dovecot.lda-dupes".
You should not (must not) have home == maildir root.
What level of experience do you have with Docker and mail servers?
- I am inexperienced with docker
- I am rather experienced with docker
- I am inexperienced with mail servers
- I am rather experienced with mail servers
- I am uncomfortable with the CLI
- I am rather comfortable with the CLI
Improvements to this form?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (9 by maintainers)
I think I may have found the root cause. If I shell into DMS and run:
doveadm user email@address
I see that the user’s home dir and the mail dir are the same folder. Manage sieve uses the home dir value. This dovecot page indicates that having these dirs as the same location is asking for trouble eventually.
https://wiki2.dovecot.org/VirtualUsers/Home
Not sure of the best way to add a ‘home’ directive to dovecot configuration at the moment but I think this is probably the main issue.
Incidentally, I think the issue isn’t necessarily breaking the mail forwarding. It is just not very clean since it generates errors in the log files.
Ran a full 24 hours on edge and no issues reported in the logs. Yeah! Thanks @georglauterbach!
I was a little concerned about the home dir of aliases pointing to the old location and not the new. So I deleted and recreated an alias. It still used the old home dir. So I then create a rule to process an alias message thinking it wouldn’t find the rule and not work but to my surprise it worked! So… all is still good with edge and no known issues here.
Thanks again!!
I will take care of this for v13.0.0, but cannot guarantee any time frame.
UPDATE: Working on this now. Using: https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_users/
Full ack. Separate mail/home directories sounds sane to me.
Indeed, there was a userdb file IIRC. You are right though that this needs to change. What’s really a pity is that we probably need a migration routine to migrate existing users (something I had hoped we could avoid).
CC @casperklein your thoughts? I think we should do something about this. Maybe with v13.0.0?