You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by le...@srs.gov on 2008/03/05 17:05:39 UTC

Adding custom Mime headers

I'm trying to get the RelayCountry plugin running here in order to get a 
Mime header of all of the relay countries put on all messages.

We're running 3.1.1, and I've implemented the necessary patch to 
Mail::SpamAssassin::Plugin::RelayCountry.

Running SA in debug, I can see that the plugin is doing its work just 
fine.  The X-Relay-Countries is returning expected values in the debug 
output.

However, after adding "add_header all Relay-Countries _RELAYCOUNTRY_" to 
my /etc/mail/spamassassin/local.cf file, there is no header being added. 
To check this even further, I put "add_header all Test-LG 'This is a 
test'" into the /etc/mail/spamassassin/local.cf file.  That header isn't 
being added either.

I've checked through the wiki, eliminated all possibilities of user_prefs 
overriding local.cf and cannot figure out why add_header isn't working for 
me.  No Amavisd or Exim in front.

Does anyone have any ideas or experience with this?


Leonard Gray 
Information Technology Services, Washington Savannah River Company 
Collaborative Technologies Administration 
Internet: leonard.gray@srs.gov
Phone: (803) 725-6022 

 


Re: Adding custom Mime headers

Posted by le...@srs.gov.
Matt Kettler <mk...@verizon.net> wrote on 03/05/2008 08:07:49 PM:

> [image removed] 
> 
> Re: Adding custom Mime headers
> 
> Matt Kettler 
> 
> to:
> 
> leonard.gray
> 
> 03/05/2008 08:07 PM
> 
> Cc:
> 
> users
> 
> leonard.gray@srs.gov wrote:
> >
> > I'm trying to get the RelayCountry plugin running here in order to get 

> > a Mime header of all of the relay countries put on all messages.
> >
> > We're running 3.1.1, and I've implemented the necessary patch to 
> > Mail::SpamAssassin::Plugin::RelayCountry.
> Ouch, why are you using such an old version? (and one that's subject to 
> numerous DoS attacks at that)


Yes, I know I'm behind.  Looked at 3.2.0 when it came out and after 
monitoring this forum for reported problems, decided against attempting. 
Looks like 3.2.4 is relatively stable, so as I re-engineer our world to 
get these Mime headers into the messages (I think amavisd will handle), 
I'll likely upgrade SA as well.

Thanks to all for the help!

Re: Adding custom Mime headers

Posted by Matt Kettler <mk...@verizon.net>.
leonard.gray@srs.gov wrote:
>
> I'm trying to get the RelayCountry plugin running here in order to get 
> a Mime header of all of the relay countries put on all messages.
>
> We're running 3.1.1, and I've implemented the necessary patch to 
> Mail::SpamAssassin::Plugin::RelayCountry.
Ouch, why are you using such an old version? (and one that's subject to 
numerous DoS attacks at that)

Offhand, 3.1.1 is vulnerable to:

http://spamassassin.apache.org/advisories/cve-2007-2873.txt
http://spamassassin.apache.org/advisories/cve-2007-0451.txt
http://spamassassin.apache.org/advisories/cve-2006-2447.txt

We're on 3.2.4 now...

>
> Running SA in debug, I can see that the plugin is doing its work just 
> fine.  The X-Relay-Countries is returning expected values in the debug 
> output.
>
> However, after adding "add_header all Relay-Countries _RELAYCOUNTRY_" 
> to my /etc/mail/spamassassin/local.cf file, there is no header being 
> added.  To check this even further, I put "add_header all Test-LG 
> 'This is a test'" into the /etc/mail/spamassassin/local.cf file.  That 
> header isn't being added either.
>
> I've checked through the wiki, eliminated all possibilities of 
> user_prefs overriding local.cf and cannot figure out why add_header 
> isn't working for me.  No Amavisd or Exim in front.
>
> Does anyone have any ideas or experience with this?
The _RELAYCOUNTRY_ tag doesn't work in 3.1.1 due to a bug, it was fixed 
for 3.1.2.

See this thread from almost 2 years ago when 3.1.1 was a current version 
of SpamAssassin:

http://mail-archives.apache.org/mod_mbox/spamassassin-users/200604.mbox/%3C20060424190930.GA14250@manifold.algebra.com%3E




Re: Adding custom Mime headers

Posted by David B Funk <db...@engineering.uiowa.edu>.
On Wed, 5 Mar 2008 leonard.gray@srs.gov wrote:

> Karsten Bräckelmann <gu...@rudersport.de> wrote on 03/05/2008 01:13:11
> PM:
>
> > On Wed, 2008-03-05 at 11:05 -0500, leonard.gray@srs.gov wrote:
> > >
> > > I'm trying to get the RelayCountry plugin running here in order to get
> > > a Mime header of all of the relay countries put on all messages.
> > >
[snip..]
> Thanks,
>
> I think I might have figured out the problem here.  I'm using SA with
> Sendmail, and using spamass-milter which I believe is not capable of
> passing the headers back.  I just started down this path, but think it is
> the cause.

When using sendmail + milter, it won't work unless you modify the milter
code. sendmail hands a -copy- of the message to the milter which then
passes it on to SA. It does not matter what SA does with the message,
the original is not changed, unless the milter takes explicit steps
to tell sendmail to change it in some way.

Usual practice is to code the milter to hand the message to SA, look
at the returned results and then the milter explicitly tells sendmail
to add specific headers to the message.

So if you want to add addtional headers to the processed message
you'll have to hack the milter code to add them.

Dave

-- 
Dave Funk                                  University of Iowa
<dbfunk (at) engineering.uiowa.edu>        College of Engineering
319/335-5751   FAX: 319/384-0549           1256 Seamans Center
Sys_admin/Postmaster/cell_admin            Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{

Re: Adding custom Mime headers

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Wed, 2008-03-05 at 13:22 -0500, leonard.gray@srs.gov wrote:
> I think I might have figured out the problem here.  I'm using SA with
> Sendmail, and using spamass-milter which I believe is not capable of
> passing the headers back.  I just started down this path, but think it
> is the cause. 

Part of the reason I asked how you tested this exactly. To see if it
works with SA, just feed it a mail:
  $ spamassassin  < message

This should add the headers. And if you're using spamd, you'll have to
restart it after editing the conf.

  guenther


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: Adding custom Mime headers

Posted by le...@srs.gov.
Karsten Bräckelmann <gu...@rudersport.de> wrote on 03/05/2008 01:13:11 
PM:

> [image removed] 
> 
> Re: Adding custom Mime headers
> 
> Karsten Bräckelmann 
> 
> to:
> 
> users
> 
> 03/05/2008 01:13 PM
> 
> On Wed, 2008-03-05 at 11:05 -0500, leonard.gray@srs.gov wrote:
> > 
> > I'm trying to get the RelayCountry plugin running here in order to get
> > a Mime header of all of the relay countries put on all messages. 
> > 
> > We're running 3.1.1, and I've implemented the necessary patch to
> > Mail::SpamAssassin::Plugin::RelayCountry. 
> 
> Which one? The discussion in bug 3815 [1] suggests, that 3.1.1 already
> got some code added -- which unfortunately did not work. A correct fix
> went in into 3.1.2.
> 
> Also, what about upgrading your SA rather than applying patches? ;)
> Even if upgrading to 3.2 is not an option, there have been quite a few
> 3.1.x releases since 3.1.1...
> 
> 
> Any chance you got multiple RelayCountry.pm on your system and patched
> the wrong one?
> 
> Did you 'loadplugin' it as per the docs? The RelayCountry plugin is
> disabled, commented out in init.pre by default in the 3.1 branch.
>   http://wiki.apache.org/spamassassin/RelayCountryPlugin

Thanks, 

I think I might have figured out the problem here.  I'm using SA with 
Sendmail, and using spamass-milter which I believe is not capable of 
passing the headers back.  I just started down this path, but think it is 
the cause.

Re: Adding custom Mime headers

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Wed, 2008-03-05 at 11:05 -0500, leonard.gray@srs.gov wrote:
> 
> I'm trying to get the RelayCountry plugin running here in order to get
> a Mime header of all of the relay countries put on all messages. 
> 
> We're running 3.1.1, and I've implemented the necessary patch to
> Mail::SpamAssassin::Plugin::RelayCountry. 

Which one? The discussion in bug 3815 [1] suggests, that 3.1.1 already
got some code added -- which unfortunately did not work. A correct fix
went in into 3.1.2.

Also, what about upgrading your SA rather than applying patches? ;)
Even if upgrading to 3.2 is not an option, there have been quite a few
3.1.x releases since 3.1.1...


Any chance you got multiple RelayCountry.pm on your system and patched
the wrong one?

Did you 'loadplugin' it as per the docs? The RelayCountry plugin is
disabled, commented out in init.pre by default in the 3.1 branch.
  http://wiki.apache.org/spamassassin/RelayCountryPlugin


> Running SA in debug, I can see that the plugin is doing its work just
> fine.  The X-Relay-Countries is returning expected values in the debug
> output. 

Sounds strangely similar to the discussion in bug 3815.

> However, after adding "add_header all Relay-Countries _RELAYCOUNTRY_"
> to my /etc/mail/spamassassin/local.cf file, there is no header being
> added.  To check this even further, I put "add_header all Test-LG
> 'This is a test'" into the /etc/mail/spamassassin/local.cf file.  That
> header isn't being added either. 

How did you test this, how exactly did you call SA?

> I've checked through the wiki, eliminated all possibilities of
> user_prefs overriding local.cf and cannot figure out why add_header
> isn't working for me.  No Amavisd or Exim in front. 
> 
> Does anyone have any ideas or experience with this?

Works as advertised for me. ;)

  guenther


[1] http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3815

-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: Adding custom Mime headers

Posted by Loren Wilton <lw...@earthlink.net>.
1    Did you restart SA after changing local.cf?
2    Are you calling SA through one of the tools that ifnores the SA markup 
and does its own?

        Loren