You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by "Dan Mahoney, System Admin" <da...@prime.gushi.org> on 2010/07/08 00:09:00 UTC

Passing preferences to spamd?

All,

It seems the only way to pass a preference from spamc to spamd is by 
having a different user-id.

In my specific case, I'd like to report to spamcop using their "quick" UID 
for some mails, but keep all my preferences otherwise the same (so I still 
get the benefits of bayes, dcc, awl, etc).

(Think of this in terms of the -o options to ssh)

Since I'm using the DB backend, I could do some tricks, like modify the 
query to template one set of userprefs over another, I suppose, but it 
would be nice to have a unified way.

It seems there's no way to override an additional pref on the command line 
with any of (spamc, spamd, spamassassin) -- you have to override the whole 
file, and sometimes even more than that, in the case of spamc/spamd.

-Dan

-- 

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM
Site:  http://www.gushi.org
---------------------------


Re: [sa-list] Re: Passing preferences to spamd?

Posted by "Dan Mahoney, System Admin" <da...@prime.gushi.org>.
On Thu, 8 Jul 2010, Karsten Bräckelmann wrote:

> On Wed, 2010-07-07 at 18:09 -0400, Dan Mahoney, System Admin wrote:
>> It seems the only way to pass a preference from spamc to spamd is by
>> having a different user-id.
>>
>> In my specific case, I'd like to report to spamcop using their "quick" UID
>> for some mails, but keep all my preferences otherwise the same (so I still
>> get the benefits of bayes, dcc, awl, etc).
>
> Correct. You cannot pass anything spamd / spamassassin (the CLI tool)
> accepts as options via spamc.
>
>> Since I'm using the DB backend, I could do some tricks, like modify the
>> query to template one set of userprefs over another, I suppose, but it
>> would be nice to have a unified way.
>
> User prefs in DB? Then having specific sets of user_prefs (and only
> what's allowed in there, no spamd options obviously) should be simple.
>
> Have a look at the spamc -u username option.

Yes, I saw that...what I need to do is come up with a "clever" way of 
saying if I pass an "impossible" username, such as danm_reporting, the 
query does the right thing.  (Since the mysql command language has a split 
function, I should be able to do this without touching the spamassassin 
code.)

I might have to also modify the sql queries for the bayes/awl backends as 
well, so they know danm_report is really "danm", since reporting also 
includes learning.

This also opens up the possibility of creating a more strict setup for 
different email addresses, so -u danm_strict could have a required_score 
of 2, for addresses that are more agressively spammed.  (Yes, this would 
take multiple passes through spamd or some special procmail logic).

> IIRC it works with DB backend. From memory, since I once tried long ago,
> it does not work if you're using $HOME based user_prefs and running
> spamc as an ordinary user.
>
> If you want to see the behavior for yourself, please use the netcat
> trick I mentioned in a previous thread of yours. Run netcat listening on
> one port, and make spamc use that port -- you'll see the simple protocol
> headers, including the User to use by spamd, if possible.

Knowing the headers is good, but being able to know what they look like, 
and knowing how to get the application to set them are two different 
problems, from my point of view.  There are people who debug with syslog 
and -v, there are people who debug with tcpdump, and there are people who 
debug with strace.  I'm the syslog type.

>> It seems there's no way to override an additional pref on the command line
>> with any of (spamc, spamd, spamassassin) -- you have to override the whole
>> file, and sometimes even more than that, in the case of spamc/spamd.
>
> It is possible with spamassassin, as fine-grained as you want with any
> setting. See the --cf option in man spamassassin-run.

At that point, I could in fact use spamassassin to point at the DB server 
where my bayes and awl, etc, live, the only real difference is in which 
cpu parses the message, the end effect is the same.

My biggest problem with this, as I had brought up a while ago, is that I'd 
need to run spamassassin setGID, and put the db files in a different 
config that's not world-readable by all.

I once wrote a small-but-useful tool which publishes your user_prefs to a 
database (and also fetches), asked on this list if people wanted it for 
CONTRIB.  No reply.

-Dan

-- 

Hate fedora with a white hot burning passion right now though ... damn thing is Linux-XP(tm)

-Bill Nolan
2/24/04

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM
Site:  http://www.gushi.org
---------------------------

Re: Passing preferences to spamd?

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Wed, 2010-07-07 at 18:09 -0400, Dan Mahoney, System Admin wrote:
> It seems the only way to pass a preference from spamc to spamd is by 
> having a different user-id.
> 
> In my specific case, I'd like to report to spamcop using their "quick" UID 
> for some mails, but keep all my preferences otherwise the same (so I still 
> get the benefits of bayes, dcc, awl, etc).

Correct. You cannot pass anything spamd / spamassassin (the CLI tool)
accepts as options via spamc.

> Since I'm using the DB backend, I could do some tricks, like modify the 
> query to template one set of userprefs over another, I suppose, but it 
> would be nice to have a unified way.

User prefs in DB? Then having specific sets of user_prefs (and only
what's allowed in there, no spamd options obviously) should be simple.

Have a look at the spamc -u username option.

IIRC it works with DB backend. From memory, since I once tried long ago,
it does not work if you're using $HOME based user_prefs and running
spamc as an ordinary user.

If you want to see the behavior for yourself, please use the netcat
trick I mentioned in a previous thread of yours. Run netcat listening on
one port, and make spamc use that port -- you'll see the simple protocol
headers, including the User to use by spamd, if possible.


> It seems there's no way to override an additional pref on the command line 
> with any of (spamc, spamd, spamassassin) -- you have to override the whole 
> file, and sometimes even more than that, in the case of spamc/spamd.

It is possible with spamassassin, as fine-grained as you want with any
setting. See the --cf option in man spamassassin-run.

  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; }}}