Install and configure Mailman3 on a Debian12/Virtualmin server

SYSTEM INFORMATION
OS type and version Debian 12
Virtualmin version 7.20

My problem is similar to the one exposed on these threads but they do not give a solution:

I am trying to install Mailman3 on a Debian12/Virtualmin server.
The full installation is OK, I have access to Postorius and I can create a list, etc…

But, when sending a mail to a mailing list, I always get a message “Recipient address rejected: User unknown in virtual alias table;”.

As in the Mailman3 documentation, I added the following lines to the “main.cf” file, but if I understand correctly, they are not compatible with a Postfix configured with virtual hosts (and with Dovecot?).

transport_maps = hash:/var/lib/mailman3/data/postfix_lmtp
local_recipient_maps = hash:/var/lib/mailman3/data/postfix_lmtp
relay_domains = hash:/var/lib/mailman3/data/postfix_domains

/var/lib/mailman3/data/postfix_lmtp contains lines like:

ml@mydomain.com lmtp:[127.0.0.1]:8024
...

If you have already managed to do this, can you please share your “main.cf” (and maybe your “mailman.cfg”?) and tell how you got it to work?

Best regards,
Niffo

Hi Niffo,

Sorry, I didn’t find a solution and elected to host the mailing list with an external service…

If you do find a solution I’d be interested in hearing it too!

Regards

Paul

Reflecting back I know I used dpkg-reconfigure on postifx and I think mailman. This WILL mess up your Virtualmin a bit. Specifically the procmail command.

If I were to do this again I think I’d set up a clean server with mailman first and get that working and then install Virtualmin.

Sorry I didn’t keep better (read ANY) notes. :frowning:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_security_level = may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level = dane
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = cisnetadmin.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = main.cisnetadmin.com, localhost.$mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = 
   permit_mynetworks 
   permit_sasl_authenticated 
   reject_unauth_destination 
   reject_invalid_hostname 
   reject_non_fqdn_sender 
   reject_unknown_sender_domain 
   reject_unknown_recipient_domain 
#   check_policy_service unix:private/policyd-spf

#policyd-spf_time_limit = 3600

smtp_dns_support_level = dnssec
smtp_host_lookup = dns
allow_percent_hack = no
resolve_dequoted_address = no
tls_server_sni_maps = hash:/etc/postfix/sni_map
# Support the default VERP delimiter.
#recipient_delimiter = +
unknown_local_recipient_reject_code = 550
owner_request_special = no
transport_maps = hash:/var/lib/mailman3/data/postfix_lmtp
local_recipient_maps =
    hash:/var/lib/mailman3/data/postfix_lmtp
relay_domains =
    hash:/var/lib/mailman3/data/postfix_domains
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
milter_default_action = accept
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem

Thanks for your answer @ID10T,
“Unfortunately” I have exactly the same main.cf as you so the solution is not here. I think the explanation of why it works for you is in the dpkg-reconfigure that you did on postfix. For my part, I am on a production server with virtual hosts and I need to find a way to make Mailman3 work without changing the postfix configuration made by Virtualmin.

If anyone has already managed to do this, I’m very interested :wink:

There is a Virtualmin plugin for Mailman (unsupported, but provided by the Virtualmin team), but I keep getting database errors trying to convince Mailman to install, so I haven’t even gotten that far yet…

@tbutler : Are you talking about Mailman3 or the old Mailman ?

When I get some free time maybe I’ll do a virtual machine install of Debian 12 and see if I can remember what I did. Won’t be anytime soon though.

Is your /var/lib/mailman3/data/postfix_lmtp file being created?

# AUTOMATICALLY GENERATED BY MAILMAN ON 2024-08-15 17:03:41
#
# This file is generated by Mailman, and is kept in sync with the binary hash
# file.  YOU SHOULD NOT MANUALLY EDIT THIS FILE unless you know what you're
# doing, and can keep the two files properly in sync.  If you screw it up,
# you're on your own.
    
# Aliases which are visible only in the @xxxxxxnetadmin.com domain.
xxxxxxnet@xxxxxxnetadmin.com                       lmtp:[127.0.0.1]:8024
xxxxxxnet-bounces@xxxxxxnetadmin.com               lmtp:[127.0.0.1]:8024
xxxxxxnet-confirm@xxxxxxnetadmin.com               lmtp:[127.0.0.1]:8024
xxxxxxnet-join@xxxxxxnetadmin.com                  lmtp:[127.0.0.1]:8024
xxxxxxnet-leave@xxxxxxnetadmin.com                 lmtp:[127.0.0.1]:8024
xxxxxxnet-owner@xxxxxxnetadmin.com                 lmtp:[127.0.0.1]:8024
xxxxxxnet-request@xxxxxxnetadmin.com               lmtp:[127.0.0.1]:8024
xxxxxxnet-subscribe@xxxxxxnetadmin.com             lmtp:[127.0.0.1]:8024
xxxxxxnet-unsubscribe@xxxxxxnetadmin.com           lmtp:[127.0.0.1]:8024

Yes :wink: As said in my first post :

Everything seems to be working fine on the Mailman3 side. The only thing is that postfix doesn’t seem to send incoming emails to Mailman3.

If Postfix is transporting to port 8024 then is mailman listening?

root@main:~# netstat -ap |grep 8024
tcp        0      0 localhost.localdom:8024 0.0.0.0:*               LISTEN      957028/python3  

Just for reference:

Oct 16 11:45:32 main postfix/lmtp[1690313]: 5BF1E1E68F: to=<xxxxxnet@xxtadmin.com>, relay=127.0.0.1[127.0.0.1]:8024, delay=11, delays=7.1/0.04/1.1/3, dsn=2.0.0, status=sent (250 Ok)

And:

root@main:~# ps aux |grep lmtp
list      957028  0.0  0.2 160040 33048 ?        Sl   Aug15   6:34 /usr/bin/python3 /usr/lib/mailman3/bin/runner -C /etc/mailman3/mailman.cfg --runner=lmtp:0:1

I don’t remember having to activate lmtp but that doesn’t mean much ‘now daze’ but the fact their are backup files means I probably played with it. :frowning:

root@main:~# grep -ir lmtp /etc/postfix/
/etc/postfix/postfix-files:$daemon_directory/lmtp:h:$daemon_directory/smtp
/etc/postfix/postfix-files:$manpage_directory/man8/lmtp.8postfix.gz:f:root:-:644
/etc/postfix/master.cf:lmtp      unix  -       -       y       -       -       lmtp
/etc/postfix/master.cf:# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
/etc/postfix/master.cf:#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
/etc/postfix/master.cf:#  mailbox_transport = lmtp:inet:localhost
/etc/postfix/master.cf:#  virtual_transport = lmtp:inet:localhost
/etc/postfix/main.cf:transport_maps = hash:/var/lib/mailman3/data/postfix_lmtp
/etc/postfix/main.cf:    hash:/var/lib/mailman3/data/postfix_lmtp
/etc/postfix/master.cf.proto:lmtp      unix  -       -       y       -       -       lmtp
/etc/postfix/master.cf.proto:# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
/etc/postfix/master.cf.proto:#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
/etc/postfix/master.cf.proto:#  mailbox_transport = lmtp:inet:localhost
/etc/postfix/master.cf.proto:#  virtual_transport = lmtp:inet:localhost
/etc/postfix/main.cf.proto:# Cyrus IMAP over LMTP. Specify ``lmtpunix      cmd="lmtpd"
/etc/postfix/main.cf.proto:# listen="/var/imap/socket/lmtp" prefork=0'' in cyrus.conf.
/etc/postfix/main.cf.proto:#mailbox_transport = lmtp:unix:/var/imap/socket/lmtp
/etc/postfix/main.cf.proto:#fallback_transport = lmtp:unix:/file/name
/etc/postfix/mmain.cf.bak:    hash:/var/lib/mailman3/data/postfix_lmtp
/etc/postfix/mmain.cf.bak:    hash:/var/lib/mailman3/data/postfix_lmtp
/etc/postfix/1main.cf.bak:    hash:/var/lib/mailman3/data/postfix_lmtp
/etc/postfix/1main.cf.bak:    hash:/var/lib/mailman3/data/postfix_lmtp

I’m thinking some of these were added with dpkg --reconfigure mailman. Not exact text so don’t copy and paste.

root@main:/etc/postfix# grep -ir mailman *
main.cf:transport_maps = hash:/var/lib/mailman3/data/postfix_lmtp
main.cf:    hash:/var/lib/mailman3/data/postfix_lmtp
main.cf:    hash:/var/lib/mailman3/data/postfix_domains
master.cf:mailman   unix  -       n       n       -       -       pipe
master.cf:  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
master.cf.proto:mailman   unix  -       n       n       -       -       pipe
master.cf.proto:  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py

@ID10T : Thank you very much for your involvement
Yes, Mailman3 is listening on port 8024, I had already checked that:

# netstat -ap |grep 8024
tcp        0      0 localhost:8024          0.0.0.0:*               LISTEN      2323915/python3
# ps aux |grep lmtp
list     2323915  0.0  0.1 174548 93240 ?        Sl   oct.14   0:12 /usr/bin/python3 /usr/lib/mailman3/bin/runner -C /etc/mailman3/mailman.cfg --runner=lmtp:0:1

The fact that Postfix responds “Recipient address rejected: User unknown in virtual alias table;” seems to indicate it is not reading the file /var/lib/mailman3/data/postfix_lmtp

“grep -ir lmtp /etc/postfix/” returns the same as you (except your backup files)

For the master.cf file, the lines that refer to mailman are already present by default with Virtualmin installed but seem to only concern the old Mailman (the path is not correct for Mailman3)

So, if you have another idea :crazy_face:
If I can find the time, I will also try to set up a virtual machine with a stock Postfix

Try turning up the debugging level?

That’s a good idea!
Unfortunately, nothing more in the logs (journalctl) with a logging level of 10 :

oct. 21 10:42:49 ns2.mydomain.net postfix/smtpd[23236]: connect from ns1.mydomain.net[123.123.123.123]
oct. 21 10:42:50 ns2.mydomain.net postfix/smtpd[23236]: NOQUEUE: reject: RCPT from ns1.mydomain.net[123.123.123.123]: 550 5.1.1 <ml@mydomain.com>: Recipient address rejected: User unknown in virtual alias table
; from=<me@mydomain.net> to=<ml@mydomain.com> proto=ESMTP helo=<ns1.mydomain.net>
oct. 21 10:42:50 ns2.mydomain.net postfix/smtpd[23236]: disconnect from ns1.mydomain.net[123.123.123.123] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 rset=1 quit=1 commands=6/8

Did a quick search. This seems familiar.

main.cf:recipient_delimiter = +

Sorry, i didn’t saw your answer :roll_eyes:
Unfortunately, this parameter value is already in my main.cf file

# postconf recipient_delimiter
recipient_delimiter = +

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.