feat(postfix): implement virtual mailbox configuration for Dovecot LMTP

Updates the Postfix configuration to correctly handle virtual domains when Dovecot LMTP is enabled, moving away from local system delivery settings.

- Removes `postfix_mail_domain` from `postfix_mydestination` to prevent conflicts with virtual domain handling.
- Updates `main.cf` to set `virtual_transport`, `virtual_mailbox_domains`, and `virtual_mailbox_maps` instead of `mailbox_transport`.
- Adds a new template `virtual_mailbox_maps.j2` to authorize specific users defined in `dovecot_users`.
- Adds tasks to generate the virtual mailbox map file and run `postmap` upon changes.
This commit is contained in:
2026-02-11 14:49:22 -03:00
parent c9892b9e51
commit f76e0a31ae
4 changed files with 39 additions and 8 deletions

View File

@@ -18,9 +18,10 @@ postfix_mail_domain: "{{ ansible_domain | default('internal.local') }}"
# The Fully Qualified Domain Name of the mail server.
postfix_myhostname: "mail.{{ postfix_mail_domain }}"
# Comma-separated list of domains this server accepts mail for.
# It's critical that this includes the server's own hostname and mail domain.
postfix_mydestination: "$myhostname, localhost.{{ postfix_mail_domain }}, localhost, {{ postfix_mail_domain }}"
# Comma-separated list of domains this server accepts mail for locally.
# When using Dovecot with LMTP (virtual mailboxes), the mail domain is handled
# separately via virtual_mailbox_domains, so it should NOT be included here.
postfix_mydestination: "$myhostname, localhost.{{ postfix_mail_domain }}, localhost"
# The list of "trusted" remote SMTP clients that have more privileges than "strangers".
postfix_mynetworks: "127.0.0.0/8 [::1]/128"