SYSTEM INFORMATION | |
---|---|
OS type and version | Ubuntu Linux 24.04.2 |
Webmin version | 2.303 |
Virtualmin version | 7.30.8 (GPL) |
Webserver version | Apache 2.4.58 |
Mailserver version | Postfix 3.8.6 |
Mailman version | GNU Mailman 3.3.10 (Tom Sawyer) |
Related packages | Postfix, Mailman 3 |
Summary
When using Mailman 3 with Postfix and Virtualmin, the Mailman-managed alias map (/opt/mailman/mm/var/data/postfix_vmap
) is overwritten or deleted whenever a mail user is edited or updated in Virtualmin. This breaks Mailman list delivery, as the map must be managed exclusively by Mailman.
My Setup
On the system detailed above, I have Mailman 3 installed within a virtualenv, following Virtualenv Installation — Mailman Suite 3.3 documentation. The mail server is Postfix, and there are users - managed through Virtualmin as system users - which have individual email-addresses in the same domain as the list addresses.
To get the delivery to work initially, I have setup a domain with alias in mailman, such that mailman has its own domain lists.example.org
for setting up its local delivery aliases, while the mailing list addresses are of the form listname@example.org
.
A side note (just in case it’s relevant): The domain primarily used for emails (
example.org
) is an alias server of the domain primarily used for web services (let’s call itxmpl.org
). On the alias server’s “Email Settings” page, Mail aliases mode is set to “Copy aliases from target”.
This has not been any issue in the past.
Mailman’s side
Mailman then generates 3 files to be added to the Postfix config (and their corresponding .db
files):
postfix_domains
Location: /opt/mailman/mm/var/data/postfix_domains
lists.example.org example.org
postfix_lmtp
Location: /opt/mailman/mm/var/data/postfix_lmtp
# Aliases which are visible only in the @lists.example.org domain.
some-listname@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-bounces@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-confirm@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-join@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-leave@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-owner@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-request@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-subscribe@lists.example.org lmtp:[127.0.0.1]:8042
some-listname-unsubscribe@lists.example.org lmtp:[127.0.0.1]:8042
# ... equivalently for any other lists
Port 8042 (changed) is where Mailman listens to incoming mails, as defined in /etc/mailman3/mailman.cfg
:
# ...
[mta]
lmtp_port: 8042
# ...
postfix_vmap
Location: /opt/mailman/mm/var/data/postfix_vmap
# Virtual mappings for the @example.org domain.
some-listname@example.org some-listname@lists.example.org
some-listname-bounces@example.org some-listname-bounces@lists.example.org
some-listname-confirm@example.org some-listname-confirm@lists.example.org
# ... etc
Postfix’ side
main.cf
To tie Mailman’s mapping files into Postfix, the relevant parts of it’s /etc/postfix/main.cf
are:
alias_maps = hash:/etc/aliases
virtual_alias_maps = hash:/opt/mailman/mm/var/data/postfix_vmap,
hash:/etc/postfix/virtual
transport_maps = hash:/opt/mailman/mm/var/data/postfix_lmtp
local_recipient_maps = proxy:unix:passwd.byname,
$alias_maps,
hash:/opt/mailman/mm/var/data/postfix_lmtp,
$virtual_alias_maps
relay_domains = hash:/opt/mailman/mm/var/data/postfix_domains
If I remember correctly (it’s been a while by now), the proxy:unix:passwd.byname
-entry in local_recipient_maps was necessary to reinstate delivery to the user mailboxes.
Current behavior
Good: Email delivery works to individual users and to mailing lists.
Bad: Whenever I edit a user via Virtualmin, it apparently rewrites all files mentioned under virtual_alias_maps
in Postfix’ main.cf. That means the changes to the user are reflected in /etc/postfix/virtual
, but it also wipes out all entries from Mailman’s postfix_vmap
.
Basically, I now need to run mailman aliases
on the server whenever I as much as touch a user in Virtualmin to restore the postfix_vmap
contents - hoping that no mail to a mailing list is sent in the meantime. I can still set up a cron job to do that regularly in case I forget it some day, but even that is not a really great option.
What I tried
Initially, I had the opposite order in virtual_alias_maps
which made Virtualmin write new entries into Mailman’s postfix_vmap
file (I’m not entirely sure whether is also wiped all other entries then or not). This is of course also not helpful because then Mailman will remove these new entries whenever it updates the files (periodically, after a change or with the mailman aliases
command).
With some help of the usual kind/enthusiastic but ultimately unhelpful AI, I have tried:
Setting postfix_virtual_alias_maps=/etc/postfix/virtual
in /etc/webmin/virtual-server/config
had no effect. Virtualmin still parses and rebuilds all maps listed in main.cf
.
The same happened when I tried setting postfix_virtual_maps=/etc/postfix/virtual
instead - AI’s first suggestion but I figured since there was a name change in main.cf
, either might be worth a shot.
I’ve tried to find any clue on the internet (and in this forum) how to prevent Virtualmin from overwriting one of the files in virtual_alias_maps
to no avail.
I have not yet tried to symlink Mailman’s postfix_vmap
file instead and configure the link location in the main.cf
. I think that’s also a poor solution if it even works.
Any help will be appreciated. And I’m ready to give more infos if necessary or helpful to fix this issue.
Ultimately, if currently impossible, I might consider a feature request to add an option which (virtual) maps from Postfix Virtualmin should never touch.
Thanks for your time!
Elpy
PS: I’ve been using Virtualmin for probably over 10 years and I’m still in love with it 95% of the time!