Skip to Content.
Sympa Menu

en - [sympa-users] Sympa + postfix + mysql

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Nikolay Shaplov <address@concealed>
  • To: "address@concealed" <address@concealed>
  • Subject: [sympa-users] Sympa + postfix + mysql
  • Date: Sun, 29 Mar 2015 20:26:09 +0300

Hi!

I'd like to share my solution that allows to run sympa with postfix using
sympa's mysql database as posfix'es lookup table.

I ran this solution on Debian Wheezy. On different OSes pathes might be
different.

First add in /etc/postfix/main.cf domains that are served by sympa, so
postfix
will accept mail from them:

relay_domains = mysql:sympadomains

sympadomains_user = u_sympa
sympadomains_password = ****
sympadomains_dbname = sympa
sympadomains_hosts = mysql
sympadomains_query = select distinct 1 from list_table where robot_list='%s';

then add hash table that will send all sympa's mail to proper postfix
transport
(both standard transport and bounce). It also goes to /etc/postfix/main.cf

transport_maps = mysql:sympalist
mysql:sympabounce

sympalist_user = u_sympa
sympalist_password = ****
sympalist_dbname = sympa
sympalist_hosts = mysql
sympalist_query = select distinct 'sympa' from list_table where (
'sympa' = '%u' or
'listmaster' = '%u' or
name_list = '%u' or
concat(name_list, '-request') = '%u' or
concat(name_list, '-editor') = '%u' or
concat(name_list, '-subscribe') = '%u' or
concat(name_list, '-unsubscribe') = '%u') and
robot_list='%d';

sympabounce_user = u_sympa
sympabounce_password = ****
sympabounce_dbname = sympa
sympabounce_hosts = mysql
sympabounce_query = select distinct 'sympabounce' from list_table where
(concat(name_list, '-owner') = '%u') and robot_list='%d';

Then we should create those transports in /etc/postfix/master.cf

sympa unix - n n - - pipe flags=R
user=sympa
argv=/usr/lib/sympa/bin/queue ${recipient}
sympabounce unix - n n - - pipe flags=R
user=sympa
argv=/usr/lib/sympa/bin/bouncequeue ${recipient}


And at last, according to problem I've described in following letter
https://listes.renater.fr/sympa/arc/sympa-users/2015-03/msg00036.html
all bounces will come to address@concealed address, they will
be not accepted by bounced.pl as bouncequeue expects list name as an
argument:
address@concealed instead of address@concealed.
So all these bounces will go to /var/spool/sympa/bounce/bad

In order to make bounces work, you should write a small perl script that
would
rebounce all messages under the right names:

#!/usr/bin/perl

use strict;

my $spool='/var/spool/sympa/bounce';

my @files = split "\n", `ls $spool/bad`;

foreach my $file (@files)
{
if ($file=~/^(.*)-owner(\@.*)$/)
{
my $to_file = "$1$2";
`mv $spool/bad/$file $spool/$to_file`;
}
}

Add this script to cron so it will be started from time to time. I run it
once
per five minutes.

That's all. Sympa should work properly from here. Or at least it works well
for me ;-)

Attachment: signature.asc
Description: This is a digitally signed message part.




Archive powered by MHonArc 2.6.19+.

Top of Page