Zarafa integration with bogofilter

From Zarafa wiki

(Difference between revisions)
Jump to: navigation, search
m
Line 14: Line 14:
bogofilter 1.1.x <BR>
bogofilter 1.1.x <BR>
Outlook 2000-2007 Client<BR>
Outlook 2000-2007 Client<BR>
-
[[Image:Bogofilter4zarafa-1.00.zip]] Bogofilter Zarafa scripts<BR>
+
[[Image:Bogofilter4zarafa-1.00.zip|Bogofilter Zarafa scripts]]<BR>
<BR>
<BR>

Revision as of 17:10, 20 January 2009

How To install Bogofilter4Zarafa


This article is a community contribution and may include unsupported configurations.

Prerequisites

A working installation of:

Zarafa Server
SMTP Server with possibility to integrate bogofilter (Exim in this case)
PHP 5.x incl Zarafa PHP-Mapi Module
cron daemon
bogofilter 1.1.x
Outlook 2000-2007 Client
File:Bogofilter4zarafa-1.00.zip

Installation

Create a public folder called bogofilter under all public folders. Install the bogofilterAdmin.oft file in this folder and set new items to be creating using this form.

Create a new item in bogofilter folder. Select your Ham and NoScan folders. Every folder not set to be a Ham folder will not be scanned at all. Save the new item.

Create UnsureSPAM folder in users Inbox.
Copy the php file to any location at server. Set the username and password to one that has got admin right. Adapt path names if necessary.

Start the script. After script run you should find the bogofilter wordlist in folder specified in php script. Open Outlook or Zarafa Web Interface and
ensure that the following 3 messages exists for your username: bogofilter ham
bogofilter spam
bogofilter scan

If everything runs feel free to set up a crontab entry.

Exim Configuration

Entry in router section:

bogofilter_router:
     domains = +local_domains
     no_verify
    # the next line looks for X-flag to see if the mail has been scanned
     condition = ${if !def:h_X-flag: {true }}
     driver = accept
     transport = bogofilter_filter
userzarafabox:
  driver = redirect
  check_local_user
  file = $home/.zarafa
  no_verify
  allow_filter
  directory_transport = local_delivery_zarafa
  pipe_transport = zarafa_pipe

Entry in transport section

bogofilter_filter:
    driver = pipe
    command = /usr/local/bin/exim -oMr spam-scanned -bS
    use_bsmtp = true
    # next line adds the X-flag so we will later know mail has been scanned
    headers_add =  X-flag: true
    transport_filter = "/usr/local/bin/bogofilter -d /var/lib/bogofilter -l -p -e"
    # group with enough rights
    group = bogofilter
    return_fail_output = true
    # user with enough rights
    user = bogofilter
    home_directory = "/tmp"
    log_output = true
    return_path_add = false
zarafa_pipe:	
    driver = pipe
    # user with enough rights
    user = zarafa
    # group with enough rights
    group = zarafa
    command = "/usr/local/bin/zarafa-dagent $local_part"
    return_path_add
local_delivery_zarafa:
    driver = appendfile
    headers_remove = X-flag
    maildir_format = true
    delivery_date_add
    envelope_to_add
    return_path_add


Delivery rules in .zarafa file on per user level

if $header_X-Bogosity: contains "Yes" then
    pipe "/usr/local/bin/zarafa-dagent -j $local_part"
    finish
endif
if $header_X-Bogosity: contains "Unsure" then
    pipe "/usr/local/bin/zarafa-dagent $local_part -F UnsureSPAM"
    finish
endif
pipe "/usr/local/bin/zarafa-dagent $local_part"


bogofilter minimum configuration

bogofilter_dir=/var/lib/bogofilter
spam_header_name=X-Bogosity
stats_in_header=Yes
timestamp=Yes
spamicity_tags = Yes, No, Unsure
spamicity_formats = %0.6f, %0.6f, %0.6f
charset_default=iso-8859-1
Personal tools