You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Daniel Ruiz Molina <da...@caos.uab.es> on 2009/09/08 11:17:03 UTC

Filtering depending mail header

Hi,

I want to know if it would be possible a spamassassing configuration 
that allows me execute spamassassing just in case a header mail exists 
with a defined value.

System configuration is the following:

Spamassassing: /etc/spamassassin/

rewrite_header Subject *****SPAM*****
report_safe 0
required_score 3.5
use_bayes 1
bayes_auto_learn 1
bayes_learn_during_report 1
bayes_auto_expire 1
bayes_expiry_max_db_size 150000
bayes_journal_max_size 102400
bayes_use_hapaxes 1
use_pyzor 0
use_razor2 1
allow_user_rules 1


Postfix: /etc/postfix/spamassassin

smtp      inet  n       -       n       -       80       smtpd -o 
content_filter=spamassassin
pickup    fifo  n       -       -       60      1       pickup -o 
receive_override_options=no_header_body_checks
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
        -o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
spamassassin    unix    -       n       n       -       -       pipe 
user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} 
-- ${recipient}
policy    unix  -       n       n       -       -       spawn   
user=nobody     argv=/usr/bin/perl /usr/sbin/postfix-policyd-spf-perl



With this configuration, each mail that receives postfix is scanned 
before sending to each user. My idea is that spamassassin scans only in 
case mail received has a header added by another SMTP. My SMTP receives 
mails that have been received before for the Enterprise SMTP. That 
Enterprise SMTP add a header called "X-imss-result:". Depending on the 
value of this header, I would like to configure SpamAssassing for 
execute scan just in case this header has a value equal to 
"Default_Triggered"; in other cases, mail will be sent to user with no scan.

Any idea?


Re: Filtering depending mail header

Posted by Theo Van Dinter <fe...@apache.org>.
There's no way to do that with SpamAssassin itself.  Once you send
something to SA, it will do the whole process (there's short
circuiting, but that's not really what you want here).  It sounds like
you're trying to not filter internal mail but filter external mail, so
I would recommend two things:

a) Ideally, have your MTA listen on two different IPs, one internal
and one external.  Apply different rules depending on which IP is
being used.  You mentioned using Postfix, and doing this is fairly
trivial.

b) Send the mail through something like procmail.  It can make
lightweight decisions about "if this header exists do X".


On Tue, Sep 8, 2009 at 5:17 AM, Daniel Ruiz
Molina<da...@caos.uab.es> wrote:
> I want to know if it would be possible a spamassassing configuration that
> allows me execute spamassassing just in case a header mail exists with a
> defined value.
[...]
> With this configuration, each mail that receives postfix is scanned before
> sending to each user. My idea is that spamassassin scans only in case mail
> received has a header added by another SMTP. My SMTP receives mails that
> have been received before for the Enterprise SMTP. That Enterprise SMTP add
> a header called "X-imss-result:". Depending on the value of this header, I
> would like to configure SpamAssassing for execute scan just in case this
> header has a value equal to "Default_Triggered"; in other cases, mail will
> be sent to user with no scan.