Skip to content

Commit dba48e8

Browse files
authored
Merge pull request #760 from chatmail/adb/issue-734
add imap_compress option to chatmail.ini
2 parents b000213 + 3ae8834 commit dba48e8

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## untagged
44

5+
- Add imap_compress option to chatmail.ini (#760)
6+
57
- Remove echobot from relays
68
([#753](https://github.com/chatmail/relay/pull/753))
79

chatmaild/src/chatmaild/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, inipath, params):
4444
self.disable_ipv6 = params.get("disable_ipv6", "false").lower() == "true"
4545
self.acme_email = params.get("acme_email", "")
4646
self.imap_rawlog = params.get("imap_rawlog", "false").lower() == "true"
47+
self.imap_compress = params.get("imap_compress", "false").lower() == "true"
4748
if "iroh_relay" not in params:
4849
self.iroh_relay = "https://" + params["mail_domain"]
4950
self.enable_iroh_relay = True

chatmaild/src/chatmaild/ini/chatmail.ini.f

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@
9999
# so use this option with caution on production servers.
100100
imap_rawlog = false
101101

102+
# set to true if you want to enable the IMAP COMPRESS Extension,
103+
# which allows IMAP connections to be efficiently compressed.
104+
# WARNING: Enabling this makes it impossible to hibernate IMAP
105+
# processes which will result in much higher memory/RAM usage.
106+
imap_compress = false
107+
102108

103109
#
104110
# Privacy Policy

cmdeploy/src/cmdeploy/dovecot/dovecot.conf.j2

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ mail_attribute_dict = proxy:/run/chatmail-metadata/metadata.socket:metadata
113113
# `imap_zlib` enables IMAP COMPRESS (RFC 4978).
114114
# <https://datatracker.ietf.org/doc/html/rfc4978.html>
115115
protocol imap {
116-
mail_plugins = $mail_plugins imap_zlib imap_quota last_login
116+
mail_plugins = $mail_plugins imap_quota last_login {% if config.imap_compress %}imap_zlib{% endif %}
117117
imap_metadata = yes
118118
}
119119

@@ -252,3 +252,28 @@ protocol imap {
252252
rawlog_dir = %h
253253
}
254254
{% endif %}
255+
256+
{% if not config.imap_compress %}
257+
# Hibernate IDLE users to save memory and CPU resources
258+
# NOTE: this will have no effect if imap_zlib plugin is used
259+
imap_hibernate_timeout = 30s
260+
service imap {
261+
# Note that this change will allow any process running as
262+
# $default_internal_user (dovecot) to access mails as any other user.
263+
# This may be insecure in some installations, which is why this isn't
264+
# done by default.
265+
unix_listener imap-master {
266+
user = $default_internal_user
267+
}
268+
}
269+
# The following is the default already in v2.3.1+:
270+
service imap {
271+
extra_groups = $default_internal_group
272+
}
273+
service imap-hibernate {
274+
unix_listener imap-hibernate {
275+
mode = 0660
276+
group = $default_internal_group
277+
}
278+
}
279+
{% endif %}

0 commit comments

Comments
 (0)