The Perfect SpamSnake - Ubuntu Jeos 9.10 - Page 3

Want to support HowtoForge? Become a subscriber!
 
Submitted by Rocky (Contact Author) (Forums) on Fri, 2010-04-16 12:24. ::

7. MailWatch Installation Instructions

This setup assumes you are using Apache v2.x and not Apache v1.x.

Before Starting, make sure that MailScanner is working before you continue with the MailWatch install!

*Notes for Ubuntu:

You must have a working MailScanner set-up and running copies of MySQL, Apache, and PHP. You must also have the Perl DBD-MySQL package installed for the Perl portions of MailScanner to utilize the MySQL database. The default php.ini set should have the following set correctly, you may want to check this:

short_open_tag = On 
safe_mode = Off 
register_globals = Off 
magic_quotes_gpc = On 
magic_quotes_runtime = Off 
session.auto_start = 0

These will be commented out you must remove the "#" to activate them:

extension=mysql.so 
extension=gd.so

 

Installation

Download the latest MailWatch release:

cd /usr/src
wget http://downloads.sourceforge.net/mailwatch/mailwatch-1.0.4.tar.gz?modtime=1178902008&big_mirror=0
tar xzvf mailwatch-1.0.4.tar.gz
cd mailwatch-1.0.4

Create the database:

mysql -p < create.sql

*Note:

You will need to modify the above as necessary for your system if you have a root password for your MySQL database (recommended!) - Debian will ask for one.

Create a MySQL user and password & set up MailScanner for SQL logging:

mysql -p
mysql> GRANT ALL ON mailscanner.* TO username@localhost IDENTIFIED BY 'password';

Remember the password! You need the single quotes ' to surround your password.

Edit MailWatch.pm and change the $db_user and $db_pass values accordingly and move MailWatch.pm:

cp MailWatch.pm /opt/MailScanner/lib/MailScanner/CustomFunctions/

Create a MailWatch Web User:

mysql mailscanner -u username -p

Enter password: password

mysql> INSERT INTO users VALUES ('admin',md5('password'),'mailscanner','A','0','0','0','0','0');

 

Install & Configure MailWatch

From within the unpacked mailwatch directory move the directory called 'mailscanner' to /var/www/.

mv mailscanner/ /var/www/
cd /var/www/mailscanner

Make a temp directory:

mkdir temp
chmod g+w temp

Check the permissions of /var/www/mailscanner/images and /var/www/images/cache - they should be ug+rwx and owned by root and in the same group as the web server user.

chmod ug+rwx images
chmod ug+rwx images/cache
chown –R root:www-data *

Create conf.php by copying conf.php.example and edit the values to suit, you will need to set DB_USER and DB_PASS to the MySQL user and password that you created earlier.

define(DB_USER, 'username');
define(DB_PASS, 'password');
define(MAILWATCH_HOME, '/var/www/mailscanner/');
define(MS_CONFIG_DIR, '/opt/MailScanner/etc/');
define(MS_LIB_DIR, '/opt/MailScanner/lib/MailScanner/'); 
define(QUARANTINE_USE_FLAG, true);
define(QUARANTINE_FROM_ADDR, 'postmaster@example.com');
define(QUARANTINE_REPORT_FROM_NAME, 'SpamSnake');
define(QUARANTINE_USE_SENDMAIL, true);

 

Set-up MailScanner

Edit /opt/MailScanner/etc/MailScanner.conf and make sure the following are set:

Quarantine User = root
Quarantine Group = www-data 
Quarantine Permissions = 0660
Quarantine Whole Message = yes 
Always Looked Up Last = &MailWatchLogging

*Important: Spam Actions, High Scoring Spam Actions and No Spam Actions should also have 'store' as one of the keywords if you want to quarantine those items for bayes learning or viewing from within MailWatch.

 

Integrate SQL Blacklist/Whitelist (optional)

If you would like to manage the MailScanner whitelist and blacklist from within the MailWatch web interface perform the following steps.

1. Edit the MySQL connection values within the CreateList subroutine of SQLBlackWhiteList.pm to match the values you entered previous into MailWatch.pm. Both files should contain the same values. (Look for the following lines in SQLBlackWhiteList.pm and enter your own data.)

my($db_user) = 'username';
my($db_pass) = 'password';

2. Copy SQLBlackWhiteList.pm to /opt/MailScanner/lib/MailScanner/CustomFunctions/.

3. Edit MailScanner.conf and set:

Is Definitely Not Spam = &SQLWhitelist 
Is Definitely Spam = &SQLBlacklist

 

Fix to allow MailWatch to work with Postfix Inbound/Outbound Queue

Download the patch from http://www.gbnetwork.co.uk/mailscanner/postfixmail.tar.gz:

cd /usr/src
wget http://www.gbnetwork.co.uk/mailscanner/files/postfixmail.tar.gz
tar xvfz postfixmail.tar.gz
cd postfixmail
cp postfix* /var/www/mailscanner/
patch /var/www/mailscanner/functions.php functions.php.diff

 

SpamAssassin

First we need to disable the default SpamAssassin configuration file:

mv /etc/spamassassin/local.cf /etc/spamassassin/local.cf.disabled

Now let's backup the SpamAssassin configuration file in MailScanner then edit:

cp /opt/MailScanner/etc/spam.assassin.prefs.conf /opt/MailScanner/etc/spam.assassin.prefs.conf.back

Add pyzor and razor paths to the top of /opt/MailScanner/etc/spam.assassin.prefs.conf:

pyzor_options --homedir /var/lib/MailScanner/
razor_config /var/lib/MailScanner/.razor/razor-agent.conf
dcc_path /usr/bin/dccproc

Look for these lines and change them accordingly:

bayes_ignore_header X-YOURDOMAIN-COM-MailScanner
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-SpamCheck
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-SpamScore
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-Information

"YOURDOMAIN-COM" should be replaced with whatever you used for "%org-name%" in the MailScanner.conf file. Leave the "X-" in place. This is the same orgname used in the MailScanner.conf above.

Edit the SpamAssassin /etc/spamassassin/v310.pre to enable DCC:

loadplugin Mail::SpamAssassin::Plugin::DCC

 

SpamAssassin SQL Bayes

Pre-requisities:
You'll need the perl-DBI and perl-DBD-MySQL modules installed.

Assumptions and Variables:

SpamAssassin Bayes Database Name: sa_bayes
SpamAssassin Bayes Database UserName: sa_user
SpamAssassin Bayes Database Password: sa_password

Create the MySQL database: First of all, create a database on the server where you intend on storing the bayesian information.

mysql -u root -p
mysql> create database sa_bayes;
mysql> GRANT ALL ON sa_bayes.* TO sa_user@localhost IDENTIFIED BY 'sa_password';
mysql> flush privileges;

Locate the bayes_mysql.sql file:

find / -name bayes_mysql.sql
mysql -u sa_user -p sa_bayes < /path/to/bayes_mysql.sql

Make some changes to your spam.assassin.prefs.conf:

bayes_store_module Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn DBI:mysql:sa_bayes:localhost
bayes_sql_username sa_user
bayes_sql_password sa_password
bayes_sql_override_username root

You may have to create the following to prevent an error in a lint test:

mkdir /var/www/.spamassassin

Also add this to your crontab:

30 01 * * * /usr/bin/sa-learn --force-expire --sync -p /opt/MailScanner/etc/spam.assassin.prefs.conf

Set permissions to bring it all together:

chown -R postfix:www-data /var/spool/postfix/hold
chmod -R ug+rwx /var/spool/postfix/hold

Finally make sure you restart MailScanner.

/etc/init.d/mailscanner restart

Test out the setup:

spamassassin -x -D -p /opt/MailScanner/etc/spam.assassin.prefs.conf --lint

Check for lines like:

debug: bayes: Database connection established
debug: bayes: found bayes db version 3
debug: bayes: Using userid: 2

You should see lines come up with DCC, Pyzor and Razor that say loading plugin and hopefully no errors.

Finishing up this part we need to add cron jobs that will clean/update, you probably saw the message about this after the MailScanner install script finished.

First edit conf.php and set 'QUARANTINE_DAYS_TO_KEEP' and change the following line in /usr/src/mailwatch-1.0.4/tools/db_clean.php and quarantine_maint.php to:

#!/usr/bin/php –q
require('/var/www/mailscanner/functions.php');

Install quarantine clean up script:

cp /usr/src/mailwatch-1.0.4/tools/quarantine_maint.php /usr/bin/quarantine_maint.php
cp /usr/src/mailwatch-1.0.4/tools/db_clean.php /usr/bin/db_clean.php
chmod +x /usr/bin/quarantine_maint.php
chmod +x /usr/bin/db_clean.php

Run

crontab -e

and add the following:

15 10 * * 2 /usr/bin/quarantine_maint.php --clean &> /dev/null
58 23 * * * /usr/bin/db_clean.php --clean &> /dev/null

Reboot the system:

reboot

Check your mail.log:

tail –f /var/log/mail.log

and you should see the following:

Jun 13 12:18:23 hoshi MailScanner[26388]: MailScanner E-Mail Virus Scanner version 4.20-3 starting...
Jun 13 12:18:24 hoshi MailScanner[26388]: Config: calling custom init function MailWatchLogging
Jun 13 12:18:24 hoshi MailScanner[26388]: Initialising database connection
Jun 13 12:18:24 hoshi MailScanner[26388]: Finished initialising database connection

Congratulations - you now have MailScanner logging to MySQL.

 

Test the MailWatch interface

Point your browser to http://<hostname>/mailscanner/ - you should be prompted for a username and password - enter the details of the MailWatch web user that you created earlier, and you should see a list of the last 50 messages processed by MailScanner.

 

Update the SpamAssassin Rules table

MailWatch keeps a list of all the SpamAssassin rules and descriptions which are displayed on the 'Message Detail' page - to show the descriptions, you need to run the updater every time you add new rules or upgrade SpamAssassin. Click on the 'Tools/Links' menu and select 'Update SpamAssassin Rule Descriptions' and click 'Run Now'.

 

Update the GeoIP database

Change this line in /var/www/mailscanner/geoip_update.php to look like:

dbquery("LOAD DATA LOCAL INFILE

*Note: Make sure you have allow_url_fopen = On in your php.ini set.

Click on the 'Tools/Links' menu and select 'Update GeoIP database' and click 'Run Now'.

 

Fix to allow wildcards in Whitelist/Blacklist

Add the following to the bottom of the return 1 section in your /opt/MailScanner/lib/MailScanner/CustomFunctions/SQLBlackWhiteList.pm:

return 1 if $BlackWhite->{$to}{'*@'.$fromdomain};
return 1 if $BlackWhite->{$to}{'*@*.'.$fromdomain};
return 1 if $BlackWhite->{$todomain}{'*@'.$fromdomain};
return 1 if $BlackWhite->{$todomain}{'*@*.'.$fromdomain};
return 1 if $BlackWhite->{'default'}{'*@'.$fromdomain};
return 1 if $BlackWhite->{'default'}{'*@*.'.$fromdomain}; 

 

Fix for Message Operations Not Finding Messages

Change the following in /var/www/mailscanner/do_message_ops.php file:

$id = $Regs[1];

to

$id = str_replace("_", ".",$Regs[1]);

 

Releasing Spam Messages

To allow MailWatch to release Spam messages without them being processed again, add 127.0.0.1 as a whitelist item in MailWatch/List interface. Make sure to restart MailScanner after configuring these options. Below is what my entry looks like.

127.0.0.1 Default Delete

 

Fix to Allow Multiple Release of Messages in Message Operations

Edit /var/www/mailscanner/do_message_ops.php and make the following changes:

case 'F':
$type='forget';
break;
case 'R':
$type='release';
break;
default:
continue;
break;

Then, find the following section and change it to look like this:

if ($type == 'release'){
if($quarantined = quarantine_list_items($id,RPC_ONLY)) {
$to = $quarantined[0]['to'];
}
echo "<tr><td><a href=\"detail.php?id=$id\">$id</a></td><td>$type</td><td>" . quarantine_release($quarantined, $itemnum, $to, RPC_ONLY) . "</td></tr>\n";
} else {
echo "<tr><td><a href=\"detail.php?id=$id\">$id</a></td><td>$type</td><td>" . quarantine_learn($items, $itemnum, $type, RPC_ONLY) . "</td></tr>\n";
}
}
echo "</TABLE>\n";
}
}
}
}
echo "  </TD>\n";

Next we edit the /var/www/mailscanner/functions.php file and change:

$fieldname[$f] = "Ops<br>S&nbsp;&nbsp;H&nbsp;&nbsp;F";

to:

$fieldname[$f] = "Ops<br>S&nbsp;&nbsp;H&nbsp;&nbsp;F&nbsp;&nbsp;R";

Next change:

array_unshift($row, "<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"S\">&nbsp;<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"H\">&nbsp;<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"F\">");

to:

array_unshift($row, "<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"S\">&nbsp;<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"H\">&nbsp;<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"F\">&nbsp;<INPUT NAME=\"OPT-REPLACEME\" TYPE=RADIO VALUE=\"R\"> ");

Next find the block with the javascript function to handle radio buttons. Add a third value like so:

echo "function SetRadios(p) {\n";
echo " var val;\n";
echo " if (p == 'S') {\n";
echo "  val = 0;\n";
echo " } else if (p == 'H') {\n";
echo "  val = 1;\n";
echo " } else if (p == 'F') {\n";
echo "  val = 2;\n";
echo " } else if (p == 'R') {\n";
echo "  val = 3;\n";
echo " } else if (p == 'C') {\n";
echo "  ClearRadios();\n";

Now, add the text for the radios:

echo "&nbsp; <a href=\"javascript:SetRadios('S')\">S</a>";
echo "&nbsp; <a href=\"javascript:SetRadios('H')\">H</a>";
echo "&nbsp; <a href=\"javascript:SetRadios('F')\">F</a>";
echo "&nbsp; <a href=\"javascript:SetRadios('R')\">R</a>";

Finally, change:

echo "<P><b>S</b> = Spam &nbsp; <b>H</b> = Ham &nbsp; <b>F</b> = Forget\n";

to:

echo "<P><b>S</b> = Spam &nbsp; <b>H</b> = Ham &nbsp; <b>F</b> = Forget &nbsp; <b>R</b> = Release\n";

 

Patch to fix autocommit error when stopping MailScanner

Edit line 80 of MailWatch.pm to look like this:

$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass, {PrintError => 0, AutoCommit => 0});

*Note: This turns off autocommit when it connects so the commit line when it closes does not throw an error.

 

Clamd Error Fix

If you see the following error in mail.log, you have to add user clamav to the www-data group.

Dec 3 08:29:51 server1 MailScanner[3728]: Clamd::ERROR:: UNKNOWN CLAMD RETURN ./lstat() failed: Permission denied. ERROR :: /var/spool/MailScanner/incoming/3728

usermod -a -G www-data clamav


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Patrick (not registered) on Fri, 2012-06-22 11:18.

For those running in to the problems I encountered while executing mysql -p < create.sql; below script runs properly.

 The issue I got were several errors like: ERROR 1064 (42000) at line 19

Alter the script to:

 

-- MySQL dump 8.23
--
-- Host: localhost    Database: mailscanner

-- Server version    3.23.58

--
-- Current Database: mailscanner
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ mailscanner;

USE mailscanner;

--
-- Table structure for table `audit_log`
--

CREATE TABLE audit_log (
  timestamp timestamp NOT NULL,
  user varchar(20) NOT NULL default '',
  ip_address varchar(15) NOT NULL default '',
  action text NOT NULL
) ENGINE=MyISAM;

--
-- Table structure for table `blacklist`
--

CREATE TABLE blacklist (
  id int(11) NOT NULL auto_increment,
  to_address text,
  to_domain text,
  from_address text,
  PRIMARY KEY  (id),
  UNIQUE KEY blacklist_uniq (to_address(100),from_address(100))
) ENGINE=MyISAM;

--
-- Table structure for table `geoip_country`
--

CREATE TABLE geoip_country (
  begin_ip varchar(15) default NULL,
  end_ip varchar(15) default NULL,
  begin_num bigint(20) default NULL,
  end_num bigint(20) default NULL,
  iso_country_code char(2) default NULL,
  country text,
  KEY geoip_country_begin (begin_num),
  KEY geoip_country_end (end_num)
) ENGINE=MyISAM;

--
-- Table structure for table `inq`
--

CREATE TABLE inq (
  id text,
  cdate date default NULL,
  ctime time default NULL,
  from_address text,
  to_address text,
  subject text,
  message text,
  size text,
  priority text,
  attempts text,
  lastattempt text,
  hostname text,
  KEY inq_hostname (hostname(50))
) ENGINE=MyISAM;

--
-- Table structure for table `maillog`
--

CREATE TABLE maillog (
  timestamp timestamp NOT NULL,
  id text,
  size bigint(20) default '0',
  from_address text,
  from_domain text,
  to_address text,
  to_domain text,
  subject text,
  clientip text,
  archive text,
  isspam tinyint(1) default '0',
  ishighspam tinyint(1) default '0',
  issaspam tinyint(1) default '0',
  isrblspam tinyint(1) default '0',
  isfp tinyint(1) default '0',
  isfn tinyint(1) default '0',
  spamwhitelisted tinyint(1) default '0',
  spamblacklisted tinyint(1) default '0',
  sascore decimal(7,2) default '0.00',
  spamreport text,
  virusinfected tinyint(1) default '0',
  nameinfected tinyint(1) default '0',
  otherinfected tinyint(1) default '0',
  report text,
  ismcp tinyint(1) default '0',
  ishighmcp tinyint(1) default '0',
  issamcp tinyint(1) default '0',
  mcpwhitelisted tinyint(1) default '0',
  mcpblacklisted tinyint(1) default '0',
  mcpsascore decimal(7,2) default '0.00',
  mcpreport text,
  hostname text,
  date date default NULL,
  time time default NULL,
  headers text,
  quarantined tinyint(1) default '0',
  KEY maillog_datetime_idx (date,time),
  KEY maillog_id_idx (id(20)),
  KEY maillog_clientip_idx (clientip(20)),
  KEY maillog_from_idx (from_address(200)),
  KEY maillog_to_idx (to_address(200)),
  KEY maillog_host (hostname(30)),
  KEY from_domain_idx (from_domain(50)),
  KEY to_domain_idx (to_domain(50)),
  KEY maillog_quarantined (quarantined)
) ENGINE=MyISAM;

--
-- Table structure for table `mcp_rules`
--

CREATE TABLE mcp_rules (
  rule char(100) NOT NULL default '',
  rule_desc char(200) NOT NULL default '',
  PRIMARY KEY  (rule)
) ENGINE=MyISAM;

--
-- Table structure for table `mtalog`
--

CREATE TABLE mtalog (
  timestamp datetime default NULL,
  host text,
  type text,
  msg_id varchar(20) default NULL,
  relay text,
  dsn text,
  status text,
  delay time default NULL,
  UNIQUE KEY mtalog_uniq (timestamp,host(10),type(10),msg_id,relay(20)),
  KEY mtalog_timestamp (timestamp),
  KEY mtalog_type (type(10))
) ENGINE=MyISAM;

--
-- Table structure for table `outq`
--

CREATE TABLE outq (
  id text,
  cdate date default NULL,
  ctime time default NULL,
  from_address text,
  to_address text,
  subject text,
  message text,
  size text,
  priority text,
  attempts text,
  lastattempt text,
  hostname text,
  KEY outq_hostname (hostname(50))
) ENGINE=MyISAM;

--
-- Table structure for table `sa_rules`
--

CREATE TABLE sa_rules (
  rule varchar(100) NOT NULL default '',
  rule_desc varchar(200) NOT NULL default '',
  PRIMARY KEY  (rule)
) ENGINE=MyISAM;

--
-- Table structure for table `saved_filters`
--

CREATE TABLE saved_filters (
  name text NOT NULL,
  col text NOT NULL,
  operator text NOT NULL,
  value text NOT NULL,
  username text NOT NULL,
  UNIQUE KEY unique_filters (name(20),col(20),operator(20),value(20),username(20))
) ENGINE=MyISAM;

--
-- Table structure for table `spamscores`
--

CREATE TABLE spamscores (
  user varchar(40) NOT NULL default '',
  lowspamscore decimal(10,0) NOT NULL default '0',
  highspamscore decimal(10,0) NOT NULL default '0',
  PRIMARY KEY  (user)
) ENGINE=MyISAM;

--
-- Table structure for table `user_filters`
--

CREATE TABLE user_filters (
  username varchar(60) NOT NULL default '',
  filter text,
  verify_key varchar(32) NOT NULL default '',
  active enum('N','Y') default 'N',
  KEY user_filters_username_idx (username)
) ENGINE=MyISAM;

--
-- Table structure for table `users`
--

CREATE TABLE users (
  username varchar(60) NOT NULL default '',
  password varchar(32) default NULL,
  fullname varchar(50) NOT NULL default '',
  type enum('A','D','U','R','H') default NULL,
  quarantine_report tinyint(1) default '0',
  spamscore tinyint(4) default '0',
  highspamscore tinyint(4) default '0',
  noscan tinyint(1) default '0',
  quarantine_rcpt varchar(60) default NULL,
  PRIMARY KEY  (username)
) ENGINE=MyISAM;

--
-- Table structure for table `whitelist`
--

CREATE TABLE whitelist (
  id int(11) NOT NULL auto_increment,
  to_address text,
  to_domain text,
  from_address text,
  PRIMARY KEY  (id),
  UNIQUE KEY whitelist_uniq (to_address(100),from_address(100))
) ENGINE=MyISAM;

 

 

Submitted by iser0073 (not registered) on Mon, 2010-08-16 09:04.

I have managed to install these after having some problems:

Install perl:

  aptitude install perl

for DBD::mysql you need mysql dev libraries so install:

  aptitude install libmysqlclient-dev libmysqlclient16-dev

now install DBD::mysql :

  cpan -i DBD::mysql

  cpan -i DBI

This worked for me.

Submitted by Shoggy (not registered) on Sun, 2010-05-30 09:56.
Thanks a lot for this How To. Everything works great except releasing quarantined message in Mailwatch. I have been battling this for over a week but no luck, i dont get the buttons and check box in the message details to release or learn spam. What am i missing, PLS HELP!!
Submitted by Rocky (registered user) on Thu, 2010-06-03 03:24.
Double check the permissions, you missed a change somewhere.  It should be under the Mailwatch section.
Submitted by PieterJ (not registered) on Mon, 2010-05-17 21:42.

I added dcc_path /usr/bin/dccproc to the top of /opt/MailScanner/etc/spam.assassin.prefs.conf

The lint test gave this error:

[13033] info: config: dcc_path "/usr/local/bin/dccproc" isn't an executable
[13033] warn: config: SpamAssassin failed to parse line, "/usr/local/bin/dccproc" is not valid for "dcc_path", skipping: dcc_path /usr/local/bin/dccproc
[13033] info: config: dcc_path "/usr/local/bin/dccproc" isn't an executable
[13033] warn: config: SpamAssassin failed to parse line, "/usr/local/bin/dccproc" is not valid for "dcc_path", skipping: dcc_path /usr/local/bin/dccproc

[13033] warn: lint: 2 issues detected, please rerun with debug enabled for more information

I have comment these lines to solve it:

# ifplugin Mail::SpamAssassin::Plugin::DCC
#dcc_path /usr/local/bin/dccproc
#endif

 

Submitted by Rocky (registered user) on Thu, 2010-05-27 13:29.

Instead of adding the line to the top of the file and commenting out this section, just change it like:

ifplugin Mail::SpamAssassin::Plugin::DCC
dcc_path /usr/bin/dccproc
endif

 That should work.

Submitted by 011 (not registered) on Mon, 2010-05-10 17:44.

I have a problem with "Fix to Allow Multiple Release of Messages in Message Operations" section.

Second step more specificaly.

Could you, please, point out what is the "following section" in "Then, find the following section and change it to look like this:" that needs ot be replaced with givcen code.

 

Thanks.

Submitted by Eddo Jansen (not registered) on Wed, 2010-07-07 07:05.

Same here, that section does not exists, I have the following:

 case 'S':
    $type='spam';
    break;
   case 'H':
    $type='ham';
    break;
   case 'F':
    $type='forget';
    break;
   default:
    continue;
    break;
  }
  $items = quarantine_list_items($id,RPC_ONLY);
  echo "<TABLE WIDTH=100%>\n";
  if(count($items) > 0) {
   foreach($items as $num=>$item) {
    if ($item['file'] == 'message') {
     $itemnum = array($num);
      echo "<tr><td><a href=\"detail.php?id=$id\">$id</a></td><td>$type</td><td>" . quarantine_learn($items, $itemnum, $type, RPC_ONLY) . "</td></tr>\n";;
    }
   }
  } else {
   echo "<tr><td colspan=3>Message $id not found in quarantine</td></tr>\n";
  }
  echo "</TABLE>\n";

Any advise??

 

Submitted by Rocky (registered user) on Thu, 2010-05-27 13:35.
It's pretty clear, just find that section in the file, and change it to look like what's posted.
Submitted by ihamouda (not registered) on Sat, 2010-07-03 19:19.

This section doesn't exists in the file "do_message_ops.php" at least in version 1.0.5

Do you have any idea what file it was moved to?

Submitted by Rocky (registered user) on Tue, 2010-07-13 18:55.

Make a backup of your file and copy the content below and overwrite your original with it.  You should be good to go after that.

<?
/*
 MailWatch for MailScanner
 Copyright (C) 2003  Steve Freegard (smf@f2s.com)

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

require_once('./functions.php');
require_once('DB.php');
require_once('DB/Pager.php');
require_once('./filter.inc');
session_start();
authenticate();
$refresh = html_start("Operation Results");

echo "<TABLE BORDER=0 WIDTH=\"100%\" CLASS=\"maildetail\">\n";
echo " <THEAD>\n";
echo "  <TH>Spam Learn Results</TH>\n";
echo " </THEAD>\n";
echo "  <TR>\n";
echo "  <TD CLASS=\"detail\">";

// Iterate through the POST variables
//Edited 1/5/09 Original = $id = $Regs[1];
if(is_array($_POST)) {
 foreach($_POST as $k=>$v) {
  if (preg_match('/^OPT-(.+)$/', $k, $Regs)) {
   $id = str_replace("_", ".",$Regs[1]);
  } else {
   continue;
  }
  switch ($v) {
   case 'S':
    $type='spam';
    break;
   case 'H':
    $type='ham';
    break;
   case 'F':
    $type='forget';
    break;
   case 'R':
    $type='release';
    break;
   default:
    continue;
    break;
  }
  $items = quarantine_list_items($id,RPC_ONLY);
  echo "<TABLE WIDTH=100%>\n";
  if(count($items) > 0) {
   foreach($items as $num=>$item) {
    if ($item['file'] == 'message') {
$itemnum = array($num);
   if ($type == 'release'){
      if($quarantined = quarantine_list_items($id,RPC_ONLY)) {
         $to = $quarantined[0]['to'];
       }
       echo "<tr><td><a href=\"detail.php?id=$id\">$id</a></td><td>$type</td><td>" . quarantine_release($quarantined, $itemnum, $to, RPC_ONLY) . "</td></tr>\n";
    } else {
     echo "<tr><td><a href=\"detail.php?id=$id\">$id</a></td><td>$type</td><td>" . quarantine_learn($items, $itemnum, $type, RPC_ONLY) . "</td></tr>\n";
     }
   }
  echo "</TABLE>\n";
      }
    }
  }
}
echo "  </TD>\n";
echo " </TR>\n";
echo " </TABLE>\n";

echo "<p><a href=\"javascript:history.back(1)\">Back</a>";

html_end();
?>
 

Submitted by fredux (not registered) on Mon, 2010-04-26 21:52.

Clamd Error Fix not work, I'm change user in clamd.conf to work using root and fix, do you have any other idea? sorry my english!

Best regards,

fredux

Submitted by Rocky (registered user) on Thu, 2010-04-29 03:39.
Submitted by Anonymous (not registered) on Fri, 2010-07-23 14:49.

This has solved for me.....

http://www.howtoforge.net/forums/showthread.php?t=45475

Submitted by pandreas21 (registered user) on Sun, 2010-04-25 17:59.

Directory /var/www/mailscanner/temp should also be apache writeable because MailWatch cannot extract the csv fle upon update.

Recommended fix:  replace procedure under title:

Install & Configure MailWatch - Make a temp directory:

mkdir temp
chmod g+w temp

chown root:www-data temp

Submitted by Rocky (registered user) on Thu, 2010-04-29 03:27.
Guide updated.
Submitted by pandreas21 (registered user) on Sun, 2010-04-25 17:53.
I believe the file to be edited for "Fix to allow wildcards in Whitelist/Blacklist" should be /opt/MailScanner/lib/MailScanner/CustomFunctions/SQLBlackWhiteList.pm
Submitted by Rocky (registered user) on Thu, 2010-04-29 03:29.
Correct, updated.
Submitted by fredux (not registered) on Sat, 2010-04-24 15:49.

Help me!!!

 Bayes error:

 [21180] dbg: bayes: using username: root
[21180] dbg: bayes: database connection established
[21180] dbg: bayes: found bayes db version 3
[21180] dbg: bayes: unable to initialize database for root user, aborting!

Why????

br,

 fredux

Submitted by pandreas21 (registered user) on Sun, 2010-04-25 17:51.
Has any spam email been processed yet? Maybe that is the reason.
Submitted by Eddo Jansen (not registered) on Fri, 2010-07-02 07:54.

First initialize the database by running the following command:

/usr/bin/sa-learn --force-expire --sync -p /opt/MailScanner/etc/spam.assassin.prefs.conf

Submitted by fredux (not registered) on Mon, 2010-04-26 12:12.

no, no message in queue. still in installation!!!

thanks

 Best regards,

Fred

Submitted by 011 (not registered) on Fri, 2010-04-23 02:56.

Mailwatch is at 1.0.5 right now. Is it OK to install that one?

Url for download of the patch is http://www.gbnetwork.co.uk/mailscanner/files/postfixmail.tar.gz

Did not have time to check if this is patch for 1.05 as well.

Submitted by Rocky (registered user) on Thu, 2010-04-29 03:38.

I think the only difference is compatibility with php5, otherwise, everything is the same. It should work.  This is what I found on their support site:

## 1.0.5 - VERY BASIC alterations so that MailWatch also runs on PHP5.3 and MySql5.1

Submitted by Anonymous (not registered) on Fri, 2010-06-18 13:31.

I think I buggered up the GeoIP line , I changed the whole line to look like :

 dbquery("LOAD DATA LOCAL INFILE

 What are the rest of the code behind it please :)

Submitted by Joolee (not registered) on Tue, 2010-11-30 09:43.

  dbquery("LOAD DATA LOCAL INFILE '".$base.'/'.$file2."' INTO TABLE geoip_country FIELDS TERMINATED BY ',' ENCLOSED BY '\"'");

 That's what it's supposed to look like after editing.