From 55cfd005051b5374b6c6cedf6c02434a33e37136 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Tue, 9 Dec 2025 09:32:53 +0100 Subject: [PATCH 1/3] add imap_compress option to chatmail.ini --- chatmaild/src/chatmaild/config.py | 1 + chatmaild/src/chatmaild/ini/chatmail.ini.f | 6 +++++ cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 | 25 ++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/chatmaild/src/chatmaild/config.py b/chatmaild/src/chatmaild/config.py index 309553e4..6f359a2a 100644 --- a/chatmaild/src/chatmaild/config.py +++ b/chatmaild/src/chatmaild/config.py @@ -44,6 +44,7 @@ class Config: self.disable_ipv6 = params.get("disable_ipv6", "false").lower() == "true" self.acme_email = params.get("acme_email", "") self.imap_rawlog = params.get("imap_rawlog", "false").lower() == "true" + self.imap_compress = params.get("imap_compress", "false").lower() == "true" if "iroh_relay" not in params: self.iroh_relay = "https://" + params["mail_domain"] self.enable_iroh_relay = True diff --git a/chatmaild/src/chatmaild/ini/chatmail.ini.f b/chatmaild/src/chatmaild/ini/chatmail.ini.f index 094ef6e8..f87eda9e 100644 --- a/chatmaild/src/chatmaild/ini/chatmail.ini.f +++ b/chatmaild/src/chatmaild/ini/chatmail.ini.f @@ -99,6 +99,12 @@ acme_email = # so use this option with caution on production servers. imap_rawlog = false +# set to true if you want to enable the IMAP COMPRESS Extension, +# which allows IMAP connections to be efficiently compressed. +# WARNING: Enabling this makes it impossible to hibernate IMAP +# processes which will result in much higher memory/RAM usage. +imap_compress = false + # # Privacy Policy diff --git a/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 b/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 index 7d5dc4b1..9aa031bd 100644 --- a/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 +++ b/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 @@ -113,7 +113,7 @@ mail_attribute_dict = proxy:/run/chatmail-metadata/metadata.socket:metadata # `imap_zlib` enables IMAP COMPRESS (RFC 4978). # protocol imap { - mail_plugins = $mail_plugins imap_zlib imap_quota last_login + mail_plugins = $mail_plugins imap_quota last_login {% if config.imap_compress %}imap_zlib{% endif %} imap_metadata = yes } @@ -252,3 +252,26 @@ protocol imap { rawlog_dir = %h } {% endif %} + +# Hibernate IDLE users to save memory and CPU resources +# NOTE: this will have no effect if imap_zlib plugin is used +imap_hibernate_timeout = 30s +service imap { + # Note that this change will allow any process running as + # $default_internal_user (dovecot) to access mails as any other user. + # This may be insecure in some installations, which is why this isn't + # done by default. + unix_listener imap-master { + user = $default_internal_user + } +} +# The following is the default already in v2.3.1+: +service imap { + extra_groups = $default_internal_group +} +service imap-hibernate { + unix_listener imap-hibernate { + mode = 0660 + group = $default_internal_group + } +} From 81391f406626f90c5e2dd8511dae210dda606f6a Mon Sep 17 00:00:00 2001 From: adb Date: Wed, 10 Dec 2025 20:43:03 +0100 Subject: [PATCH 2/3] Update cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 Co-authored-by: missytake --- cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 b/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 index 9aa031bd..cdc57470 100644 --- a/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 +++ b/cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2 @@ -253,6 +253,7 @@ protocol imap { } {% endif %} +{% if not config.imap_compress %} # Hibernate IDLE users to save memory and CPU resources # NOTE: this will have no effect if imap_zlib plugin is used imap_hibernate_timeout = 30s @@ -275,3 +276,4 @@ service imap-hibernate { group = $default_internal_group } } +{% endif %} From 3ae8834cbe94c9bd52ba7ab25a5118e641a2530f Mon Sep 17 00:00:00 2001 From: adbenitez Date: Thu, 11 Dec 2025 08:32:51 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd17c850..7641ed4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## untagged +- Add imap_compress option to chatmail.ini (#760) + - Remove echobot from relays ([#753](https://github.com/chatmail/relay/pull/753))