Skip to Content.
Sympa Menu

en - [sympa-users] regexp virtual aliases are bad.

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: elijah <address@concealed>
  • To: address@concealed
  • Subject: [sympa-users] regexp virtual aliases are bad.
  • Date: Tue, 24 Oct 2006 20:04:10 -0700

Miles Fidelman wrote:

> Up to now I've been running a single robot, and am now in the process of
> setting up a second - and I find that I'm just a bit confused about how
> postfix handles all the sympa aliases.

I don't have an answer, but it reminds me that I have come to the
conclusion that regexp aliases are bad.

Why? Because when you get flooded with emails by a spammer, postfix will
happily pass all of these on to sympa. Sympa does not handle a massive
influx of incorrect addresses very well. Perhaps it is changed in the
newer versions, but our sympa often stops delivering legitimate mail
until we go in and manually remove these from the queue, which is a huge
pain.

It is not really sympa's responsibility to deal with these: postfix
should never have accepted the messages in the first place. I also don't
think it is a very good solution to keep an aliases file which is fifty
thousand lines long.

So, I have been playing around with the idea of using a shell script for
a tcp map in postfix.

The attached script will accept postfix map commands and returns the
correct response by checking the filesystem. This is not really ready
for use yet (it should be written for ash and needs security checks).
However, maybe someone will find it interesting.

run with:

nc -l -e aliasmapper -p 7000

test with:

mkdir -p /home/sympa/expl/my.domain.org/test
postmap -q "address@concealed" tcp:localhost:7000
postmap -q "address@concealed" tcp:localhost:7000

I couldn't get it so that the nc -l command would stay alive, because I
don't understand what I am doing. I can add a while loop, but then it
only works the first time. I suppose it could be run from inetd.

This would be a replacement for the virtual alias map. the non-virtual
alias map would be the same as normal. In postfix, you can specify a tcp
map with tcp:host:port.

tcp map, I think, is only supported in postfix > 2.3

-elijah
#!/bin/bash

SUCCESS=200
TRYAGAIN=400
REJECT=500
SYMPA_ROOT=/home/sympa
MYDOMAIN=`hostname -d`

read INPUT

prefix=${INPUT:0:4}

INPUT=${INPUT:4}

# is there a @ in the address?
atsign=`expr index "$INPUT" @`

# everything before the @
list_name=${INPUT%%@*}

# everything after "-" in the listname
list_command=`expr match "$list_name" '.*-\(.*\)'`

# the domain of the list
list_domain=${INPUT#*@}

# the domain of the list with . replaced with _
list_domain_target=${list_domain//./_}

if [ "$prefix" != "get " ]; then
echo $REJECT bad command
elif [ "$atsign" == "0" ]; then
if [ -d "$SYMPA_ROOT/expl/$INPUT" ]; then
echo $SUCCESS valid-domain
else
echo $REJECT invalid-domain
fi
elif [ "$list_domain" == "" -o "$list_name" == "" ]; then
echo $REJECT input error. malformed address.
elif [ "$list_name" == "postmaster" -o "$list_name" == "root" -o "$list_name"
== "abuse" ]; then
echo $SUCCESS $list_name@$MYDOMAIN
elif [ `expr match
"#request#editor#editors#owner#subscribe#unsubscribe#admin#admins#"
".*#$list_command#"` != 0 ]; then
list_name=${list_name%%-*}
if [ -d "$SYMPA_ROOT/expl/$list_domain/$list_name" ]; then
echo $SUCCESS $list_domain_target-$list_command+$list_name
else
echo $REJECT no such list
fi
else
if [ -d "$SYMPA_ROOT/expl/$list_domain/$list_name" ]; then
echo $SUCCESS $list_domain_target+$list_command
else
echo $REJECT no such list
fi
fi

exit




Archive powered by MHonArc 2.6.19+.

Top of Page