diff --git a/Dockerfile b/Dockerfile index be4764eb..96ec0142 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends \ python3-pip python3-setuptools python3-wheel python3-gpg \ rsyslog dnsutils curl unbound jq rsync \ inotify-tools \ + # To enable compression in imap + arj bzip2 cabextract cpio file gzip nomarch pax unzip zip \ && rm -rf /var/spool/postfix \ && ln -s /var/mail/postfix/spool /var/spool/postfix \ && apt-get autoremove -y \ diff --git a/Makefile b/Makefile index 237dc237..911237c2 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ init: -docker rm -f \ mariadb postgres redis openldap \ mailserver_default mailserver_reverse mailserver_ecdsa mailserver_ldap mailserver_ldap2 \ - mailserver_traefik_acmev1 mailserver_traefik_acmev2 + mailserver_traefik_acmev1 mailserver_traefik_acmev2 || true sleep 2 diff --git a/rootfs/etc/dovecot/conf.d/10-mail.conf b/rootfs/etc/dovecot/conf.d/10-mail.conf index 5b05c5fb..f1d8eb82 100644 --- a/rootfs/etc/dovecot/conf.d/10-mail.conf +++ b/rootfs/etc/dovecot/conf.d/10-mail.conf @@ -1,4 +1,4 @@ -mail_plugins = $mail_plugins quota +mail_plugins = $mail_plugins quota zlib mail_location = maildir:/var/mail/vhosts/%d/%n/{{ .VMAIL_SUBDIR }} maildir_stat_dirs=yes @@ -13,3 +13,8 @@ first_valid_uid = {{ .VMAILUID }} last_valid_uid = {{ .VMAILUID }} mail_privileged_group = vmail + +plugin { + zlib_save_level = 6 # 1..9 + zlib_save = gz # or bz2, If this config entry missing, compression is disabled. +} \ No newline at end of file diff --git a/rootfs/etc/dovecot/conf.d/20-imap.conf b/rootfs/etc/dovecot/conf.d/20-imap.conf index b722873a..c389e97e 100644 --- a/rootfs/etc/dovecot/conf.d/20-imap.conf +++ b/rootfs/etc/dovecot/conf.d/20-imap.conf @@ -2,7 +2,7 @@ imap_idle_notify_interval = 4 mins protocol imap { - mail_plugins = $mail_plugins imap_quota imap_sieve + mail_plugins = $mail_plugins imap_quota imap_sieve imap_zlib imap_client_workarounds = tb-extra-mailbox-sep mail_max_userip_connections = 20 diff --git a/test/tests.bats b/test/tests.bats index 9e100524..576b383f 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -1777,13 +1777,13 @@ load 'test_helper/bats-assert/load' } @test "checking zeyple: 3 emails encrypted in john.doe folder" { - run docker exec mailserver_reverse /bin/sh -c "grep -i 'multipart/encrypted' /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | wc -l" + run docker exec mailserver_reverse /bin/sh -c "gzip -cd /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | grep -i 'multipart/encrypted' | wc -l" assert_success assert_output 3 - run docker exec mailserver_reverse /bin/sh -c "grep -i 'BEGIN PGP MESSAGE' /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | wc -l" + run docker exec mailserver_reverse /bin/sh -c "gzip -cd /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | grep -i 'BEGIN PGP MESSAGE' | wc -l" assert_success assert_output 3 - run docker exec mailserver_reverse /bin/sh -c "grep -i 'END PGP MESSAGE' /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | wc -l" + run docker exec mailserver_reverse /bin/sh -c "gzip -cd /var/mail/vhosts/domain.tld/john.doe/subdir/new/* | grep -i 'END PGP MESSAGE' | wc -l" assert_success assert_output 3 }