Subject: *_*_destiny setttings do not work when sql_select_policy
For some reason whenever I configure amavis.conf to work with a sql database for policy it does not work in conjunction with the *_destiny settings. I would like to D_REJECT all mail that is considered spam but store it in quarantine. Here is a snippit of the config:
----------------------amav
#*_destiny config
$final_virus_destiny = D_REJECT; # (defaults to D_BOUNCE)
$final_banned_destiny = D_REJECT; # (defaults to D_BOUNCE)
$final_spam_destiny = D_REJECT; # (defaults to D_REJECT)
$final_bad_header_destiny = D_REJECT; # (defaults to D_PASS), D_BOUNCE suggested
#SQL Config
@lookup_sql_dsn =( ['DBI:mysql:database=amavi
$sql_select_policy = 'SELECT *,users.id FROM users,policy'.
' WHERE (users.policy_id=policy.id
' ORDER BY users.priority DESC';
#$sql_select_policy = undef;
$sql_select_white_black_li
' WHERE (rid=?) AND (wblist.email IN (%k))'.
' ORDER BY wblist.priority DESC'; # undef disables SQL white/blacklisting
The *_destiny works when I declare $sql_select_policy = undef but then the black/white list query does not. The *_destiny settings also works when I disable lookup_sql_dsn. When enabled it looks like all of the queries work as configured.
I installed the following packages on top of squirrelmail 1.4.3
amavis-new rpm package - 20030616-9
amavisnewsql-0.7.2-1.4
Here is the mysql schema I used:
--------------------------
CREATE TABLE msg (
id int(10) unsigned NOT NULL auto_increment,
stype varchar(8) default 'spam',
sender varchar(255) default NULL,
subject varchar(255) default NULL,
body mediumtext,
storetime int(11) default NULL,
score float default NULL,
UNIQUE KEY id (id)
) TYPE=MyISAM;
#
# Dumping data for table `msg`
#
# --------------------------
#
# Table structure for table `msg_id_seq`
#
CREATE TABLE msg_id_seq (
id bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `msg_id_seq`
#
INSERT INTO msg_id_seq (id) VALUES (1);
# --------------------------
#
# Table structure for table `msgowner`
#
CREATE TABLE msgowner (
msgid int(10) unsigned NOT NULL default '0',
rid int(11) NOT NULL default '0'
) TYPE=MyISAM;
#
# Dumping data for table `msgowner`
#
# --------------------------
#
# Table structure for table `policy`
#
CREATE TABLE policy (
id int(10) unsigned NOT NULL auto_increment,
policy_name varchar(32) default NULL,
virus_lover char(1) default 'N',
spam_lover char(1) default 'N',
banned_files_lover char(1) default 'N',
bad_header_lover char(1) default 'N',
bypass_virus_checks char(1) default 'N',
bypass_spam_checks char(1) default 'N',
bypass_banned_checks char(1) default 'N',
bypass_header_checks char(1) default 'N',
spam_modifies_subj char(1) default 'Y',
spam_quarantine_to varchar(64) default 'spam-quarantine',
spam_tag_level float default '-999',
spam_tag2_level float default NULL,
spam_kill_level float default NULL,
UNIQUE KEY id (id)
) TYPE=MyISAM;
#
# Dumping data for table `policy`
#
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (7, 'Never Tag and Never Block', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '999', '999');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (3, 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '5', '5');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (1, 'Default_Nonuser', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, '-999', '6', '12');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (2, 'Default', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '6', '12');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (6, 'Default Tag Never Block', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '6', '999');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (5, '6.5/7.8', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '6.5', '7.8');
INSERT INTO policy (id, policy_name, virus_lover, spam_lover, banned_files_lover, bad_header_lover, bypass_virus_checks, bypass_spam_checks, bypass_banned_checks, bypass_header_checks, spam_modifies_subj, spam_quarantine_to, spam_tag_level, spam_tag2_level, spam_kill_level) VALUES (4, 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', 'spam-quarantine', '-999', '10', '20');
# --------------------------
#
# Table structure for table `policy_id_seq`
#
CREATE TABLE policy_id_seq (
id int(10) unsigned NOT NULL auto_increment,
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `policy_id_seq`
#
INSERT INTO policy_id_seq (id) VALUES (11);
# --------------------------
#
# Table structure for table `users`
#
CREATE TABLE users (
id int(10) unsigned NOT NULL auto_increment,
priority smallint(6) NOT NULL default '7',
policy_id int(11) NOT NULL default '2',
email varchar(255) NOT NULL default '',
fullname varchar(255) default NULL,
digest char(2) default 'WD',
username varchar(255) default NULL,
retention smallint(6) default '14',
UNIQUE KEY id (id)
) TYPE=MyISAM;
#
# Dumping data for table `users`
#
INSERT INTO users (id, priority, policy_id, email, fullname, digest, username, retention) VALUES (1, 1, 1, '@.', 'Global Match', NULL, NULL, NULL);
# --------------------------
#
# Table structure for table `users_id_seq`
#
CREATE TABLE users_id_seq (
id int(10) unsigned NOT NULL auto_increment,
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `users_id_seq`
#
INSERT INTO users_id_seq (id) VALUES (2);
# --------------------------
#
# Table structure for table `wblist`
#
CREATE TABLE wblist (
rid int(11) unsigned NOT NULL default '0',
sid int(11) NOT NULL default '0',
priority smallint(6) NOT NULL default '7',
email varchar(255) NOT NULL default '',
wb char(1) NOT NULL default ''
) TYPE=MyISAM;
Any help is appreciated.
Thanks
Main Topics
Browse All Topics





by: sohaib69Posted on 2002-12-01 at 13:30:19ID: 7517604
hello Ashok,
om/stable/ clamav-0.5 4.tar.gz
/perl/amav is-perl-11 .tar.gz
tar.gz
11/
Let me give you step by step instruction in installing Amavis and a Clamv Antivirus scanner they both work together and scan your incoming/outgoing email for viruses.
First grab a copy of Clamav Antivirus from
http://clamav.elektrapro.c
then ssh to your server and su .
extract clamav-0.54.tar.gz
then cd to ur clamav-0.54
[root@ns1 /]# groupadd clamav
[root@ns1 /]# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
[root@ns1 /]# ./configure
[root@ns1 /]# make
[root@ns1 /]# make install
once it got done it will install the files in your /usr/local/bin
cd to your /usr/local/bin then do
./freshclam
it will update the virus defination.
then on your promit do ./clamd it will tell u the location of your clamav.conf file it will generally save in
/usr/local/etc/clamav.conf
then pico /usr/local/etc/clamav.conf
and then in line number eight
# Comment or remove the line below.
#Example
save and exit.
Now you are done installing the Clam AntiVirus scanner.
Now the next step is to install amavis , I may suggest you to install amavis-perl version
grab a copy from
http://www.amavis.org/dist
once you got done extracting that above software. First install the following modules.
perl -MCPAN -e shell
install Unix::Syslog
install Convert::UUlib
install Convert::TNEF
install Compress::Zlib
install Archive::Tar
install Archive::Zip
install G/GB/GBARR/MailTools-1.15.
install MIME::Tools
install Bundle::libnet
once you install all the above perl modules then make sure you have the following software installed in your server.
o arc
o bunzip2 (part of the bzip2 package)
o lha
o unarj
o uncompress (standard on Unix and Unix-like systems)
o unrar
o zoo
you can get those above software from
http://www.rpmfind.net
install those software by using
rpm -Uvh software.rpm
once you are done installing the above Rpms then cd to your clamav-0.54/support/amavis
look for clamavis.patch
cp clamavis.patch /home/viruses/amavis-perl-
patch -p1 < clamavis.patch
find . -exec touch 01010000 {} \;
no ./configure
make;make install
now you are done installing amavis-perl .
I may suggest you editing your sendmail.cf manually by but before editing make sure to make a backup of your sendmail.cf
pico sendmail.cf
look for Mlocal
remove the previous Mlocal like and insert
Mlocal, P=/usr/sbin/amavis, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
T=DNS/RFC822/X-Unix,
A=amavis $f $u /usr/bin/procmail -t -Y -a $h -d $u
once you are done restart your sendmail and you are DONE .
send your self a test message once you got an email check the message source and it will say Amavis Virus Scanner.
Take kAre,
Sohaib (K)