docker-mailserver / docker-mailserver

Production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) running inside a container.
https://docker-mailserver.github.io/docker-mailserver/latest/
MIT License
14.3k stars 1.81k forks source link

bug report: Dovecot compression not working #4178

Open alex9434 opened 1 week ago

alex9434 commented 1 week ago

πŸ“ Preliminary Checks

πŸ‘€ 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

polarathene commented 6 days ago

We do not provide support for features not supported by DMS. Custom config with dovecot.cf is supported and known to work.

Ensure you actually followed the troubleshooting guide docs, especially about how to restart DMS properly when updating config. Beyond that follow the advice on logging to provide more information and try look into using the doveconf command within the container to see if your config was applied (if it was, you'll need to investigate why it's not having an effect).

alex9434 commented 2 days ago

Of course I have deleted the container before restarting. The configuration is included in doveconfig.

$ docker exec -ti mailserver doveconf | grep zlib
  zlib_save = gz
  zlib_save_level = 9
  mail_plugins = " quota imap_quota zlib imap_zlib"

Since zlib is included in the mailserver image, I think this feature is supported by DMS. Unfortunately it does not seem to work. How can I debug why the emails are not compressed on saving. Are they delivered into the maildir by dovecot-lda or by postfix?

polarathene commented 2 days ago

Unfortunately it does not seem to work. How can I debug why the emails are not compressed on saving.

If it's not documented in our docs, it's not something we can offer support for.

You can try creating the project discussions page to ask the community there, but you'll most likely be troubleshooting on your own for some time.


Are they delivered into the maildir by dovecot-lda or by postfix?

With DMS Postfix is configured to deliver mail to Dovecot over LMTP. LDA is not used.

alex9434 commented 5 hours ago

With DMS Postfix is configured to deliver mail to Dovecot over LMTP. LDA is not used.

That explains it. Compression can only work if dovecot-lda takes mail from Postfix and delivers it to a user’s mailbox (https://doc.dovecot.org/2.3/configuration_manual/protocols/lda/)

May I suggest to use dovecot-lda for delivery? That allows not only compression but improves mailbox indexing for faster notification, allows additional mailbox formats, sieve support, better quota enforcement etc. What was the reason not to use dovecot-lda? It seems to be recommended by dovecot.