Zarafa integration with bogofilter
From Zarafa wiki
How To install Bogofilter4Zarafa
<BR> <font color=red>This article is a community contribution and may include unsupported configurations. </font> <BR><BR>
Prerequisites
A working installation of:
Zarafa Server<BR> SMTP Server with possibility to integrate bogofilter (Exim in this case)<BR> PHP 5.x incl Zarafa PHP-Mapi Module<BR> cron daemon<BR> bogofilter 1.1.x <BR> Outlook 2000-2007 Client<BR> Bogofilter Zarafa scripts Media:Bogofilter4zarafa-1.00.zip<BR> <BR>
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.<BR> <BR> 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.<BR> <BR> Create UnsureSPAM folder in users Inbox. <BR> 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.<BR> <BR> 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 <BR> ensure that the following 3 messages exists for your username: bogofilter ham<BR> bogofilter spam<BR> bogofilter scan<BR> <BR> If everything runs feel free to set up a crontab entry.<BR> <BR>
Exim Configuration
Entry in router section:
<pre> 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
</pre>
Entry in transport section
<pre> 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
</pre> <BR> Delivery rules in .zarafa file on per user level
<pre> 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" </pre> <BR> bogofilter minimum configuration
<pre> 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 </pre>