J
JD Austin
Guest
Originally posted by bmeshier
Prerequisites
mysql-devel
openssl-devel
Step 1
wget http://carbonblock.net/files/qmail-1.03-psa-greylist.tar.gz
The source contains patches by SW Soft, please do not distribute.
Step 2
tar xvfz qmail-1.03-psa-greylist.tar.gz
cd qmail-1.03
Step 3
edit local_scan.c and change values as appropriate.
Code:#define MYSQLHOST "localhost" #define MYSQLUSER "greylist" #define MYSQLPASS "password" #define MYSQLDB "qmail" #define BLOCK_EXPIRE 4 /* minutes until email is accepted */ #define RECORD_EXPIRE 1500 /* minutes until record expires */ #define RECORD_EXPIRE_GOOD 36 /* days until record expires after accepting email */
Step 4
Setup MySQL
mysql -u root -p
Code:CREATE DATABASE qmail; GRANT ALL ON qmail.* TO 'greylisting'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Code:-- -- Table structure for table `relaytofrom` -- CREATE TABLE relaytofrom ( id bigint(20) NOT NULL auto_increment, relay_ip varchar(16) default NULL, mail_from varchar(255) default NULL, rcpt_to varchar(255) default NULL, block_expires datetime NOT NULL default '0000-00-00 00:00:00', record_expires datetime NOT NULL default '0000-00-00 00:00:00', blocked_count bigint(20) NOT NULL default '0', passed_count bigint(20) NOT NULL default '0', aborted_count bigint(20) NOT NULL default '0', origin_type enum('MANUAL','AUTO') NOT NULL default 'MANUAL', create_time datetime NOT NULL default '0000-00-00 00:00:00', last_update timestamp(14) NOT NULL, PRIMARY KEY (id), KEY relay_ip (relay_ip), KEY mail_from (mail_from(20)), KEY rcpt_to (rcpt_to(20)) ) TYPE=MyISAM;
Step 5
make
Step 6
/etc/rc.d/init.d/qmail stop
Step 7
cp qmail-envelope-scanner /var/qmail/bin/.
cp -f qmail-smtpd /var/qmail/bin/.
chown root.qmail /var/qmail/bin/qmail-envelope-scanner
chown root.qmail /var/qmail/bin/qmail-smtpd
Step 8
/etc/rc.d/init.d/qmail start
Step 9
Create a quick perl script to clean up the database and place in /etc/cron.daily
Code:#!/usr/bin/perl use strict; use warnings; use constant DBD => 'DBI:mysql:qmail:localhost:3306'; use constant DBUSER => 'milter'; use constant DBPASS => 'greylist'; use DBI; system ("cat /dev/null > /tmp/greylist_dbg.txt"); my $dbh = DBI->connect(DBD,DBUSER,DBPASS) or die "can't connect to db ", $DBI::errstr, ":$!"; $dbh->do("DELETE FROM relaytofrom WHERE record_expires < NOW() - INTERVAL 1 HOUR AND origin_type = 'AUTO'"); $dbh->do("OPTIMIZE TABLE relaytofrom"); $dbh->disconnect; exit;
---
Much of these instructions have been simplified and anyone attempting this should have a firm understanding of MySQL and compiling binaries from source.
I had greylisting working and it was working great.. then I tried to fix an issue where headers exist without a message body for a particular mailbox by reinstalling qmail/spamassassin/etc..
Now when I try to compile, it won't finish compilation.
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o)(.text+0x58d): In function `ne
w_VioSSLAcceptorFd':
: undefined reference to `OPENSSL_add_all_algorithms_noconf'
collect2: ld returned 1 exit status
make: *** [qmail-envelope-scanner] Error 1
Do you have any idea what's missing? ( have openssl-devel installed, kind of stumped