[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: spamassassin, exim et fetchmail



> j'aimerais mettre en place une solution pour éliminer la majeure partie
> de ce spam


Si cela peut t'aider, j'ai écrit cette doc d'intégration d'Exim et de
SPAMASSASSIN il y quelques temps.

Stef...



..........................................................
.  Linux - Debian - php4 - Apache - MySQL - Infogerance  .
.   email: info@actionweb.fr - http://www.actionweb.fr   .
.     Tel: (0)141 906 100    -    Fax: (0)141 906 101    .
..........................................................

Attachment: README.exim
Description: application/applefile

Set up spamassassin + mysql + exim on Debian (full exim-filter solution). 
Setup by sleclerc@actionweb.fr
March 16, 2002.
------------------------------------------------------------------

Applications needed: exim 3.3x, spamassassin 2.x and razor 1.19x.
Create a MySQL database according to the README.sql manual in /usr/share/doc/spamassassin.
Create a basic setup for GLOBAL user in the userpref table.
You can use the PHP php-sa-mysql-0.5.tar.gz sample found at http://spamassassin.taint.org/devel/.

1) Edit /etc/default/spamassassin (-D can be removed in production mode)

============
ENABLED=1
OPTIONS="-u mail -D -x -q"
============

2) Edit /etc/spamassassin/local.cf and insert SQL code

============
user_scores_dsn                 DBI:mysql:spam:localhost
user_scores_sql_username        spam
user_scores_sql_password        password
============

Mail are filtered according to the GLOBAL user preferences in the SQL database.

3) Start spamd: /etc/init.d/spamassassin start

4) Create the /etc/exim/spam-messages (here is mine as an example)  

============
Your mail with Subject: 

$h_Subject:

to the user $header_To: appears to be unsolicited spam.

If you intended to contact a person at that email for legitimate reasons 
then our apologies. Please call your technical support to solve this issue.

Thank you

postmaster@$domain
============

5) Edit /etc/exim/exim.conf with the following fragments

============
# General config for Spam Assassin
message_filter = /etc/exim/spam-filter
message_filter_reply_transport = spam_reply_transport
# End of General config
============

============
# Spam Assassin transport

spam_reply_transport:
  driver = autoreply
  user = mail

# This transport does a spam check to look for spam and then re-injects
# the message into Exim

check_spam:
  driver = pipe
  user = mail
  group = mail
  prefix =
  suffix =
  # If you have problems, all is here.
  command = spamc | exim -oMr spam_checked ${if eq {$sender_address} {} \
  {} {-f $sender_address}} ${pipe_addresses}
  #
  ignore_status = true
  use_shell = true
  return_output = false 
  return_path_add = false 
  path = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"

# End of Spam Assassin transport
============

============
# Spam Assassin Director 
# place at the start of the Directors section

spam_to_check:
  condition = ${if eq {$received_protocol} {spam_checked} {0} {0} }
  driver = smartuser
  transport = check_spam

# End of Spam Assassin director
============

============
# Spam Assassin Router
# place this section only if your Exim server is a SMTP gateway
# passing messages to a smarthost
# place at the start of the Routers section

spam_router:
  condition = "${if eq {$received_protocol}{spam_checked} {0}{1}}"
  driver = domainlist
  route_list = "*"
  transport = check_spam 
 
# End of Spam Assassin router
============

6) Create a file /etc/exim/spam-filter

============
# Exim Spam Filter for Spam Assassin

if first_delivery and
   $h_X-Spam-Flag: contains "YES"
then
   logfile /var/log/exim/spamlog.log
   logwrite "$tod_log From: $h_From: Subject: $h_Subject: Sender: $sender_address" 
   if $h_From: is not ""
   then
      mail to $h_From: subject "Re: Your message has been rejected!"
           expand file /etc/exim/spam-messages
           once /var/log/exim/spamcount.log
           once_repeat 5d
   endif
   seen finish
endif

# End of Exim Spam Filter
============

7) Restart exim: /etc/init.d/exim restart

That's all!

------------------------------------------------------------------


Reply to: