Postfix and Mailman

emailmailmanpostfix

I've just configured postfix using virtual domains (using dovecote) and therefore needed to alter the mailman-configuration. I decided to use lists.* to allow postfix to distiguish between mails that need to go to dovecote and others that are handled by mailman. Therefore I created a transport_map (lists.(domainname) mailman:) and registered mailman in master.cf using this configuration:

mailman unix – n n – – pipe
flags=FR user=mailman:mailman
argv=/var/mailman/postfix-to-mailman.py ${nexthop} ${user}

Also I added lists.(domainname) to the relay domains. According to the information given in https://www.gurulabs.com/downloads/postfix-to-mailman-2.1.py (section INSTALLATION) I now do not need to configure any aliases at all. But without adding the output from genaliases to /etc/aliases and afterwards running the newaliases command the mails are rejected (user not found in local alias map). Does anyone know why that happens?

My main.cf looks like that:

# 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 (Debian/GNU)
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

# TLS parameters
smtpd_tls_cert_file=/etc/postfix/sslcert/mailserver.crt
smtpd_tls_key_file=/etc/postfix/sslcert/mailserver.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mathishoffmann.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = mathishoffmann.de
mydestination = lists.mathishoffmann.de, lvps176-28-12-195.dedicated.hosteurope.de, localhost.dedicated.hosteurope.de, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1

# a bit more spam protection
disable_vrfy_command = yes


# Authentification
smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth_dovecot
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps

smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf

smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
        reject_unknown_sender_domain

smtpd_recipient_restrictions = permit_sasl_authenticated
        permit_mynetworks
        reject_unauth_destination


# Virtual mailboxes
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /var/vmail/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 112400000
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 104
virtual_transport = virtual
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
disable_vrfy_command = yes

Best Answer

First of all, do NOT list list.mathishoffmann.de in mydestination - it belongs in relay_domains only (see the ADDRESS_CLASSES readme). Oh, and like yoonix said, I don't see you defining any relay_domains at all.

Furthermore, you need to tell Postfix about valid recipients, with something like relay_recipient_maps = hash:/var/lib/mailman/data/virtual-mailman.

And finally, tell mailman that it can skip alias generation (MTA = None) and that lists.mathishoffmann.de is indeed it's primary domain (POSTFIX_STYLE_VIRTUAL_DOMAINS = ['lists.mathishoffmann.de']).