From b4930c3c7db764d370695c9b893c653987d6fbed Mon Sep 17 00:00:00 2001 From: Luciano Giacchetta Date: Wed, 11 Feb 2026 16:36:01 -0300 Subject: [PATCH] feat(dovecot): add support for configuring imap_capability This introduces the `dovecot_imap_capability` variable to allow customization of advertised IMAP capabilities. - Add `dovecot_imap_capability` to `defaults/main.yml` (defaulting to empty). - Update `templates/dovecot.conf.j2` to conditionally include the `protocol imap` block if the capability string is provided. - This enables operators to add or remove specific IMAP extensions (e.g., disabling `LITERAL+` or `NOTIFY`) for client compatibility. --- defaults/main.yml | 7 +++++++ templates/dovecot.conf.j2 | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 472860f..90a1a8b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,6 +45,13 @@ dovecot_enabled: true # Protocols to enable (imap, pop3, lmtp) dovecot_protocols: "imap pop3 lmtp" +# IMAP capability adjustments. Set to modify advertised IMAP capabilities. +# Use +CAPABILITY to add, -CAPABILITY to remove. +# Example: "+IMAP4rev1 -LITERAL+ -NOTIFY" removes modern extensions that +# might suppress standard untagged responses. +# Leave empty to use Dovecot defaults. +dovecot_imap_capability: "" + # Mail storage location. Using Maildir in the user's home directory. dovecot_mail_location: "maildir:~/Maildir" diff --git a/templates/dovecot.conf.j2 b/templates/dovecot.conf.j2 index 49e85b1..36604db 100644 --- a/templates/dovecot.conf.j2 +++ b/templates/dovecot.conf.j2 @@ -2,6 +2,12 @@ # Ansible managed: {{ ansible_managed }} protocols = {{ dovecot_protocols }} +{% if dovecot_imap_capability | default('') | length > 0 %} + +protocol imap { + imap_capability = {{ dovecot_imap_capability }} +} +{% endif %} # Dictionary of configuration files !include conf.d/*.conf