procmail config help

2010-11-17 Thread AN
I am trying to configure sendmail with spamassassin to move mail marked as 
spam to a spam folder in the users home directory.  I have the following

installed:

p5-Mail-SpamAssassin-3.3.1 A highly efficient mail filter for identifying 
spam
razor-agents-2.84   A distributed, collaborative, spam detection and 
filtering
spamass-milter-0.3.1_10 Sendmail Milter (mail filter) plugin for 
SpamAssassin

p5-Mail-DKIM-0.38   Perl5 module to process and/or create DKIM email
procmail-3.22_6 A local mail delivery agent

I would like to setup this configuration for each individual instead of 
system wide.  I have the following procmail file in the user home 
directory:


#Uncomment the following lines and use tail -f procmail.log to debug
LOGFILE=/home/andy/procmail.log
VERBOSE=yes
LOGABSTRACT=all

# Feed redirected spam to sa-learn, and also store a copy in a folder 
called spam.
# This folder of false negatives could be useful if we needed to rebuild 
our Bayes

# database in the future.

:0
* ^To:.*s...@example.com

   {
   *  256000
   :0c: spamassassin.spamlock
   | sa-learn --spam

   :0: spamassassin.filelock
   spam
   }

# Send all other mail through SpamAssassin

:0fw: spamassassin.lock
*  256000
| spamassassin


:0: spamassassin.filelock2
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
#/dev/null
/home/andy/Mail/spam

Spam messages are still being delivered to the user inbox.

I tried to setup logging with the following:

LOGFILE=/home/andy/procmail.log
VERBOSE=yes
LOGABSTRACT=all

When I tried to send a test spam message nothing is written to the log 
file.

How can I get logging to work to try to debug the problem?

If anyone has a working procmail config file to share that would be 
appreciated.


Any help debugging this would be greatly appreciated.


TIA

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: procmail config help

2010-11-17 Thread Karl Vogel
 On Wed, 17 Nov 2010 19:59:10 + (UTC), 
 AN a...@neu.net said:

A If anyone has a working procmail config file to share that would be
A appreciated.

   When messing with procmail, start with the simplest setup that can
   possibly work.  Your logfile has to exist, or procmail will ignore it.
   If you already have a working .procmailrc file, here's a safe way to
   add tweaks:

   1. copy an existing mail message to /tmp/msg,
   2. cp $HOME/.procmailrc $HOME/.procnew and DON'T touch the original,
   3. run procmail -m $HOME/.procnew  /tmp/msg to test.

   Try the .procmailrc skeleton below.  The .whitelist and .blacklist files
   hold email addresses (one per line) that you want to pass or block,
   respectively.  Logfiles are stored in the user's ~/mail directory.

-- 
Karl Vogel  I don't speak for the USAF or my company

Why you might be the reincarnation of someone famous #11:
When your boss criticizes your sales projection figures, you hack off your ear.
--The Top Five List, t...@walrus.com

---
# $Revision: 1.60+6 $ $Date: 2010-07-08 15:19:01-04 $
#
# NAME:
#$HOME/.procmailrc
#
# DESCRIPTION:
#procmail handles local mail delivery.  Use this file to:
#- store your mail in a given folder,
#- forward or discard mail depending on the contents, or
#- run your mail through a program automatically.

# Search path.
PATH=/usr/local/bin:/bin:/usr/bin:$HOME/bin

# Default mail folder.
DEFAULT=/var/mail/andy

# Current directory while procmail is executing.
# All pathnames are relative to this directory.
MAILDIR=$HOME/mail

# File containing error messages or diagnostics.  If this
# file does not exist, said messages will be bounced
# back to the message sender.
LOGFILE=$MAILDIR/MAILLOG

# If yes, keep an abstract of the From and Subject lines of
# each delivered message, the folder it was delivered to,
# and the size of the message.  If no, skip this abstract.
LOGABSTRACT=yes

# If on, describe actions of procmail in detail.
#VERBOSE=on

# Number of seconds before procmail zaps a lockfile by force.
LOCKTIMEOUT=5

# Default shell and umask value.
SHELL=/bin/sh
UMASK=022

# Frequently-used variables.
WEEK=`/bin/date +%Yw%W`

#
# Rules section.
#
# RULE: Save a copy of all incoming headers in a file called
#   $HOME/mail/HEADERS.wNN
#   where  = year
#   NN = the week number starting on Monday.

:0 chw: $HOME/hdr.lck
| /bin/cat -  $HOME/mail/HEADERS.$WEEK;

#
# RULE: pass anything in the sender whitelist.

:0:
* ? formail -xFrom: -xFrom -xTo: -xReply-To: -xCc: \
 | fgrep -is -f $HOME/.whitelist
$DEFAULT

#
# RULE: kill anything in the sender blacklist.

:0:
* ? formail -xFrom: -xFrom -xTo: -xReply-To: -xCc: \
 | fgrep -is -f $HOME/.blacklist
spam-folder

#
# Keep everything else.

:0 :
$DEFAULT
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: procmail config help

2010-11-17 Thread doug

On Wed, 17 Nov 2010, AN wrote:

I am trying to configure sendmail with spamassassin to move mail marked as 
spam to a spam folder in the users home directory.  I have the following

installed:

p5-Mail-SpamAssassin-3.3.1 A highly efficient mail filter for identifying 
spam
razor-agents-2.84   A distributed, collaborative, spam detection and 
filtering

spamass-milter-0.3.1_10 Sendmail Milter (mail filter) plugin for SpamAssassin
p5-Mail-DKIM-0.38   Perl5 module to process and/or create DKIM email
procmail-3.22_6 A local mail delivery agent

I would like to setup this configuration for each individual instead of 
system wide.  I have the following procmail file in the user home directory:


#Uncomment the following lines and use tail -f procmail.log to debug
LOGFILE=/home/andy/procmail.log
VERBOSE=yes
LOGABSTRACT=all

# Feed redirected spam to sa-learn, and also store a copy in a folder called 
spam.
# This folder of false negatives could be useful if we needed to rebuild our 
Bayes

# database in the future.

:0
* ^To:.*s...@example.com

  {
  *  256000
  :0c: spamassassin.spamlock
  | sa-learn --spam

  :0: spamassassin.filelock
  spam
  }

# Send all other mail through SpamAssassin

:0fw: spamassassin.lock
*  256000
| spamassassin


:0: spamassassin.filelock2
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
#/dev/null
/home/andy/Mail/spam

Spam messages are still being delivered to the user inbox.

I tried to setup logging with the following:

LOGFILE=/home/andy/procmail.log
VERBOSE=yes
LOGABSTRACT=all

When I tried to send a test spam message nothing is written to the log file.
How can I get logging to work to try to debug the problem?

If anyone has a working procmail config file to share that would be 
appreciated.


Any help debugging this would be greatly appreciated.

TIA


Do you have a shell statement in your procmailrc file? Anyway here is an example 
of what we use. It is a combination of bogofilter and spamassassin. If this does 
not help, make things simple, start with some of the examples in man procmailex.


SHELL=/bin/sh
# Directory for storing procmail configuration and log files
COMSAT=no
PATH=/bin:/usr/bin:/usr/local/bin/
FGREP=/usr/bin/fgrep
FROM=`formail -x From:`
MAILDIR=$HOME
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/`date +%Y%m`.log
DEFAULT=$HOME/mbox
##LOGABSTRACT=all
VERBOSE=no
SPAMDIR=spam`date +%m%y`

## whitelist
:0
 * ? (echo $FROM | $FGREP -iqf $PMDIR/whitelist)
 ${DEFAULT}

## filter mail through bogofilter, tagging it as spam and
## updating the word lists
:0fw
| bogofilter -e -p

# if bogofilter failed, return the mail to the queue, the MTA will
# retry to deliver it later
# 75 is the value for EX_TEMPFAIL in /usr/include/sysexits.h
:0e
{ EXITCODE=75 HOST }

# if bogofilter thinks it is spam, that's enough..
:0
* ^X-Bogosity: Yes
{
   LOG=bogofilter
   :0
   $SPAMDIR
}

# run spam assassin on it!
:0fw: spamassassin.lock
| spamassassin -L

# if spam assassin thinks it is spam but bogofilter doesn't,
# give preference to spam assassin and retrain BF
:0
* ^X-Spam-Status: Yes
* ^X-Bogosity: No
{
  # Retrain bogofilter
  :0c
  | bogofilter -Ns

  LOG=spamassassin
  :0
  $SPAMDIR
}

I edited this a bit to remove user specific information, so I may have 
introduced an error. This file will [should??] log if you make the appropriate 
changes.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org