mercredi 26 décembre 2007

Configurer Spamassassin avec Postfix sous Linux UBUNTU



Etape 1 - Installation de SPAMASSASSIN

1 - Installation
sudo apt-get install spamassassin

2 - Configuration
Par default spamassassin est desactivé

on doit modifier /etc/default/spamassassin
sudo vi /etc/default/spamassassin

Mettre ENABLED=1

puis pour démarrer spamd tapez dans un terminal:
sudo /etc/init.d/spamassassin start

Modifier le fichier de configuration /etc/spamassassin/local.cf
sinon vous pouvez le créer automaitquement à l'aide de l'utilitaire
de configuration http://www.yrex.com/spam/spamconfig.php

3 - Test de spamassassin
pour le test, on telecharger le fichier http://spamassassin.org/full/3.0.x/dist/sample-spam.txt
http://spamassassin.org/full/3.0.x/dist/sample-nonspam.txt
ensuite, on tape la commande
spamassassin -tD < [message_file]
regarder en bat du rapport "Détails d'analyse du message: (0.9 points, 5.0 requis)" pour voir le score.

Etape 2 - Configuration avec postfix

1 - création de l'utilisateur spamd

sudo groupadd -g 5001 spamd
sudo useradd -u 5001 -g spamd -s /bin/false -d /home/spamassassin spamd
mkdir /home/spamassassin
sudo chown spamd:spamd /home/spamassassin/


2 - Configurer master.cf

sudo cp /etc/postfix/master.cf /etc/postfix/master.cf.10_10_2007
sudo vi /etc/postfix/master.cf

#Rajouter l'option content_filter à la ligne smtp

smtp inet n - - - - smtpd
-o content_filter=spamassassin
....
....

#Rajouter la commande spamassassin en fin de fichier
spamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Libellés :