Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: [Opgelost]procmail & clamav & spamassassin  (gelezen 1385 keer)

[Opgelost]procmail & clamav & spamassassin
« Gepost op: 2008/12/21, 21:57:01 »
Hey allemaal,

Het is me gelukt om een emailserver op te zetten (worden emails opgehaald van pop met fetchmail en doorgestuurd met courier)
Maar nu wil ik clamav en spamassassin er ook op laten draaien en als er een virus in zit of het is spam dat het naar de map spam geplaatst wordt.
Maar dit lukt niet helemaal, ik heb nu o.s. configuratie in mijn procmail locatie.
#/home/$user/.procmail
SHELL=/bin/sh

PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
LOGFILE=$MAILDIR/procmail.log

:0:
* ^X-Spam-Status: Yes
spam

:0
* X-Spam-Flag: YES
spam

# Rules for running ClamAV

CLAMSCAN=/usr/bin/clamdscan
VIRUSTARGET=/home/$user/Maildir/virus

:0
* > 10000
* multipart
{
  # Okay, large multipart message run through clamscan
  VIRUS=`$CLAMSCAN --mbox --disable-summary --stdout -`

  :0 Di
  * VIRUS ?? FOUND
  $VIRUSTARGET
}
Wat moet ik nog meer instellen, of weet iemand een goede howto? Of kan ik beter iets anders dan procmail gebruiken.
Zit er nu al een tijdje mee te kloten (clamav en spamassassin zijn geinstalleerd.)

Wie heeft een tip?

edit:
imap en squirrelmail doen het. maar hij herkent geen spam/virus getest met een testvirus van http://www.eicar.org/anti_virus_test_file.htm
Deze ziet hij wel staan als ik scan met clamtk.
« Laatst bewerkt op: 2008/12/22, 23:10:54 door Dennisgroot »

Re: procmail & clamav & spamassassin
« Reactie #1 Gepost op: 2008/12/22, 10:51:14 »
Heb iets gekopierd van een website en nu doet virus herkenning het wel
mijn procmail ziet er nu zo uit
SHELL=/bin/sh

PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
LOGFILE=$MAILDIR/procmail.log

DROPPRIVS=yes

# Delete all messages with dangerous attachments, as long as below a certain size
# Note: Whitespace in [   ] in regex below comprises a space and a tab character
:0
* < 256000
* ! ^Content-Type: text/plain
{
   :0B
   * ^(Content-(Type|Disposition):.*|[    ]*(file)?)name=("[^"]*|[^ ]*)\.(bat|cmd|com|exe|js|pif|scr)
   virus
}

# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw
* < 256000
| spamassassin

# Delete messages with very high spam level
:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*
spam

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "
 
  :0 fhw
  | sed -e '1s/^/F/'
}

# if it wasn't deleted in one of the above rules  Scan everything else for viruses
:0
VIRUS=|clamdscan --disable-summary --stdout -

:0fw
* VIRUS ?? ^.*: \/.* FOUND
| formail -b -f -t -I "X-Clamav-Status: Yes, $MATCH"

:0Efw
| formail -b -f -t -I "X-Clamav-Status: Virus Free"



Re: procmail & clamav & spamassassin
« Reactie #2 Gepost op: 2008/12/22, 13:55:07 »
Probleem is helemaal opgelost voor degene die er wat aan hebben mij procmail
SHELL=/bin/sh

PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
LOGFILE=$MAILDIR/procmail.log

DROPPRIVS=yes

# Delete all messages with dangerous attachments, as long as below a certain size
# Note: Whitespace in [   ] in regex below comprises a space and a tab character
:0
* < 256000
* ! ^Content-Type: text/plain
{
   :0B
   * ^(Content-(Type|Disposition):.*|[    ]*(file)?)name=("[^"]*|[^ ]*)\.(bat|cmd|com|exe|js|pif|scr)
  .Virus/new
}

# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw
* < 256000
| spamassassin

# Delete messages with very high spam level
:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*
.Spam/new

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "
 
  :0 fhw
  | sed -e '1s/^/F/'
}

# if it wasn't deleted in one of the above rules  Scan everything else for viruses
:0
VIRUS=|clamdscan --disable-summary --stdout -

:0fw
* VIRUS ?? ^.*: \/.* FOUND
| formail -b -f -t -I "X-Clamav-Status: Yes, $MATCH"

:0Efw
| formail -b -f -t -I "X-Clamav-Status: Virus Free"

:0:               
* ^X-Clamav-Status:.*Yes
.Virus/new   

:0:               
* ^Subject:.*SPAM
.Spam/new           




Offline eendje

  • Lid
Re: procmail & clamav & spamassassin
« Reactie #3 Gepost op: 2008/12/22, 22:56:21 »
Mooi!!!

Graag even het draadje markeren als opgelost. Dit kun je doen door de titel te wijzigen en te laten beginnen met [Opgelost]
Een dag niets geleerd is een dag niet geleefd!
Ik blog dus ik besta!
__________________________________________________________
Een vraag? Heb je al eens gekeken op: http://wiki.ubuntu-nl.org/FAQ?