Re: [exim] Re-Hash - How to remove headers on ingress?

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Matthew Newton
Data:  
Para: Marc Haber
CC: exim-users
Asunto: Re: [exim] Re-Hash - How to remove headers on ingress?
On Fri, Jun 03, 2005 at 11:46:42PM +0200, Marc Haber wrote:
> One of these challenges is the task of removing existing spamassassin
> headers from the message when the message first enters exim.


I do the following. The config file starts with these definitions:

# Spam-Score header
VAR_SPAM_SCORE = m0
# Spam-Report header
VAR_SPAM_REPORT = m1


The data ACL finishes something like this:

# Check spam score for message < 1M
  warn    condition   = ${if <{$message_size}{1048576}{1}{0}}
          spam        = nobody:true
          set acl_VAR_SPAM_SCORE = ($spam_bar) $spam_score
          set acl_VAR_SPAM_REPORT = $spam_report


# If we are going to reject then add spam headers on so that they
# go into the logs
  warn    message     = X-Spam-Score: $acl_VAR_SPAM_SCORE\n\
                        X-Spam-Report: $acl_VAR_SPAM_REPORT
          condition   = ${if <{$message_size}{1048576}{1}{0}}
          condition   = ${if >= {$spam_score_int}{100}{1}{0}}


# Reject spam at high scores (>= 10)
  deny    message     = Sorry, that looks like spam.
          condition   = ${if <{$message_size}{1048576}{1}{0}}
          spam        = nobody:true
          condition   = ${if >= {$spam_score_int}{100}{1}{0}}
          log_message = Rejected SPAM $spam_score_int


accept


Then on the in-bound smtp transport we do:

smtp_inbound:
  driver = smtp
  headers_remove =  "Return-Receipt-To:Return-receipt-to:\
                    X-Confirm-Reading-To:X-confirm-reading-to:\
                    X-Pmrqc:X-pmrqc:X-blacklisted\
                    ${if !eq {$acl_VAR_SPAM_SCORE}{}{:X-Spam-Score}{}}\
                    ${if !eq {$acl_VAR_SPAM_REPORT}{}{:X-Spam-Report}{}}"
  headers_add =     ${if !eq {$acl_VAR_SPAM_SCORE}{}\
                      {X-Spam-Score: $acl_VAR_SPAM_SCORE\n}{}}\
                    ${if !eq {$acl_VAR_SPAM_REPORT}{}\
                      {X-Spam-Report: $acl_VAR_SPAM_REPORT\n}{}}



It's a bit of a hack, but seems to work. It only replaces the X-Spam-*
headers if new ones were set, so that messages that go through the
system more than once (which can happen with internal forwarding, for
example) do not get their headers removed on the second time round (as
internal mail is not scored).

HTH,

Matthew


--
Matthew Newton <mcn4@???>

UNIX and e-mail Systems Administrator, Network Support Section,
Computer Centre, University of Leicester,
Leicester LE1 7RH, United Kingdom