docker-mailserver: bug report: Dovecot compression not working
๐ Preliminary Checks
- I tried searching for an existing issue and followed the debugging docs advice, but still need assistance.
๐ What Happened?
I have the following setting in dovecot.cf
protocol imap {
mail_plugins = $mail_plugins zlib imap_zlib
}
# Enable these only if you want compression while saving:
plugin {
zlib_save = gz
zlib_save_level = 9
}
plugin {
## NOTE! Setting was called imap_zlib_compression_level before 2.3.15
## imap_compress_<algorithm>_level = value
##
imap_compress_deflate_level = 6
}
๐ Reproduction Steps
New mail that arrives in maildir is does not get compressed. These settings should save all new email compressed with gz.
๐ DMS Version
v14.0.0
๐ป Operating System and Architecture
Debian 11 x86_64
โ๏ธ Container configuration files
services:
mailserver:
image: ghcr.io/docker-mailserver/docker-mailserver:latest
read_only: false
container_name: mailserver
# Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
hostname: mail.emimx.com
environment:
- SSL_TYPE=manual
- SSL_CERT_PATH=/tmp/dms/custom-certs/fullchain.cer
- SSL_KEY_PATH=/tmp/dms/custom-certs/cert.key
env_file: mailserver.env
# More information about the mail-server ports:
# https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
volumes:
- ./mail/:/var/mail/
- ./mail-state/:/var/mail-state/
- ./mail-logs/:/var/log/mail/
- ./config/:/tmp/docker-mailserver/
- ./letsencrypt:/etc/letsencrypt
- /etc/localtime:/etc/localtime:ro
- /etc/ssl/private/cert.ecc/:/tmp/dms/custom-certs/:ro
restart: unless-stopped
stop_grace_period: 1m
# Uncomment if using `ENABLE_FAIL2BAN=1`:
# cap_add:
# - NET_ADMIN
healthcheck:
test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
timeout: 3s
retries: 0
๐ Relevant log output
new email stored uncompressed
Improvements to this form?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (11 by maintainers)
@polarathene Wow, thank you very much for this very thorough help. I really, really appreciate that! Apologies for the late reply, I was travelling. Based on the evidence you provided, I confirm tha.t this was a mis-configuration on my part.
However, you seem to actually need zlib in protocol lmtp and protocol imap. Using your configuration the email is written compressed but the imap plugin than reports a stream error because the size of the email is different from the size in the name and therefore is not read.
In the end I simply modified my dovecot.cf to to include compression. In case you are interested (or anyone else reading this) here is the configuration that works for me: dovecot.cf
And here is my compose.yaml
Thank you again for your help. Everything seems to be working now and I am very happy!
As assumed user attempted to apply custom configuration and did so incorrectly. Closing again as not a bug.
User misconfiguration
This was your problem.
imap_zlibis only relevant to the IMAP protocol, while thezlibplugin should be available to the Dovecot protocol(s) for receiving mail (such as LMTP).The
zlibplugin docs do not scope to a specific protocol in their example. While theimap_zlibplugin docs do specifically use the imap protocol section for the example there. Easy mistake.That did not properly check the config output for the
mail_pluginssetting:Reproduction (with working compression)
Take this
compose.yamland run the shell commands that follow. No other external files are required, this all works in a self-containedcompose.yamlexample:As this is not officially supported by DMS, I do not deem this a bug.
Please instead raise a feature request to get enough user support (via ๐ reacts) and ideally show a working configuration (since if you configure for LDA it shouldnโt make any actual difference vs LMTP AFAIK).
Dovecot Compression feature is not on-disk storage compression
Actuallyโฆ looking at the IMAP Dovecot docs I linked in the previous comment. I think @alex9434 has misunderstood what the plugin does?
The IMAP mail client needs to use the extension when connecting to Dovecot. IMAP is used for mail retrieval, the compression is on-demand for transfer between Dovecot and the MUA. This isnโt about delivery from Postfix with storage compression on-disk.
If you want compressed storage, an agnostic approach would be to use a filesystem that supports that. BTRFS and NTFS are common examples.
Closing - Advice for proceeding
I will close this given the above.
@georglauterbach and @polarathene I just received the notification for your last comment on github to my email and it is stored compressed (6,699 byte uncompressed and 2,572 bytes compressed)! So everything working! I understand that it can be frustrating for you to deal with all these misconfigurations. Its a complex subject with difficult documentation due to the multiple tools involved.
BTW: If at any point you want to include compression in your documentation, I am happy to write a few paragraphs based on the lessens learned.
Iโm glad you figured this one out @polarathene, nice work!
Whatโs really striking is the amount of user misconfigurations that we see in our issue tracker, really (no offense @alex9434, happens to everyone, and has happened to me too ๐).
No need for this to become heated ๐ We will have a look at your latest comments again re-evaluate. If it turns out that we misunderstood something, we will reconsider. Please do not open a feature request yet; I will re-open this first and we will decide here. On-Disk compression might be worthwhile, but Iโd like for @polarathene to have a look at your feedback here because I donโt know the details.