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

Reply via email to