[Postfixbuch-users] custom content filter

dast dast at phpaction.de
Do Jul 21 18:10:02 CEST 2005


Hallo,

ich habe ein problem mit meinem test filter.

Er funktioniert soweit wie er soll, aber wenn eine Mail bei uns 
eingeliefert wird mit einem lokalen Empfänger und vielen externen BCC 
Adressen, dann scheint postfix die mails an die BCC-Adressen über den 
contentfilter zu schicken (er log't sie) der sie via sendmail wieder 
losschickt, aber sie kommen nicht an.

Im LOG sieht es aus, als ob sie wieder an den filter gehen.
einzelne scheinen aber ausgeliefert zu werden.

Sieht mir nach einer Fehlkonfiguration aus.


Hier die entsprechenden LOG Auszüge, master.cf, postconf und der filter:



mail.log:  ("[...]" = wiederkehrende Zeilen mit den ganzen bcc-empfängern


Jul 21 12:03:16 phpaction postfix/smtpd[8692]: connect from p[[xx.xx.xx.xx]].tisdip.tiscali.de[[[xx.xx.xx.xx]]]
Jul 21 12:03:17 phpaction authdaemond: received auth request, service=smtp, authtype=login
Jul 21 12:03:17 phpaction authdaemond: Authenticated: sysusername=<null>, sysuserid=5701, .....
Jul 21 12:03:18 phpaction postfix/smtpd[8692]: 3C0C41D42DA: client=p[[xx.xx.xx.xx]].tisdip.tiscali.de[[[xx.xx.xx.xx]]], sasl_method=LOGIN, sasl_username=rest at erlin.de
Jul 21 12:03:58 phpaction postfix/cleanup[8699]: 3C0C41D42DA: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:03:59 phpaction postfix/qmgr[10930]: 3C0C41D42DA: from=<rest at erlin.de>, size=12654, nrcpt=465 (queue active)
Jul 21 12:03:59 phpaction postfix/smtpd[8692]: disconnect from p[[xx.xx.xx.xx]].tisdip.tiscali.de[[[xx.xx.xx.xx]]]
Jul 21 12:03:59 phpaction postfix/pickup[8231]: C5C531D42DF: uid=65005 from=<rest at erlin.de>
Jul 21 12:03:59 phpaction postfix/cleanup[8699]: C5C531D42DF: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:03:59 phpaction postfix/pipe[8703]: 3C0C41D42DA: to=<xxxxx at 104.6rtl.com>, relay=posfilter, delay=42, status=sent (dummy)
Jul 21 12:03:59 phpaction postfix/pipe[8703]: 3C0C41D42DA: to=<xxxxx at 12move.de>, relay=posfilter, delay=42, status=sent (dummy)
Jul 21 12:03:59 phpaction postfix/pipe[8703]: 3C0C41D42DA: to=<xxxxx at 2bloud.de>, relay=posfilter, delay=42, status=sent (dummy)
Jul 21 12:03:59 phpaction postfix/pipe[8703]: 3C0C41D42DA: to=<x.xxx at 57mm.com>, relay=posfilter, delay=42, status=sent (dummy)
[...]
Jul 21 12:03:59 phpaction postfix/pipe[8704]: 3C0C41D42DA: to=<xxxx at comedy-club.biz>, relay=posfilter, delay=42, status=sent (dummy)
Jul 21 12:04:00 phpaction postfix/qmgr[10930]: C5C531D42DF: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:00 phpaction postfix/pickup[8231]: 014301D42E0: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:00 phpaction postfix/cleanup[8699]: 014301D42E0: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:00 phpaction postfix/qmgr[10930]: 014301D42E0: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:00 phpaction postfix/pickup[8231]: 99C801D42E1: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:00 phpaction postfix/cleanup[8699]: 99C801D42E1: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:00 phpaction postfix/smtp[8744]: C5C531D42DF: to=<xxxxx at 104.6rtl.com>, relay=mail.rtlradio.de[212.222.86.3], delay=1, status=sent (250 Requested mail action okay, completed)
Jul 21 12:04:00 phpaction postfix/qmgr[10930]: C5C531D42DF: removed
Jul 21 12:04:00 phpaction postfix/qmgr[10930]: 99C801D42E1: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:00 phpaction postfix/pickup[8231]: C57FC1D42DF: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:00 phpaction postfix/cleanup[8761]: C57FC1D42DF: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: C57FC1D42DF: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:01 phpaction postfix/pickup[8231]: 068851D42E2: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:01 phpaction postfix/cleanup[8699]: 068851D42E2: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/smtp[8762]: 014301D42E0: to=<xxxx at bbdo-coulting.com>, relay=gate2.bbdo.de[194.175.112.38], delay=2, status=sent (250 2.0.0 j6LA3qHR007851 Message accepted for delivery)
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 014301D42E0: removed
Jul 21 12:04:01 phpaction postfix/smtp[8744]: 99C801D42E1: to=<xxxxxxxxx at rzbank.com>, relay=mail.erzbank.com[212.149.50.150], delay=2, status=sent (250 Ok: queued as BFE42BE26)
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 99C801D42E1: removed
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 068851D42E2: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:01 phpaction postfix/pickup[8231]: 28A701D42E0: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:01 phpaction postfix/cleanup[8761]: 28A701D42E0: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 28A701D42E0: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:01 phpaction postfix/pickup[8231]: 459A51D42E1: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:01 phpaction postfix/cleanup[8699]: 459A51D42E1: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 459A51D42E1: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:01 phpaction postfix/pickup[8231]: 5F8FA1D42E3: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:01 phpaction postfix/cleanup[8761]: 5F8FA1D42E3: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/smtp[8762]: C57FC1D42DF: to=<xxxxxx at gmx.de>, relay=mx0.gmx.net[213.165.64.100], delay=2, status=sent (250 2.6.0 {mx050} Message accepted)
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: C57FC1D42DF: removed
Jul 21 12:04:01 phpaction postfix/smtp[8744]: 068851D42E2: to=<xxxxx at gmx.net>, relay=mx0.gmx.net[213.165.64.100], delay=2, status=sent (250 2.6.0 {mx045} Message accepted)
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 068851D42E2: removed
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 5F8FA1D42E3: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:01 phpaction postfix/pickup[8231]: 89F411D42DF: uid=65005 from=<rest at erlin.de>
Jul 21 12:04:01 phpaction postfix/cleanup[8699]: 89F411D42DF: message-id=<001f01c58ddb$84ef80d0$2201a8c0 at conrad>
Jul 21 12:04:01 phpaction postfix/qmgr[10930]: 89F411D42DF: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
[...]
Jul 21 12:04:01 phpaction postfix/pipe[8706]: 3C0C41D42DA: to=<xxxxx at merzbank.com>, relay=posfilter, delay=44, status=sent (dummy)
Jul 21 12:04:01 phpaction postfix/pipe[8706]: 3C0C41D42DA: to=<xxxxx at merzbank.com>, relay=posfilter, delay=44, status=sent (dummy)
Jul 21 12:04:01 phpaction postfix/pipe[8706]: 3C0C41D42DA: to=<xxx at ompany-cct.de>, relay=posfilter, delay=44, status=sent (dummy)
Jul 21 12:04:01 phpaction postfix/pipe[8708]: 3C0C41D42DA: to=<xxxxx at gmx.de>, relay=posfilter, delay=44, status=sent (dummy)
[...]
Jul 21 12:04:02 phpaction postfix/qmgr[10930]: 40B591D42DF: from=<rest at erlin.de>, size=12792, nrcpt=1 (queue active)
Jul 21 12:04:04 phpaction postfix/smtp[8769]: 40B591D42DF: to=<xxxxx at yahoo.de>, relay=mx2.mail.yahoo.com[4.79.181.13], delay=3, status=sent (250 ok dirdel)
Jul 21 12:04:04 phpaction postfix/qmgr[10930]: 40B591D42DF: removed
Jul 21 12:04:06 phpaction postfix/smtp[8762]: 459A51D42E1: to=<xxxxx at orb.de>, relay=m-relayp01.rbb-online.de[195.37.152.29], delay=6, status=sent (250 Ok: queued as 8D5D35280BB)
Jul 21 12:04:06 phpaction postfix/qmgr[10930]: 459A51D42E1: removed
Jul 21 12:04:07 phpaction postfix/smtp[8768]: 28A701D42E0: to=<xxxxx at ib.bangellschaft.de>, relay=airmail2.b-data.de[193.31.178.136], delay=7, status=sent (250 2.0.0 j6L9us8S025393 Message accepted for delivery)
Jul 21 12:04:07 phpaction postfix/qmgr[10930]: 28A701D42E0: removed
[...]
Jul 21 12:07:19 phpaction postfix/anvil[8693]: statistics: max connection rate 1/60s for (smtp:[[xx.xx.xx.xx]]) at Jul 21 12:03:16
Jul 21 12:07:19 phpaction postfix/anvil[8693]: statistics: max connection count 1 for (smtp:[[xx.xx.xx.xx]]) at Jul 21 12:03:16
Jul 21 12:07:19 phpaction postfix/anvil[8693]: statistics: max cache size 1 at Jul 21 12:03:16





#> cat master.cf


smtp	  inet	n	-	n	-	-	smtpd
       -o content_filter=posfilter:dummy
       -o receive_override_options=no_address_mappings
pickup	  fifo	n	-	n	60	1	pickup
cleanup	  unix	n	-	n	-	0	cleanup
qmgr	  fifo	n	-	n	300	1	qmgr
rewrite	  unix	-	-	n	-	-	trivial-rewrite
bounce	  unix	-	-	n	-	0	bounce
defer	  unix	-	-	n	-	0	bounce
flush	  unix	n	-	n	1000?	0	flush
proxymap  unix	-	-	n	-	-	proxymap
smtp	  unix	-	-	n	-	-	smtp
relay	  unix	-	-	n	-	-	smtp
showq     unix	n	-	n	-	-	showq
error     unix	-	-	n	-	-	error
local	  unix	-	n	n	-	-	local
virtual	  unix	-	n	n	-	-	virtual
lmtp	  unix	-	-	n	-	-	lmtp


maildrop  unix  -       n       n       -       -       pipe
    flags=Rhu user=mailsystem argv=/usr/local/bin/maildrop -d ${recipient} -f ${sender}

posfilter    unix  -       n       n       -       10      pipe
    flags=Rq user=filter argv=/etc/postfix/filter/pos.postfix-content-filter.sh -f ${sender} -- ${recipient}

cyrus	  unix	-	n	n	-	-	pipe
  user=cyrus argv=/usr/lib/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp	  unix	-	n	n	-	-	pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
vscan     unix  -       n       n       -       10       pipe
  user=vscan argv=/usr/sbin/amavis ${sender} ${recipient}
procmail  unix  -       n       n       -       -       pipe
  flags=R user=nobody argv=/usr/bin/procmail -t -m /etc/procmailrc ${sender} ${recipient}
trace	  unix	-	-	n	-	0	bounce
verify	  unix	-	-	n	-	1	verify
anvil	  unix	-	-	n	-	1	anvil
scache	  unix	-	-	n	-	1	scache
discard	  unix	-	-	n	-	-	discard
tlsmgr    unix  -       -       n       1000?   1       tlsmgr






#> postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
canonical_maps = hash:/etc/postfix/canonical
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 10
default_privs = nobody
delay_warning_time = 4h
header_checks = regexp:/etc/postfix/header_checks.regexp
html_directory = no
inet_interfaces = 217.172.178.131, 127.0.0.1
local_destination_concurrency_limit = 2
local_recipient_maps = $virtual_maps
mail_name = mailsystem
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_transport = virtual
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
maximal_queue_lifetime = 1d
message_size_limit = 26240000
mydestination = $myhostname, localhost.$mydomain, $mydomain, mailsystem.$mydomain, localhost.phpaction
mydomain = phpaction.de
myhostname = mail.phpaction.de
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
notify_classes = resource,software,bounce,policy,delay,2bounce
queue_directory = /var/spool/postfix
queue_minfree = 100000000
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_recipient_restrictions = permit_mynetworks,	permit_sasl_authenticated,	reject_unauth_destination,        reject_rbl_client   dul.dnsbl.sorbs.net,        reject_rbl_client   ix.dnsbl.manitu.net,        reject_rbl_client   cbl.abuseat.org,        reject_rbl_client   sbl.spamhaus.org,        reject_rbl_client   list.dsbl.org,	reject_rbl_client   relays.ordb.org,	reject_rbl_client   opm.blitzed.org,	reject_rbl_client zombie.dnsbl.sorbs.net,	reject_rbl_client block.dnsbl.sorbs.net,	reject_rbl_client http.dnsbl.sorbs.net,	reject_rbl_client web.dnsbl.sorbs.net,	reject_rbl_client argentina.blackholes.us,	reject_rbl_client brazil.blackholes.us,	reject_rbl_client japan.blackholes.us,	reject_rbl_client malaysia.blackholes.us,	reject_rbl_client nigeria.blackholes.us,	reject_rbl_client singapore.blackholes.us,	reject_rbl_client taiwan.blackholes.us,	reject_rbl_client thailand.blackholes.us,	reject_rbl_client sbl-xbl.spamhaus.org,	reject_rhsbl_sender dsn.rfc-ignorant.org,	permit

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = phpaction.de
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = hash:/etc/postfix/access
transport_maps = mysql:/etc/postfix/transport.mysql
unknown_local_recipient_reject_code = 550
unknown_relay_recipient_reject_code = 550
unknown_virtual_alias_reject_code = 550
unknown_virtual_mailbox_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/virtual.mysql
virtual_gid_maps = mysql:/etc/postfix/ids.mysql
virtual_mailbox_base = /var/spool/maildirs
virtual_mailbox_maps = mysql:/etc/postfix/mailbox.mysql

virtual_uid_maps = mysql:/etc/postfix/ids.mysql






#> cat pos.postfix-content-filter.sh


#!/bin/bash

LOGFILE="/etc/postfix/filter/mail.log"
SENDMAIL="/usr/sbin/sendmail -i"
SENDMAIL_PARAM="$1 $2 $3"
MAIL_TO="$4"
MAIL_FROM="$2"
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

MAIL_SEARCH_TO_TEST_RESPONDER="From: $MAIL_TO\nTo: $MAIL_FROM\nSubject: Test-Acc: Responder-test\n\nHallo,\n\nDeine Mail ist angekommen"

#create tempfile
TMP_original=`mktemp -p /tmp` || { echo $TMP_original does not exist; exit $EX_TEMPFAIL; }
					
#backup mail to tempfile
cat > $TMP_original || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

#deliver mail to homedir						
$SENDMAIL $SENDMAIL_PARAM $MAIL_TO < $TMP_original

#log delivering
echo -e $(date)"\tpos:mailfilter\tACTION\tDELIVERD\t$MAIL_TO\t<=\t$MAIL_FROM" >> $LOGFILE

#test responder for test-acc axx at xaarr.net
if [ "$MAIL_TO" == "axx at xaarr.net" ];
then
echo -e "$MAIL_SEARCH_TO_TEST_RESPONDER"  | $SENDMAIL -f $MAIL_TO -- $MAIL_FROM
echo -e $(date)"\tpos:mailfilter\tACTION\tRESP\t\t$MAIL_TO\t=>\t$MAIL_FROM\t(because mail incoming for Test-Acc: $MAIL_TO)" >> $LOGFILE
fi

rm $TMP_original
							
exit $?






Mehr Informationen über die Mailingliste Postfixbuch-users