Re: Add rule hits to all emails?

2009-06-09 Thread Steeve McCauley
See add_header in the docs,

http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Conf.html

On Tue, Jun 09, 2009 at 10:42:30AM +0100, Rob Sharp wrote:
 Hi there,
 
 A little while back someone posted an entry one can add to user_prefs to 
 cause the SA rule breakdown to be added to the headers of all emails.
 
 I'm sure I saved the email somewhere, but cannot find it any more. Would 
 someone be kind enough to repost it please?
 
 Rob

-- 
Steeve McCauley  ste...@oneguycoding.com
:wq  http://oneguycoding.com
CARTESIAN, adj. Relating to Descartes, a famous philosopher, author of the
celebrated dictum, Cogito ergo sum — whereby he was pleased to suppose he
demonstrated the reality of human existence. The dictum might be improved,
however, thus: Cogito cogito ergo cogito sum — I think that I think,
therefore I think that I am; as close an approach to certainty as any
philosopher has yet made. -- Ambrose Bierce, The Devil's Dictionary


spamc not defaulting to my user

2009-06-04 Thread Steeve McCauley
I just spent the better part of the last month trying to figure
out why my baysian filtering was not working on a new mail server
setup.  I noticed yesterday, after adding the following header,

add_header all Bayes bayes=_BAYES_ tokens=_TOKENSUMMARY_ new=_BAYESTC_ 
seen=_BAYESTCLEARNED_ spammy=_BAYESTCSPAMMY_ hammy=_BAYESTCHAMMY_

that tokens was always being set to Bayes not run.  But there
was no indication anywhere (that I could find) why it was not being
run.  Most of the list traffic associated with this particular
problem seemed to be associated with people using mysql as their
data store, not something that I am doing.  I had verified that
sa-learn was working properly and updating my database and that
the database version was good, and that I had enough of both ham
and spam in the database, etc.

spammassassin -D --lint all looked good when run from the command
line.

Today on a whim I decided to add -u username to the spamc 
command line in my procmail filter and bayes started working.

This is how my daemon is running,

/openpkg/bin/spamd
--daemonize
--siteconfigpath=/openpkg/etc/spamassassin
--pidfile=/openpkg/var/spamassassin/spamassassin.pid
--syslog=/openpkg/var/spamassassin/spamassassin.log
--listen-ip=127.0.0.1
--port=783
-A 127.
--local

I discovered in the syslog the following difference before and
after the change,

Thu Jun  4 07:40:03 2009 [29789] info: spamd: setuid to openpkg-r succeeded
Thu Jun  4 08:15:02 2009 [29789] info: spamd: setuid to steeve succeeded

so it's now obvious that it was running as user openpkg-r, rather
than my user own user name, which is the user under which spamd is
running.  Now the man page states that it is using the Effective UID 
of the caller, which I had assumed was my user name.

   -u username, --username=username
   To have spamd use per-user-config files, run spamc as the user whose 
config files spamd should load; by default the effective
   user-ID is sent to spamd.  If you’re running spamc as some other 
user, though, (eg. root, mail, nobody, cyrus, etc.) then you may
   use this flag to override the default.

spamc -h is a little less ambiguous,

  -u, --username username
  User for spamd to process this message under.
  [default: current user]

The mystery for me is why spamd was doing setuid to it's own uid rather
than my uid, unless I forced it with the -u switch.  I know that procmail
is not running as user openpkg-r which just adds to the mystery.

Any ideas?

-- 
Steeve McCauley  ste...@oneguycoding.com
:wq  http://oneguycoding.com
I like a man who grins when he fights.
- Winston Churchill


Re: spamc not defaulting to my user

2009-06-04 Thread Steeve McCauley
On Thu, Jun 04, 2009 at 06:28:18PM +0200, Karsten Bräckelmann wrote:
 On Thu, 2009-06-04 at 11:29 -0400, Steeve McCauley wrote:
  I just spent the better part of the last month trying to figure
  out why my baysian filtering was not working on a new mail server
  setup.  [...]
 
  Today on a whim I decided to add -u username to the spamc 
  command line in my procmail filter and bayes started working.
 
  I discovered in the syslog the following difference before and
  after the change,
  
  Thu Jun  4 07:40:03 2009 [29789] info: spamd: setuid to openpkg-r succeeded
  Thu Jun  4 08:15:02 2009 [29789] info: spamd: setuid to steeve succeeded
  
  so it's now obvious that it was running as user openpkg-r, rather
  than my user own user name, which is the user under which spamd is
 
 I believe this is wrong. spamd appears to be running as root. Otherwise,
 it would not have setuid'ed to the user in the first place.

spamd is running as root, but it does a setuid to openpkg-r
when recieving from spamc, unless I use -u steeve.

  of the caller, which I had assumed was my user name.
 
  spamc -h is a little less ambiguous,
  
-u, --username username
User for spamd to process this message under.
[default: current user]
  
  The mystery for me is why spamd was doing setuid to it's own uid rather
  than my uid, unless I forced it with the -u switch.  I know that procmail
  is not running as user openpkg-r which just adds to the mystery.
 
 My guess is, this assumption is wrong. :)  At least at the point in the
 procmail recipe where spamc is being called, procmail appears to run as
 the openpkg-r user.
 
 spamc tells the user it is running as by default.
 
 
  Any ideas?
 
 Just to verify, try adding something like this to your procmailrc, right
 before the recipe that filters through spamc. Then check the log. (Note,
 linebreak intended.)
 
 LOG = Hello, I am ${LOGNAME}.
 

Procmail is running as steeve,

Hello, I am steeve.
From medicalhairrestoration...@hairproonline.com  Thu Jun  4 14:05:08 2009
 Subject: [SPAM 4.6] RE: Hair news : Free DVD 
  Folder: /var/mail/steeve   341674

It woudl have been incredbily perplexing if procmail were running
as an openpkg user since it's not an openpkg package.

Something is weird here between spamc and spamd.

Thanks for the reply,

steeve

-- 
Steeve McCauley  ste...@oneguycoding.com
:wq  http://oneguycoding.com
The mistake you make is in trying to figure it out.
- Tenessee Williams


Re: spamc not defaulting to my user

2009-06-04 Thread Steeve McCauley
On Thu, Jun 04, 2009 at 09:41:48PM +0200, Karsten Bräckelmann wrote:
Any ideas?
   
   Just to verify, try adding something like this to your procmailrc, right
   before the recipe that filters through spamc. Then check the log. (Note,
   linebreak intended.)
   
   LOG = Hello, I am ${LOGNAME}.
   
  
  Procmail is running as steeve,
  
  Hello, I am steeve.
 
 Weird. :)  Honestly, I quickly pulled LOGNAME out of the man page. I'm
 not entirely sure this really reflects the UID. I guess I'd alter that
 debugging log line, to dump some other information, to track this down.
 
 BTW, is this a site-wide procmailrc or a user one? Did you DROPPRIVS
 before that, in case of site-wide?

It's my user .procmailrc.

 
  From medicalhairrestoration...@hairproonline.com  Thu Jun  4 14:05:08 2009
   Subject: [SPAM 4.6] RE: Hair news : Free DVD 
Folder: /var/mail/steeve   
  341674
  
  It woudl have been incredbily perplexing if procmail were running
  as an openpkg user since it's not an openpkg package.
 
 But spamc is. Not that that really should matter, but there's a link.
 Any chance it's a setuid executable?

That's it, mystery solved :)

[ste...@oneguycoding .procmail]$ ls -l /openpkg/bin/spamc 
-rwsr-xr-x 1 openpkg-r openpkg 393128 Apr 23 12:27 /openpkg/bin/spamc

Thanks for your help, I was pulling my hair out for a while
on this one.

Cheers,

steeve

-- 
Steeve McCauley  ste...@oneguycoding.com
:wq  http://oneguycoding.com
What this country needs is a good five cent microcomputer.


Re: spamc not defaulting to my user

2009-06-04 Thread Steeve McCauley
On Thu, Jun 04, 2009 at 10:04:46PM +0200, Karsten Bräckelmann wrote:
 On Thu, 2009-06-04 at 15:54 -0400, Steeve McCauley wrote:
  On Thu, Jun 04, 2009 at 09:41:48PM +0200, Karsten Bräckelmann wrote:
 
It woudl have been incredbily perplexing if procmail were running
as an openpkg user since it's not an openpkg package.
   
   But spamc is. Not that that really should matter, but there's a link.
   Any chance it's a setuid executable?
  
  That's it, mystery solved :)
 
 Yay!
 
  [ste...@oneguycoding .procmail]$ ls -l /openpkg/bin/spamc 
  -rwsr-xr-x 1 openpkg-r openpkg 393128 Apr 23 12:27 /openpkg/bin/spamc
  
  Thanks for your help, I was pulling my hair out for a while
  on this one.
 
 No problem. :)  And please blame your packager, this is not default. ;)

Done.

-- 
Steeve McCauley  ste...@oneguycoding.com
:wq  http://oneguycoding.com
A gift of flower will soon be made to you.