You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by EduardoLuis <el...@gmail.com> on 2007/03/16 23:11:13 UTC

Spamassasin in procmail

Hi, 
I have spamassassin working very well in my Slackware 11.0.
I have spamd running as service. I call spamassassin via /etc/procmail.rc.

I have 2 problems, tha i can't solve.
The problem is that, i made a backup of each users acconut by forward the
e-mail to a backup account; so, user foo as  another mailbox called foo-bkp.
First problem: This makes spamassassin to check twice the same e-mail.
Second problem, my internal networks seems no to work. I didn't want
spampassassin to be called when an internal users sends e-mail to another
internal user and to external users.
I wanted spamassassin to be called only when external mail arrives.

Thanks,

EL
-- 
View this message in context: http://www.nabble.com/Spamassasin-in-procmail-tf3417114.html#a9523415
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: Spamassasin in procmail

Posted by Robert S <ro...@gmail.com>.
> I wanted spamassassin to be called only when external mail arrives.

Here's what I used - after a lot of faffing around.  From memory it
inspects the last From: header.  It only scans for spam if the user
has set up a "Spam" folder also:

#/etc/procmailrc
RMIN = 1    # set to your Received count for local mail; may well be 1
WS   = '        '  # a space and a tab inside the single-quotes
MYSERVER = mypc.mydomain.com # Substitute your mailserver here

:0
* $ 1^1 ^Received: from \/[^$WS]+
  {
  RCOUNT = $=
  BOTTOMHOST = $MATCH
  :0fw: spamassassin.lock
  * $  $RCOUNT ^0
  * $ -$RMIN   ^0  MATCH ?? ^^$\MYSERVER^^
  * < 256000
  * ? test -d $HOME/.maildir/.Spam
  | /usr/bin/spamc
  }

Re: Spamassasin in procmail

Posted by "John D. Hardin" <jh...@impsec.org>.
On Fri, 16 Mar 2007, EduardoLuis wrote:

> The problem is that, i made a backup of each users acconut by
> forward the e-mail to a backup account; so, user foo as another
> mailbox called foo-bkp.

There are pills for that.

> I wanted spamassassin to be called only when external mail arrives.

Identify what a Received: header on internally-originated mail looks 
like; it will probably say something like:

 Received: blah blah blah [internal.net.ip.addr] by your.mail.server

Make a procmail rule for that and do something like:

  :0
  < 256000
  ! * ^Received: .*\[internal\.net\.ip\.\d+\].*by your\.mail\.server
  {
     :0 f
     ! /usr/bin/spamc -whatever -flags

     :0
     * look for flagged spam headers
     $HOME/mail/SpamAssassin-INBOX
  }

You might want to take a look at the procmail rule in 
http://www.impsec.org/~jhardin/antispam/ 

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  If someone has a gun and is trying to kill you, it would be
  reasonable to shoot back with your own gun.
                                      -- the Dalai Lama, May 15, 2001
-----------------------------------------------------------------------
 599 days until the Presidential Election