Postfix with MySQL

Hi,
I've been looking at the mailman installation instructions and obviously in my installation mailman isn't correctly integrated with Postfix. Postfix is the host for 4-5 domains of which 1 (or at most 3) would be using masiling lists. (I can run all on one domain as well). In the instruction it says that you should do to postfix main.cf:
virtual_alias_maps = <your normal virtual alias files>, hash:/usr/local/mailman/data/virtual-mailman
while editing mm_cfg.py to include
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
As my Postfix installation uses MySQL as a backend it all become slightly confusing. And in the end when trying to send mail to the list I get 550 errors says the virtual address isn't found.
Is there a pointer to a Postfix w/ MySQL and mailman resource? Apart from http://wiki.list.org/DOC/Mailman%20-%20Postfix%20integration%20wi th%20Mailman%20generated%20transport%20or%20other%20maps
For one thing I'm not sure that I understand "Create /path/to/data/virtual_to_transport with the following content sed -r -e 's/(^[^#]\S+\s+).+$/\1local:/' $1 \
/path/to/data/transport-mailman /usr/sbin/postmap /path/to/data/transport-mailman"
Should that create a virtual_to_transport from these statements? Or should I first create the file and then feed it with the above? Also I'm not altogether certain that it covers mysql-based postfix setups.
/Martin S
--
This address is for technical mail lists only. For all other matters, please use my main address at the .org domain.

On 08/14/2015 11:25 PM, Martin Skjöldebrand wrote:
I'm not too well versed in mixing postfix hash: and mysql: tables, but
if you post the output from postconf -n
, I may be able to help you get
this working in the "normal" way.
Also, what's in data/virtual-mailman?
and, if you didn't create the lists that have addresses in 'dom2.ain' and 'dom3.ain' after adding
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
to mm_cfg.py, did you run Mailman's bin/genaliases?
Is there a pointer to a Postfix w/ MySQL and mailman resource? Apart from http://wiki.list.org/DOC/Mailman%20-%20Postfix%20integration%20with%20Mailma...
Not that I know of.
The method in the FAQ is an alternative that should work in your case. In step 3, suppose that Mailman's data directory is /var/lib/mailman/data. If not, adjust the following for the correct path.
Create the file /var/lib/mailman/data/virtual_to_transport and put the three lines
sed -r -e 's/(^[^#]\S+\s+).+$/\1local:/' $1 \
/var/lib/mailman/data/transport-mailman /usr/sbin/postmap /var/lib/mailman/data/transport-mailman
in that file. I.e. "first create the file and then feed it with the above".
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Sat, 2015-08-15 at 09:29 -0700, Mark Sapiro wrote:
Also, what's in data/virtual-mailman?
I don't have one, maybe that's the problem =) This is one of the confusing points, because all virtual-domain stuff is handled by MySQL tables in my setup.
to mm_cfg.py, did you run Mailman's bin/genaliases?
Yes.
Anyway; output of postconf -n is: alias_database = hash:/etc/aliasesalias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliasesappend_dot_mydomain = nobiff = nobroken_sasl_auth_clients = yesconfig_directory = /etc/postfixcontent_filter = smtp-amavis:[127.0.0.1]:10024delay_warning_time = 4hhtml_directory = /usr/share/doc/postfix/htmlinet_interfaces = allmailbox_size_limit = 0mailman_destination_recipient_limit = 1mydestination = mail.skjoldebrand.eu, localhost, localhost.localdomainmyhostname = mail.skjoldebramd.eumynetworks = 127.0.0.0/8myorigin = /etc/mailnameproxy_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 $virtual_mailbox_limit_mapsreadme_directory = /usr/share/doc/postfixrecipient_delimiter = +relay_domains = lists.skjoldebrand.eurelayhost =smtp_tls_ciphers = mediumsmtp_tls_exclude_ciphers = MD5, SRP, PSK, aDSS, kECDH, kDH, SEED, IDEA, RC2, RC5smtp_tls_protocols = !SSLv2, !SSLv3smtp_tls_session_cache_database = btree:${data_directory}/smtp_scachesmtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_invalid_hostname, permitsmtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_pipelining, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_rbl_client sbl-xbl.spamhaus.org, reject_rbl_client cbl.abuseat.org, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, reject_rbl_client cbl.abuseat.org, reject_rbl_client dnsbl.sorbs.net, permitsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destinationsmtpd_sasl_auth_enable = yessmtpd_sasl_authenticated_header = yessmtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, permitsmtpd_tls_auth_only = yessmtpd_tls_cert_file = /etc/postfix/smtpd.certsmtpd_tls_ciphers = mediumsmtpd_tls_key_file = /etc/postfix/smtpd.keysmtpd_tls_protocols = !SSLv2, !SSLv3smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtpd_use_tls = yestransport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf hash:/var/lib/mailman/data/transport-mailmanunknown_local_recipient_reject_code = 550virtual_alias_domains =virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cfvirtual_gid_maps = static:5000virtual_mailbox_base = /home/vmailvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cfvirtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cfvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cfvirtual_uid_maps = static:5000 /Martin S
--
This address is for technical mail lists only. For all other matters, please use my main address at the .org domain.

On 08/15/2015 11:35 PM, Martin Skjöldebrand wrote:
Yes, that is the problem. You posted that you had in mm_cfg.py
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
I assumed that 'dom2.ain' and 'dom3.ain' were just generic replacements for what you actually had, but perhaps not.
What you need is
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['lists.skjoldebrand.eu']
or possibly a longer list including the host_name attributes other than 'mail.skjoldebrand.eu' of all your lists.
...
Anyway; output of postconf -n is:
It would have been more helpful if you had posted this in a way that didn't strip the line breaks.
alias_database = hash:/etc/aliasesalias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
alias_maps is good.
append_dot_mydomain = nobiff = nobroken_sasl_auth_clients = yesconfig_directory = /etc/postfixcontent_filter = smtp-amavis:[127.0.0.1]:10024delay_warning_time = 4hhtml_directory = /usr/share/doc/postfix/htmlinet_interfaces = allmailbox_size_limit = 0mailman_destination_recipient_limit = 1
mailman_destination_recipient_limit is unnecessary. It is for the highly discouraged postfix_to_mailman.py delivery method.
mydestination = mail.skjoldebrand.eu, localhost, localhost.localdomainmyhostname = mail.skjoldebramd.eumynetworks = 127.0.0.0/8myorigin = /etc/mailnameproxy_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 $virtual_mailbox_limit_mapsreadme_directory = /usr/share/doc/postfixrecipient_delimiter = +relay_domains = lists.skjoldebrand.eu
relay_domains is probably unnecessary.
relayhost =smtp_tls_ciphers = mediumsmt
remove hash:/var/lib/mailman/data/transport-mailman from transport_maps
unknown_local_recipient_reject_code = 550virtual_alias_domains =virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
add lists.skjoldebrand.eu to virtual_alias_domains and add hash:/var/lib/mailman/data/virtual-mailman to virtual_alias_maps
virtual_gid_maps = static:5000virtual_mailbox_base = /home/vmailvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cfvirtual_mailbox_limit_maps
proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cfvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cfvirtual_uid_maps = static:5000
Make the above changes to main.cf, fix POSTFIX_STYLE_VIRTUAL_DOMAINS in mm_cfg.py and remove "POSTFIX_MAP_CMD = '/path/to/data/virtual_to_transport'" from mm_cfg.py.
Then run Mailman's bin/genaliases and see if it now works.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Quoting Mark Sapiro <mark@msapiro.net>:
Apologies, I thought it looked OK when I sent - maybe I didn't look
close enough or I still need to do battle with my email client.
Sending this from webmail instead.
Yes!
Now it works. Many thanks, I obviously need to go back and try to
understand the docs better =(
/Martin S

On 08/14/2015 11:25 PM, Martin Skjöldebrand wrote:
I'm not too well versed in mixing postfix hash: and mysql: tables, but
if you post the output from postconf -n
, I may be able to help you get
this working in the "normal" way.
Also, what's in data/virtual-mailman?
and, if you didn't create the lists that have addresses in 'dom2.ain' and 'dom3.ain' after adding
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
to mm_cfg.py, did you run Mailman's bin/genaliases?
Is there a pointer to a Postfix w/ MySQL and mailman resource? Apart from http://wiki.list.org/DOC/Mailman%20-%20Postfix%20integration%20with%20Mailma...
Not that I know of.
The method in the FAQ is an alternative that should work in your case. In step 3, suppose that Mailman's data directory is /var/lib/mailman/data. If not, adjust the following for the correct path.
Create the file /var/lib/mailman/data/virtual_to_transport and put the three lines
sed -r -e 's/(^[^#]\S+\s+).+$/\1local:/' $1 \
/var/lib/mailman/data/transport-mailman /usr/sbin/postmap /var/lib/mailman/data/transport-mailman
in that file. I.e. "first create the file and then feed it with the above".
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Sat, 2015-08-15 at 09:29 -0700, Mark Sapiro wrote:
Also, what's in data/virtual-mailman?
I don't have one, maybe that's the problem =) This is one of the confusing points, because all virtual-domain stuff is handled by MySQL tables in my setup.
to mm_cfg.py, did you run Mailman's bin/genaliases?
Yes.
Anyway; output of postconf -n is: alias_database = hash:/etc/aliasesalias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliasesappend_dot_mydomain = nobiff = nobroken_sasl_auth_clients = yesconfig_directory = /etc/postfixcontent_filter = smtp-amavis:[127.0.0.1]:10024delay_warning_time = 4hhtml_directory = /usr/share/doc/postfix/htmlinet_interfaces = allmailbox_size_limit = 0mailman_destination_recipient_limit = 1mydestination = mail.skjoldebrand.eu, localhost, localhost.localdomainmyhostname = mail.skjoldebramd.eumynetworks = 127.0.0.0/8myorigin = /etc/mailnameproxy_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 $virtual_mailbox_limit_mapsreadme_directory = /usr/share/doc/postfixrecipient_delimiter = +relay_domains = lists.skjoldebrand.eurelayhost =smtp_tls_ciphers = mediumsmtp_tls_exclude_ciphers = MD5, SRP, PSK, aDSS, kECDH, kDH, SEED, IDEA, RC2, RC5smtp_tls_protocols = !SSLv2, !SSLv3smtp_tls_session_cache_database = btree:${data_directory}/smtp_scachesmtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_invalid_hostname, permitsmtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_pipelining, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_rbl_client sbl-xbl.spamhaus.org, reject_rbl_client cbl.abuseat.org, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, reject_rbl_client cbl.abuseat.org, reject_rbl_client dnsbl.sorbs.net, permitsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destinationsmtpd_sasl_auth_enable = yessmtpd_sasl_authenticated_header = yessmtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, permitsmtpd_tls_auth_only = yessmtpd_tls_cert_file = /etc/postfix/smtpd.certsmtpd_tls_ciphers = mediumsmtpd_tls_key_file = /etc/postfix/smtpd.keysmtpd_tls_protocols = !SSLv2, !SSLv3smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scachesmtpd_use_tls = yestransport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf hash:/var/lib/mailman/data/transport-mailmanunknown_local_recipient_reject_code = 550virtual_alias_domains =virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cfvirtual_gid_maps = static:5000virtual_mailbox_base = /home/vmailvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cfvirtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cfvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cfvirtual_uid_maps = static:5000 /Martin S
--
This address is for technical mail lists only. For all other matters, please use my main address at the .org domain.

On 08/15/2015 11:35 PM, Martin Skjöldebrand wrote:
Yes, that is the problem. You posted that you had in mm_cfg.py
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
I assumed that 'dom2.ain' and 'dom3.ain' were just generic replacements for what you actually had, but perhaps not.
What you need is
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['lists.skjoldebrand.eu']
or possibly a longer list including the host_name attributes other than 'mail.skjoldebrand.eu' of all your lists.
...
Anyway; output of postconf -n is:
It would have been more helpful if you had posted this in a way that didn't strip the line breaks.
alias_database = hash:/etc/aliasesalias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
alias_maps is good.
append_dot_mydomain = nobiff = nobroken_sasl_auth_clients = yesconfig_directory = /etc/postfixcontent_filter = smtp-amavis:[127.0.0.1]:10024delay_warning_time = 4hhtml_directory = /usr/share/doc/postfix/htmlinet_interfaces = allmailbox_size_limit = 0mailman_destination_recipient_limit = 1
mailman_destination_recipient_limit is unnecessary. It is for the highly discouraged postfix_to_mailman.py delivery method.
mydestination = mail.skjoldebrand.eu, localhost, localhost.localdomainmyhostname = mail.skjoldebramd.eumynetworks = 127.0.0.0/8myorigin = /etc/mailnameproxy_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 $virtual_mailbox_limit_mapsreadme_directory = /usr/share/doc/postfixrecipient_delimiter = +relay_domains = lists.skjoldebrand.eu
relay_domains is probably unnecessary.
relayhost =smtp_tls_ciphers = mediumsmt
remove hash:/var/lib/mailman/data/transport-mailman from transport_maps
unknown_local_recipient_reject_code = 550virtual_alias_domains =virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
add lists.skjoldebrand.eu to virtual_alias_domains and add hash:/var/lib/mailman/data/virtual-mailman to virtual_alias_maps
virtual_gid_maps = static:5000virtual_mailbox_base = /home/vmailvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cfvirtual_mailbox_limit_maps
proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cfvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cfvirtual_uid_maps = static:5000
Make the above changes to main.cf, fix POSTFIX_STYLE_VIRTUAL_DOMAINS in mm_cfg.py and remove "POSTFIX_MAP_CMD = '/path/to/data/virtual_to_transport'" from mm_cfg.py.
Then run Mailman's bin/genaliases and see if it now works.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Quoting Mark Sapiro <mark@msapiro.net>:
Apologies, I thought it looked OK when I sent - maybe I didn't look
close enough or I still need to do battle with my email client.
Sending this from webmail instead.
Yes!
Now it works. Many thanks, I obviously need to go back and try to
understand the docs better =(
/Martin S
participants (2)
-
Mark Sapiro
-
Martin Skjöldebrand