Skip to Content.
Sympa Menu

en - Re: [sympa-users] Postfix to sympas script

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: "Roger B.A. Klorese" <address@concealed>
  • To: Bastien ROUCARIES <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-users] Postfix to sympas script
  • Date: Thu, 26 Aug 2010 07:01:59 -0700

Just checking -- does this properly reject, rather than bounce, undeliverable messages to the target domains?

On 8/25/10 6:46 AM, Bastien ROUCARIES wrote:
Hi,

I use the following script to run postfix and sympa together.

In order to use it:

Install this file as /var/lib/sympa/bin/postfix-to-sympa.pl

To configure a virtual domain (lists.example.comà to connect to sympa,
edit Postfix thusly:

/etc/postfix/main.cf:
relay_domains = ... lists.example.com
transport_maps = hash:/etc/postfix/transport
sympa_destination_recipient_limit = 1

/etc/postfix/master.cf
sympa unix - n n - - pipe
flags=FR user=sympa
argv=/var/lib/sympa/bin/postfix-to-sympa.pl ${nexthop} ${mailbox}

/etc/postfix/transport:
lists.example.com sympa:



(source here
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=postfix-to-sympa.pl;att=1;bug=592969)

#!/usr/bin/perl
use strict;
use warnings;
use POSIX;

# Bastien ROUCARIES address@concealed
# inspired by postfix to mailman

my $USE_SUBDOMAIN_SCHEME = '1';
my $DEFAULT_POSTERMASTER = 'listmaster';
# not used if $USE_SUBDOMAIN_SCHEME = 1;
my $DEFAULT_DOMAIN = 'exemple.com';

# Install this file as /var/lib/sympa/bin/postfix-to-sympa.pl
#
# To configure a virtual domain to connect to sympa, edit Postfix thusly:
#
# /etc/postfix/main.cf:
# relay_domains = ... lists.example.com
# transport_maps = hash:/etc/postfix/transport
# sympa_destination_recipient_limit = 1
#
# /etc/postfix/master.cf
# sympa unix - n n - - pipe
# flags=FR user=sympa
# argv=/var/lib/sympa/bin/postfix-to-mailman.pl ${nexthop} ${mailbox}
#
# /etc/postfix/transport:
# lists.example.com sympa:
#
# Replace lists.example.com above with the name of the domain to be
# connected to sympa. Note that _all_ mail to that domain will go to
# sympa, so you don't want to put the name of your main domain
# here. Typically a virtual domain lists.domain.com is used for
# sympa, and domain.com for regular email.
#
# BEWARE BEWARE
#
# This script send listmaster message to address@concealed
# where exemple.com is the subdomain of lists.exemple.com
# if it is not the case change $USE_SUBDOMAIN_SCHEME to false
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#

# command line usage error
my $EX_USAGE = 64;
# addressee unknown
my $EX_NOUSER = 67;
# internal software error
my $EX_SOFTWARE = 70;
# temporary failure
my $EX_TEMPFAIL = 75;

# go to non interactive ;
POSIX::nice(5);

# see if writing to stderr is safe (PANAROIAC)
select(STDERR) || exit($EX_SOFTWARE);

# arg are user domain [extension]
if(!($#ARGV == 1 || $#ARGV == 2)) {
$! = $EX_USAGE;
die('Did you forget to set sympa_destination_recipient_limit=1 in
main.cf?');
}

my $domain = $ARGV[0];
my $user = $ARGV[1];

my $LIST_OWNER = '';
if($USE_SUBDOMAIN_SCHEME == 1) {
$domain =~ /(lists)\.(.*)/;
my $subdomain = $2;
if(!defined($subdomain)) {
$! = $EX_USAGE;
die('domain does not seems to be valid!');
}
$LIST_OWNER = $DEFAULT_POSTERMASTER.'@'.$subdomain;
} else {
$LIST_OWNER = $DEFAULT_POSTERMASTER;
}

# Redirect required addresses required by rfc
root|postmaster|abuse|mailer-daemon
# of by sympa: sympa-request|sympa-owner
# to list owner
$user =~
/(root|postmaster|abuse|mailer-daemon|sympa-request|sympa-owner|listowner)/;
if(defined($1)) {
$! = 0;
exec("/usr/sbin/sendmail $LIST_OWNER");
exit(1);
}

# Redirect ARF as sympa documentation
if($user eq 'abuse-feedback-report') {
exec('/usr/lib/sympa/lib/sympa/bouncequeue '.'sympa@'."$domain");
exit(1);
}

# Redirect bounce if requiered
if($user eq 'bounce') {
exec('/usr/lib/sympa/lib/sympa/bouncequeue '.'sympa@'."$domain");
exit(1);
}


# search if address is special
$user =~ /(.*)-(request|editor|subscribe|unsubsribe)/;
if(defined($2)) {
exec('/usr/lib/sympa/lib/sympa/queue '."$user".'@'."$domain");
exit(1);
}

$user =~ /(.*)-(owner)/;
if(defined($2)) {
exec('/usr/lib/sympa/lib/sympa/bouncequeue '."$user".'@'."$domain");
exit(1);
}

exec('/usr/lib/sympa/lib/sympa/queue '."$user".'@'."$domain");
exit(1);





Archive powered by MHonArc 2.6.19+.

Top of Page