Re: A few basic questions about custom rules

2010-03-26 Thread C. Bensend

I received answers to my questions off-list, so I'll reply to myself
and share them with the rest of everyone.  :)

> describe CJB_ESHOP_GR Contains reference to e-shop.gr
> header CJB_ESHOP_GR ALL =~ /e-shop\.gr/i
> score CJB_ESHOP_GR 0.01
>
>The efficiency and wisdom of matching against any headers aside,
> is this correct so far?  I'm just thinking simple, I just want to
> match the e-shop.gr string.

While not the best way to catch one of these emails, this will
indeed do what I had intended - match the string 'e-shop.gr' in
any of the email headers.

>Assuming that's OK, I moved on to creating the rule.  Now, I store
> my user preferences in a PostgreSQL database, so this is where I'm
> slightly unsure...  Can I simply add my rule above to my userprefs
> table, one line per row?  Like so (pardon the line wrap):

>Is this the correct way to do it?  Or do I *have* to add them to
> local.cf or another such local file?

Nope, this isn't possible - rules cannot be stored in a database,
nor will most installations allow user-defined rules.  I went
ahead and created my own .cf file in /etc/mail/spamassassin,
and that works great.

>I'm also unsure if I need to restart spamd to pick up on this new
> rule, if indeed it can be stored in SQL - my other userprefs do not
> need a restart, but rules I'm very unsure about.  I tried cat'ing a
> sample spam and piping it to spamc (cat sample.txt | spamc), but
> it did not hit my test rule.  And yes, e-shop.gr shows up in the
> Received and From headers.  :)

Yes, a restart is necessary.  Always do a 'spamassassin --lint'
first, too.

Thank you!

Benny


-- 
Whoever said that hell hath no fury like a women scorned never
owned a cat.
  -- bash.org



A few basic questions about custom rules

2010-03-26 Thread C. Bensend

Hey folks,

   I'm playing around with writing some rules, something I've
never done before.  I'm not looking to do anything fancy, I just
wanted to learn how to do it.

   So, I picked one of my spams at total random, and wanted to
match on "e-shop.gr" in any of the headers.  The rule, I believe,
should look like this:

describe CJB_ESHOP_GR Contains reference to e-shop.gr
header CJB_ESHOP_GR ALL =~ /e-shop\.gr/i
score CJB_ESHOP_GR 0.01

   The efficiency and wisdom of matching against any headers aside,
is this correct so far?  I'm just thinking simple, I just want to
match the e-shop.gr string.

   Assuming that's OK, I moved on to creating the rule.  Now, I store
my user preferences in a PostgreSQL database, so this is where I'm
slightly unsure...  Can I simply add my rule above to my userprefs
table, one line per row?  Like so (pardon the line wrap):

db=> SELECT prefid, username, preference, value FROM userpref WHERE
username = 'me' AND preference LIKE '%CJB%' ORDER BY preference;
 prefid | username |  preference   |  value
+--+---+-
450 | me| describe CJB_ESHOP_GR | Contains reference to e-shop.gr
452 | me| header CJB_ESHOP_GR   | ALL =~ /e-shop\.gr/i
453 | me| score CJB_ESHOP_GR| 0.01
(3 rows)

   Is this the correct way to do it?  Or do I *have* to add them to
local.cf or another such local file?

   I'm also unsure if I need to restart spamd to pick up on this new
rule, if indeed it can be stored in SQL - my other userprefs do not
need a restart, but rules I'm very unsure about.  I tried cat'ing a
sample spam and piping it to spamc (cat sample.txt | spamc), but
it did not hit my test rule.  And yes, e-shop.gr shows up in the
Received and From headers.  :)

   This is SpamAssassin 3.2.5 FYI.  Thanks, folks!

Benny


-- 
Whoever said that hell hath no fury like a women scorned never
owned a cat.
  -- bash.org



Re: Basic Questions

2005-07-28 Thread Matt Kettler
John D. Maag wrote:
> Ok, If I put preferences in the user_prefs file in $HOME/.spamassassin, do I 
> call the file the same thing in /etc/mail/spamassassin?
> 

Short answer:

No. SA reads /etc/mail/spamassassin/*.cf. It will not read user_prefs from this
directory.

Most people use local.cf if they only have one local site-wide options file.


Details:

SA parses the following files, in order:

/etc/mail/spamassassin/*.pre   (sa 3.0+ only, for loadplugin statements)
/usr/share/spamassassin/*.cf(default rules)
/etc/mail/spamassassin/*.cf (local site-wide rules and options)
~/.spamassassin/user_prefs  (user preferences)




Re: Basic Questions

2005-07-28 Thread Bob McClure Jr
On Wed, Jul 27, 2005 at 10:45:10PM -0500, John D. Maag wrote:
> Ok, If I put preferences in the user_prefs file in $HOME/.spamassassin, do I 
> call the file the same thing in /etc/mail/spamassassin?

No.  The traditional filename is local.cf, but any file named *.cf in
/etc/mail/spamassassin will be read and used.

Cheers,
-- 
Bob McClure, Jr. Bobcat Open Systems, Inc.
[EMAIL PROTECTED]  http://www.bobcatos.com
God doesn't have (or need) a Plan B.


Re: Basic Questions

2005-07-28 Thread Kai Schaetzl
John D. Maag wrote on Wed, 27 Jul 2005 22:45:10 -0500:

> Ok, If I put preferences in the user_prefs file in $HOME/.spamassassin, do I 
> call the file 
the same thing in 
> /etc/mail/spamassassin?

Now, that's not clear. What do you mean? Files in /etc/mail/spamassassin should 
end in *.cf 
and are used for all SA operations. If you put a file in your home dir it will 
only be used 
when SA is called by your user and you cannot use all directives. I don't know 
if it should 
end in *.cf but I assume.

Kai

-- 
Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com
IE-Center: http://ie5.de & http://msie.winware.org





Basic Questions

2005-07-27 Thread John D. Maag
Ok, If I put preferences in the user_prefs file in $HOME/.spamassassin, do I 
call the file the same thing in /etc/mail/spamassassin?


Re: Basic Questions

2005-07-27 Thread Theo Van Dinter
On Wed, Jul 27, 2005 at 09:11:22PM -0500, John D. Maag wrote:
> scenario. Somehow Sendmail is calling procmal for me so I do nto need =
> the .forward file. If someone knows how that could be happening I would 
> love to know how I got lucky.

Most Linux distros, since you said you're using RH9, setup procmail as
the local delivery agent.

> 1) I am not sur eof the locations the installation of spamassassin is =
> using. I do not know if it is using my ~/.spamassassin or =
> /etc/mail/spamassassin or both. The main reason I ask is I think an =

Both, depending on how you call SA.  If you ever want to know what
SpamAssassin is doing, run a message through "spamassassin -D" and it'll
tell you what files are being read, etc.

> custom rules and cf files and in particular an sa-blacklist.current 
> file =
> but I am not sure where to put the cf files, etc so that spamd/spamc =
> will see them.

/etc/mail/spamassassin are for site-wide local rules.

> 2) I want to convert to a site installation so I can use one setting 
> for =
> required score, custom rules (contents of user_prefs). How can I do =
> this? IMO the docs on the web site are inadequate.

Well, you can always set site wide configuration, per-user configs are allowed
by default but can easily be shut off if using spamd (see the man page).

-- 
Randomly Generated Tagline:
"Don't mock the cookie." - Jackie Chan Adventures


pgpiTCqyYnQz8.pgp
Description: PGP signature


Basic Questions

2005-07-27 Thread John D. Maag

Setup Redhat 9
Spamassassin  3.0.4

I am struggling with learning the basics about spamassassin. I think I 
=
have it going now but I am still not sure. I stumbled into a working =
scenario. Somehow Sendmail is calling procmal for me so I do nto need =
the .forward file. If someone knows how that could be happening I would 
=
love to know how I got lucky.

1) I am not sur eof the locations the installation of spamassassin is =
using. I do not know if it is using my ~/.spamassassin or =
/etc/mail/spamassassin or both. The main reason I ask is I think an =
existing install was there befor emy make. I am trying to install some 
=
custom rules and cf files and in particular an sa-blacklist.current 
file =
but I am not sure where to put the cf files, etc so that spamd/spamc =
will see them.


2) I want to convert to a site installation so I can use one setting 
for =
required score, custom rules (contents of user_prefs). How can I do =
this? IMO the docs on the web site are inadequate.