Re: [Exim] exiscan + spamassassin...

Góra strony
Delete this message
Reply to this message
Autor: Dennis Davis
Data:  
Dla: exim-users
CC: Michael Jakscht
Temat: Re: [Exim] exiscan + spamassassin...
>From: Michael Jakscht <jakscht@???>
>To: exim-users@???
>Subject: Re: [Exim] exiscan + spamassassin...
>Date: Wed, 5 Feb 2003 15:45:56 +0100
>
>Hi again,
>
>> > It would be nice to have the score within the header.
>> > Is this possible??
>> > No??
>> When score < required exiscan add only:
>> X-Spam-Score: 2.4 (++)
>>
>> When score > required add:
>> X-Spam-Score: 16.0 (++++++++++++++++)
>> X-Spam-Flag: YES
>> X-Spam-Report: SPAM: ---- Raport oprogramowania antySPAMowego
>>         SPAM: 16.00 zaliczonych, 5 wymaganych;
>>         SPAM: *  1.3 -- Od: nie zawiera imienia i nazwiska
>>         SPAM: *  0.2 -- X-Mailer header indicates a non-spam MUA
>> (Outlook Express)
>>         SPAM: *  3.3 -- BODY: Claims to honor removal requests
>> [...]

>>
>
>
>and there is no other possibility to get the X-Spam-Report even in
>messages < required_sa_score ??


This is something I wanted, so I modified the relevant bit of
SpamAssassin to do this and also to remove the SpamAssassin version
number. Diffs for SpamAssassin version 2.43 are appended below.

*WARNING* I've only tried this with a spamc/spamd combination and
haven't exhaustively tested it. I've no idea how these mods will
interact with exiscan.


*** PerMsgStatus.pm.orig    Thu Sep 26 11:50:24 2002
--- PerMsgStatus.pm    Fri Dec 20 13:48:51 2002
***************
*** 346,356 ****
  sub rewrite_mail {
    my ($self) = @_;


!   if ($self->{is_spam}) {
!     $self->rewrite_as_spam();
!   } else {
!     $self->rewrite_as_non_spam();
!   }


    # invalidate the header cache, we've changed some of them.
    $self->{hdr_cache} = { };
--- 346,359 ----
  sub rewrite_mail {
    my ($self) = @_;


! # Always rewrite as "spam" to get a full report.
! # DHD October 2002
! # if ($self->{is_spam}) {
! # $self->rewrite_as_spam();
! # } else {
! # $self->rewrite_as_non_spam();
! # }
! $self->rewrite_as_spam();

    # invalidate the header cache, we've changed some of them.
    $self->{hdr_cache} = { };
***************
*** 420,435 ****
    # add some headers...


    $self->{msg}->put_header ("X-Spam-Status", $self->_build_status_line());
    $self->{msg}->put_header ("X-Spam-Flag", 'YES');
    if($self->{main}->{conf}->{spam_level_stars} == 1) {
      $self->{msg}->put_header("X-Spam-Level", $self->{main}->{conf}->{spam_level_char} x int($self->{hits}));
    }


!   $self->{msg}->put_header ("X-Spam-Checker-Version",
!     "SpamAssassin " .
!     Mail::SpamAssassin::Version() .
!     " ($Mail::SpamAssassin::SUB_VERSION)"
!   );


    # defang HTML mail; change it to text-only.
    if ($self->{conf}->{defang_mime}) {
--- 423,446 ----
    # add some headers...


    $self->{msg}->put_header ("X-Spam-Status", $self->_build_status_line());
+   # We may be called for non-spam.  So check this.
+   #  DHD  October 2002
+   if ($self -> {is_spam}) {
    $self->{msg}->put_header ("X-Spam-Flag", 'YES');
+   } else {
+   $self->{msg}->put_header ("X-Spam-Flag", 'NO');
+   }
    if($self->{main}->{conf}->{spam_level_stars} == 1) {
      $self->{msg}->put_header("X-Spam-Level", $self->{main}->{conf}->{spam_level_char} x int($self->{hits}));
    }


! # Let's be shy about who we are.
! # DHD October 2002
! # $self->{msg}->put_header ("X-Spam-Checker-Version",
! # "SpamAssassin " .
! # Mail::SpamAssassin::Version() .
! # " ($Mail::SpamAssassin::SUB_VERSION)"
! # );

    # defang HTML mail; change it to text-only.
    if ($self->{conf}->{defang_mime}) {
***************
*** 545,551 ****
      $line .= "\ttests=none\n";
    }


! $line .= "\tversion=" . Mail::SpamAssassin::Version();

    # If the configuration says no folded headers, unfold what we have.
    if ( ! $self->{conf}->{fold_headers} ) {
--- 556,564 ----
      $line .= "\ttests=none\n";
    }


! # Let's be shy about who we are.
! # DHD October 2002
! # $line .= "\tversion=" . Mail::SpamAssassin::Version();

    # If the configuration says no folded headers, unfold what we have.
    if ( ! $self->{conf}->{fold_headers} ) {