Hello guys, I have made a simple filter, following the example here http://www.postfix.org/FILTER_README.html in order to insert a number in the subject line of every message been sent. The script of this filter is very similar with the example, in uses sed to replace "Subject: " with "Subject: #$number" and autoincrements $number every time it is triggered.
The filter is defined in master.cf: # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - - smtpd # -o receive_override_options=no_address_mappings 10025 inet n - n - - smtpd # -o receive_override_options=no_address_mappings # ............. nrfilter unix - n n - 10 pipe flags=Rq user=filter null_sender= argv=/var/spool/filter/countscript -f ${sender} -- ${recipient} dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -d $(recipient) And is triggered from main.cf: ...... sender_bcc_maps = hash:/etc/postfix/maps/sender_bcc smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/maps/sender_nrfilter, >>(mydomain.tld FILTER nrfilter:) permit_mynetworks, permit_sasl_authenticated, reject_unlisted_recipient, reject_unauth_destination, reject_unknown_recipient_domain, reject_rbl_client sbl-xbl.spamhaus.org, reject_rbl_client cbl.abuseat.org, reject_rbl_client bl.spamcop.net, reject_rbl_client zen.spamhaus.org Every "filtered" message have to be bcc-ed into a local accout. This Postfix serves one single virtual domain with virtual users defined in mysql database. Now I am asking your advice because: 1. With the above configuration, the filter works ok but in the bcc account I get 2 messages for each sent message(backscatter I guess). 2. If I enable -o statement for the smtp services, I get only one message in the bcc but the virtual aliasses are no more recognized by Postfix So, it will be great if you can give a suggetion on how can I have only 1 message in bcc account keeping active the virtual aliasses. 3. This problem is caused by faken...@mydomain.tld, claimig to be a mydomain.tld user, wich triggers the filter but are finnaly rejected by cbl/rbl checks. NOQUEUE: filter: RCPT from host216-58-dynamic.1-79-r.retail.telecomitalia.it[79.1.58.216]: <afiaac...@mydomain.tld>: Sender address triggers FILTER nrfilter:; from=<afiaac...@mydomain.tld> to=<ag...@mydomain.tld> proto=ESMTP helo=<uomo754a9bd9e5> NOQUEUE: reject: RCPT from host216-58-dynamic.1-79-r.retail.telecomitalia.it[79.1.58.216]: 450 4.7.1 Service unavailable; Client host [79.1.58.216] blocked using sbl-xbl.spamhaus.org; http://www.spamhaus.org/query/bl?ip=79.1.58.216; from=<akinyiandar...@mydomain.tld> to=<ag...@mydomain.tld> proto=ESMTP helo=<uomo754a9bd9e5> If I move check_sender_access statement after cbl/rbl checks, the filter is no more triggered by anyone. Hoping I was clear enough, I am awaiting for your kind suggestions/questions. -- Best regards, Tudor mailto:teo...@gmail.com