Mailing List Archive

problems with procmail
I'm unable to get Bayes tests to work when I get my mail through procmail,
and although positive (spam) tests seem to work, negative (ham) tests don't -
that is, ham is always marked as "X-Spam-Status: No, hits=0.0". Compounding my
confusion is the fact that if I run a virgin message through SA by hand, it
works fine (according to headers and debug info).

This seems like a problem with procmail[1], but hopefully someone here can
point me in the right direction. The main thing to note about my setup is that
I've installed SA into my home directory (~/local/bin, ~/local/etc, etc) since
I don't run this mail server).

Everything seems to work fine, except for bayes and negative tests when run
through procmail. Am I missing something obvious?

Thanks,
-will

[1] The appropriate bit of my ~/.procmailrc:
:0fw:spamassassin.lock
| spamassassin

:0e
{
EXITCODE=$?
}

:0:
* ^X-Spam-Status: Yes
crap

--
---------Will McDonald-----------------will@upl.cs.wisc.edu----------
GPG encrypted mail preferred. Join the web-o-trust! Key ID: F4332B28
Re: problems with procmail [ In reply to ]
On Mon, Feb 16, 2004 at 06:12:45PM -0600, Will McDonald wrote:
> Everything seems to work fine, except for bayes and negative tests when run
> through procmail. Am I missing something obvious?

Well, there aren't really any negative tests (aka: "nice" tests) anymore due to forging issues. As for
Bayes... If you run with -D it'll shed more light on the situation.

--
Randomly Generated Tagline:
"...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and
the Ugly)."
(By Matt Welsh)
Re: problems with procmail [ In reply to ]
On Mon, Feb 16, 2004 at 08:49:44PM -0500, Theo Van Dinter wrote:
> > Everything seems to work fine, except for bayes and negative tests when
> > run through procmail. Am I missing something obvious?
>
> Well, there aren't really any negative tests (aka: "nice" tests) anymore due
> to forging issues. As for Bayes... If you run with -D it'll shed more light
> on the situation.

Good to know - I compiled 2.63 for this box; the last version I was using was
~2.4x, and it still had "nice" tests (I like being rewarded for using mutt :).

As for bayes: When I 'cat new_message | spamassassin -D' everything looks good
- it identifies all the tokens, gives it a bayes score, and correctly applies
the bayes tests. I tried adding the following procmail rule and sending a test
message, but I don't get any useful debugging output. Is there another way I
can test this?

-will

:0:
* ^Subject: bayestest
| spamassassin -D 2>$HOME/tmp/sa.err

Yields only this in sa.err:
SpamAssassin version 2.63


--
---------Will McDonald-----------------will@upl.cs.wisc.edu----------
GPG encrypted mail preferred. Join the web-o-trust! Key ID: F4332B28
RE: problems with procmail [ In reply to ]
> -----Original Message-----
> From: Will McDonald [mailto:will@cs.wisc.edu]
> Sent: Monday, February 16, 2004 6:47 PM
> To: spamassassin-users@incubator.apache.org
> Subject: Re: problems with procmail
>
>
> On Mon, Feb 16, 2004 at 08:49:44PM -0500, Theo Van Dinter wrote:
> > > Everything seems to work fine, except for bayes and negative
> tests when
> > > run through procmail. Am I missing something obvious?
> >
> > Well, there aren't really any negative tests (aka: "nice"
> tests) anymore due
> > to forging issues. As for Bayes... If you run with -D it'll
> shed more light
> > on the situation.
>
> Good to know - I compiled 2.63 for this box; the last version I
> was using was
> ~2.4x, and it still had "nice" tests (I like being rewarded for
> using mutt :).
>
> As for bayes: When I 'cat new_message | spamassassin -D'
> everything looks good
> - it identifies all the tokens, gives it a bayes score, and
> correctly applies
> the bayes tests. I tried adding the following procmail rule and
> sending a test
> message, but I don't get any useful debugging output. Is there
> another way I
> can test this?
>
> -will

When you run it through procmail, are you modifying your local
$HOME/.procmailrc file, or the system-wide /etc/procmailrc file?
I assume you're modifying the one in you home directory, but if
you are working on the global /etc/procmailrc file, this is run
as 'root', or possibly a specially designated mail user-id, and
this will result in SA not running as your user id, which would
lead to problems with Bayes and other things.

>
> :0:
> * ^Subject: bayestest
> | spamassassin -D 2>$HOME/tmp/sa.err
>
> Yields only this in sa.err:
> SpamAssassin version 2.63

That's odd. When I run the following for example,

% spamassassin -D < /dev/null
debug: Score set 0 chosen.
debug: running in taint mode? yes
debug: Running in taint mode, removing unsafe env vars, and resetting PATH
[...]
debug: running meta tests; score so far=3.916
debug: auto-learn? ham=0.1, spam=12, body-hits=0, head-hits=3.916
debug: auto-learn: currently using scoreset 3. recomputing score based on
scoreset 1.
debug: Score set 1 chosen.
debug: auto-learn: original score: 3.916, recomputed score: 2.882
debug: Score set 3 chosen.
debug: auto-learn? no: inside auto-learn thresholds
debug: is spam? score=3.916 required=5 tests=DATE_MISSING,FROM_NO_LOWER
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on screamer
X-Spam-Level: ***
X-Spam-Status: No, hits=3.9 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.63

I see a lot of output in the [...] region, and never see just the string
"SpamAssassin version 2.63". Only the "-V" option produces that output:

% spamassassin -V
SpamAssassin version 2.63


Put the following at the top of your .procmailrc file, and look in
$HOME/.procmail.log.

LOGFILE=$HOME/procmail.log
VERBOSE=yes
LOGABSTRACT=yes
Re: problems with procmail [ In reply to ]
On Mon, Feb 16, 2004 at 08:31:22PM -0800, Gary Funck wrote:
> > :0:
> > * ^Subject: bayestest
> > | spamassassin -D 2>$HOME/tmp/sa.err
> >
> > Yields only this in sa.err:
> > SpamAssassin version 2.63

I realized that the problem here was that you can't do redirects in a
procmailrc. I used a one line shell wrapper instead and got useful debug
output. The problem: spamassassin couldn't find DB_File, which is also
installed in my home directory. Apparently $PERL5LIB was being unset.

From procmailrc(5):
For security reasons, upon startup procmail will wipe out
all environment variables that are suspected of modifying
the behavior of the runtime linker.

Setting PERL5LIB explicitly at the top of my .procmailrc did the trick. It's a
slight shame that I have to manage that in two places now, but I'll live. :)

Thanks for the help.

-w

--
---------Will McDonald-----------------will@upl.cs.wisc.edu----------
GPG encrypted mail preferred. Join the web-o-trust! Key ID: F4332B28