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: Tue, 08 Feb 2011 15:20:11 -0800

Hello - some questions below, which will help me understand your assumptions and how to use or change it.

On 8/25/10 6:46 AM, Bastien ROUCARIES wrote:
#!/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';


So your expectation here is that if $USE_SUBDOMAIN_SCHEME is set:
- you have a lists.DOMAIN subdomain
- you have control over both DOMAIN and lists.DOMAIN

And if it is not, whatever domain you're in, at whatever level, is also where the administrative addresses are.

...correct?


# 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?');
}

You describe an optional third argument, [extension] -- but never use it later, and if you get it here, die -- why?

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;
}


Besides the misspelling of POSTMASTER, I am trying to figure out the logic here.

Are you saying that:
- the list owner is always set to either listmaster@DOMAIN or address@concealed -- no matter what the domain's config says is the address of the listmaster or what the list's config says is the address of the list-owner?

# 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);
}


And mail to {root, etc.}@DOMAIN is treated as above, whether or not the administrators for the system are the same as the listmaster for the domain? And what is this "listowner" alias?

# 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);
}

So these will loop around through Sympa, and re-enter Postfix to be processed via the code above?


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


Other than the typo above ("unsubsCribe"), these are also queued or re-queued in the same way...

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

Wouldn't it make more sense for listmaster@ to be treated the same way as the "special" above, but without the listname, as in:

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


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





Archive powered by MHonArc 2.6.19+.

Top of Page