From: nik600 on
Dear all

i've installed a postfix server with mysql support.

i've also set-up a custom filter script shell that calls spamc and
some other custom utils, this script cannot handle multiple
recipients, so i've set

filter_destination_recipient_limit = 1

The problem that i've experienced is that when i've got an entry like
this in the alias table:

+---------------------------+----------------------------------------------------------------------+----------------------+---------------------+---------------------+--------+
| address | goto
| domain | created
| modified | active |
+---------------------------+----------------------------------------------------------------------+----------------------+---------------------+---------------------+--------+
| forwarded(a)foo.com | info(a)foo.com,foo(a)yahoo.it,foo2(a)libero.it |
foo.com | 0000-00-00 00:00:00 | 2009-12-30 17:37:22 | 1 |
+---------------------------+----------------------------------------------------------------------+----------------------+---------------------+---------------------+--------+

Sending an e-mail to forwarded(a)foo.com causes that my script is called 4 times:

forwarded(a)foo.com
info(a)foo.com
foo(a)yahoo.it
foo2(a)libero.it

and the result is that info(a)foo.com,foo(a)yahoo.it,foo2(a)libero.it
receives the mail twice.

postconf -n:
alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
disable_vrfy_command = yes
html_directory = no
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
message_size_limit = 100240000
mydestination = $transport_maps
mydomain = foo.com
myhostname = mail.foo.com
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
relay_domains =
proxy:mysql:/etc/postfix/mysql_relay_domains_maps.cf,hash:/etc/postfix/relay
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_host_lookup = native,dns
smtpd_client_connection_count_limit = 50
smtpd_client_restrictions =
permit_sasl_authenticated,permit_mynetworks,reject_non_fqdn_sender,reject_rbl_client
sbl-xbl.spamhaus.org,reject_non_fqdn_hostname,reject_non_fqdn_recipient
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_sasl_authenticated,
permit_mynetworks, reject_invalid_hostname
smtpd_recipient_restrictions =
permit_mynetworks,permit_sasl_authenticated,check_sender_access
hash:/etc/postfix/whitelist/whitelist_reject_non_fqdn_sender,reject_non_fqdn_sender,reject_non_fqdn_sender,reject_unauth_destination,reject_unauth_pipelining,reject_rbl_client
sbl-xbl.spamhaus.org,reject_non_fqdn_hostname,reject_non_fqdn_recipient
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = sasl2/smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtpd_sender_restrictions =
permit_sasl_authenticated,permit_mynetworks,check_sender_access
hash:/etc/postfix/whitelist/whitelist_reject_non_fqdn_sender,reject_non_fqdn_sender,reject_unknown_sender_domain,reject_non_fqdn_hostname,reject_non_fqdn_recipient
strict_rfc821_envelopes = yes
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:102
virtual_mailbox_base = /var/spool/postfix/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 100240000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 1000
virtual_transport = virtual
virtual_uid_maps = static:1000

master.cf

smtp inet n - n - - smtpd
-o content_filter=filter:dummy
9009 inet n - n - - smtpd
-o content_filter=filter:dummy
filter unix - n n - 20 pipe
flags=Rq user=filter argv=/var/script/filtra_spamc_1.6 -f
${sender} -- ${recipient} ${sasl_username}


Is that behaviour correct?
How can i avoid to call the custom filter for forwarded(a)foo.com ?

Thanks

--
/*************/
nik600
http://www.kumbe.it

From: nik600 on
On Mon, Jan 4, 2010 at 12:52 PM, nik600 <nik600(a)gmail.com> wrote:
> Dear all
>
> i've installed a postfix server with mysql support.
>
> i've also set-up a custom filter script shell that calls spamc and
> some other custom utils, this script cannot handle multiple
> recipients, so i've set
>
> filter_destination_recipient_limit = 1
>
> The problem that i've experienced is that when i've got an entry like
> this in the alias table:
>

I've also tried to change master.cf like:

smtp inet n - n - - smtpd
-o content_filter=filter:dummy
-o receive_override_options=no_address_mappings
9009 inet n - n - - smtpd
-o content_filter=filter:dummy
-o receive_override_options=no_address_mappings

This fix the problem for the forward, but stops to apply custom spam
settings, infact in that case the filter is called only for
forwarded(a)foo.com and obviosly it doesn't load any custom spam option
of

info(a)foo.com
foo(a)yahoo.it
foo2(a)libero.it

Is it possible to avoid that?

--
/*************/
nik600
http://www.kumbe.it

From: Wietse Venema on
nik600:
> On Mon, Jan 4, 2010 at 12:52 PM, nik600 <nik600(a)gmail.com> wrote:
> > Dear all
> >
> > i've installed a postfix server with mysql support.
> >
> > i've also set-up a custom filter script shell that calls spamc and
> > some other custom utils, this script cannot handle multiple
> > recipients, so i've set
> >
> > filter_destination_recipient_limit = 1
> >
> > The problem that i've experienced is that when i've got an entry like
> > this in the alias table:
> >
>
> I've also tried to change master.cf like:
>
> smtp inet n - n - - smtpd
> -o content_filter=filter:dummy
> -o receive_override_options=no_address_mappings
> 9009 inet n - n - - smtpd
> -o content_filter=filter:dummy
> -o receive_override_options=no_address_mappings

As documented in http://www.postfix.org/FILTER_README.html
you must turn off address_mappings BEFORE or AFTER the
filter NOT on both sides.

Wietse

From: nik600 on
On Mon, Jan 4, 2010 at 2:24 PM, Wietse Venema <wietse(a)porcupine.org> wrote:
> nik600:
>> On Mon, Jan 4, 2010 at 12:52 PM, nik600 <nik600(a)gmail.com> wrote:
>> > Dear all
>> >
>> > i've installed a postfix server with mysql support.
>> >
>> > i've also set-up a custom filter script shell that calls spamc and
>> > some other custom utils, this script cannot handle multiple
>> > recipients, so i've set
>> >
>> > filter_destination_recipient_limit = 1
>> >
>> > The problem that i've experienced is that when i've got an entry like
>> > this in the alias table:
>> >
>>
>> I've also tried to change master.cf like:
>>
>> smtp      inet  n       -       n       -       -       smtpd
>>         -o content_filter=filter:dummy
>>        -o receive_override_options=no_address_mappings
>> 9009      inet  n       -       n       -       -       smtpd
>>         -o content_filter=filter:dummy
>>        -o receive_override_options=no_address_mappings
>
> As documented in http://www.postfix.org/FILTER_README.html
> you must turn off address_mappings BEFORE or AFTER the
> filter NOT on both sides.
>
>        Wietse
>
the 9009 port is not the filter port, i use both 25 and 9009 because
some providers in italiy blocks the 25 port.

the complete master.cf is

smtp inet n - n - - smtpd
-o content_filter=filter:dummy
-o receive_override_options=no_address_mappings
9009 inet n - n - - smtpd
-o content_filter=filter:dummy
-o receive_override_options=no_address_mappings
filter unix - n n - 20 pipe
flags=Rq user=filter
argv=/var/programmi/script/filtra_spamc_1.6 -f ${sender} --
${recipient} ${sasl_username}




--
/*************/
nik600
http://www.kumbe.it

From: mouss on
nik600 a �crit :
> On Mon, Jan 4, 2010 at 12:52 PM, nik600 <nik600(a)gmail.com> wrote:
>> Dear all
>>
>> i've installed a postfix server with mysql support.
>>
>> i've also set-up a custom filter script shell that calls spamc and
>> some other custom utils, this script cannot handle multiple
>> recipients, so i've set
>>
>> filter_destination_recipient_limit = 1
>>
>> The problem that i've experienced is that when i've got an entry like
>> this in the alias table:
>>
>
> I've also tried to change master.cf like:
>
> smtp inet n - n - - smtpd
> -o content_filter=filter:dummy
> -o receive_override_options=no_address_mappings
> 9009 inet n - n - - smtpd
> -o content_filter=filter:dummy
> -o receive_override_options=no_address_mappings
>
> This fix the problem for the forward, but stops to apply custom spam
> settings, infact in that case the filter is called only for
> forwarded(a)foo.com and obviosly it doesn't load any custom spam option
> of
>
> info(a)foo.com
> foo(a)yahoo.it
> foo2(a)libero.it
>
> Is it possible to avoid that?
>

if you want your filter to see rewritten addresses, remove the
no_address_mappins option from before-the-filter smtpd listeners and put
it in the after-the-filter smtpd listener(s).