man in the hill Veteran
Joined: 15 Dec 2005 Posts: 1552 Location: Madinina
|
Posted: Tue Apr 27, 2010 3:29 pm Post subject: [TIP] postfix+spamassassin+clamsmtp sans amavisd-new |
|
|
Bonjour,
Je trouve cette association facile à mettre en place, compréhensible et très efficace. Le but est de se passer d'amavisd-new avec ces milliers de lignes de fichier de conf pas toujours digest et d'économiser un peu de mémoire ...
De la lecture car chacun montera le système qu'il veut mais il faut quand même essayer de s'attarder sur les différents démons de postfix pour comprendre un peu comment le mail circule ...:
- Postfix
- Postfix en français
- Messagerie multidomaine avec postfix sous gentoo
- Passerelle de filtrage de courrier électronique sous gentoo
- Spamassassin
- ClamSMTP
- Je suppose que vous avez installé et configuré postfix
Code: | emerge -av spamassassin clamav clamsmtp |
- Modifier le fichier master.cf
Code: | vim /etc/postfix/master.cf
# Postfix livre les mails à clamsmtpd sur le port 10025 via scan
smtp inet n - n - - smtpd
-o content_filter=scan:127.0.0.1:10025
# Création du scan qui est une instance smtp de postfix
scan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes
# Les mails sont réinjecté ds postfix sur le port 10026 puis à spamd
127.0.0.1:10026 inet n - n - 16 smtpd
-o content_filter=spamd
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_address_mappings
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
# Livraison via pipe au filtre. Le filtre réinjecte les mails dans postfix avec sendmail. Utiliser un utilisateur avec des droits limités ...
spamd unix - n n - - pipe
user=vmail argv=/usr/bin/spamc -f
-e /usr/sbin/sendmail -oi -f ${sender} ${recipient} |
- Configuration de de clamsmtp:
Code: | vim /etc/clamsmtpd.conf
# Port vers lequel le mail est réinjecté
OutAddress: 127.0.0.1:10026
# Port d'écoute de clamsmtpd
Listen: 0.0.0.0:10025 |
Le reste est normalement bon, fichier simple à configurer !
- Configuration de clamav, pas grand chose à changer avec la conf par défault mais voici qques pistes:
Code: | vim /etc/clamd.conf
# Uncomment this option to enable logging.
# LogFile must be writable for the user running daemon.
# A full path is required.
# Default: disabled
LogFile /var/log/clamav/clamd.log
# Log time with each message.
# Default: no
LogTime yes
# Use system logger (can work together with LogFile).
# Default: no
LogSyslog yes
# Specify the type of syslog messages - please refer to 'man syslog'
# for facility names.
# Default: LOG_LOCAL6
LogFacility LOG_MAIL
# Enable verbose logging.
# Default: no
LogVerbose yes
# This option allows you to save a process identifier of the listening
# daemon (main thread).
# Default: disabled
PidFile /var/run/clamav/clamd.pid
# Path to a local socket file the daemon will listen on.
# Default: disabled (must be specified by a user)
LocalSocket /var/run/clamav/clamd.sock
# Run as another user (clamd must be started by root for this option to work)
# Default: don't drop privileges
User clamav
# Initialize supplementary group access (clamd must be started by root).
# Default: no
AllowSupplementaryGroups yes |
- Configuration de spamassassin:
Code: | vim /etc/spamassassin/local.cf
# Add *****SPAM***** to the Subject header of spam e-mails
#
rewrite_header Subject *****SPAM*****
# Save spam messages as a message/rfc822 MIME attachment instead of
# modifying the original message (0: off, 2: use text/plain instead)
#
report_safe 0
# Set which networks or hosts are considered 'trusted' by your mail
# server (i.e. not spammers)
#
# trusted_networks 212.17.35.
# Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock
# Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 5.0
# Use Bayesian classifier (default: 1)
#
# use_bayes 1
# Bayesian classifier auto-learning (default: 1)
#
# bayes_auto_learn 1
# Set headers which may provide inappropriate cues to the Bayesian
# classifier
#
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status
use_razor2 1
use_dcc 1
use_pyzor 1
skip_rbl_checks 0
ok_languages fr
ok_locales fr
#whitelist_from *@gentoo.com
#blacklist_from *.microsoft.com
#blacklist_from *.test.com |
- Si vous voulez activer pyzor razor dcc:
Code: | emerge -av pyzor razor dcc |
- Utiliser Pyzor
Code: | pyzor --homedir /etc/mail/spamassassin discover |
- Pour charger le plugin de la langue et dcc ... Décommenter les lignes qui vous intéresse ...:
Code: | vim /etc/mail/spamassassin/v310.pre |
- Démarrage des services:
Code: | /etc/init.d/clamd start
/etc/init.d/clamsmtpd start
/etc/init.d/spamd start
/etc/init.d/postfix start |
- Visualiser que les filtres font bien le travail demandé
Code: | vim /var/log/mail.log |
Voilà ... _________________ Get Up and Go ! |
|