PopRelay Support for milter-greylist.
In order to allow users of a conventional sendmail / pop3 setup to send email from a server running
milter-greylist without being grey-listed, it is possible to feed an existing
PopRelay authenticated pop3 recipient IP addresses database into the greylist.conf file.
In order to do that, you can set up a greylist.template file, which contains all static setup information, and patch the poprelay
daemon (poprelayd) so it would create a new text-file from the database, containing setup information necessary to feed to milter-greylist.
The Recipe:
- rename the greylist.conf file to greylist.template
- apply this patch to the poprelay 1.5 daemon file poprelayd.
it calls the subroutine added_output should it exist.
The patch looks like this:
--- poprelayd Tue Jan 21 20:35:50 2003
+++ patched/poprelayd Tue Mar 23 12:27:17 2004
@@ -357,8 +357,9 @@
$lasttimeout = time;
timeoutdb(60 * $timeout_minutes);
}
closedb;
+ &added_output() if defined &added_output;
sleep $log_wait_interval;
}
}
- add this addendum to the poprelay.conf file.
it contains the added_output subroutine, which can be modified as needed.
The subroutine looks like this:
sub added_output {
#
# local settings - please adjust as needed
#
# where is greylist.conf etc. ?
#
my $BASE='/etc/mail/greylist';
my $GLT="$BASE.template";
my $GLN="$BASE.conf.NEW";
my $GLC="$BASE.conf";
# where are the system utilities 'awk', 'poprelayd', and 'cat' ?
#
my $awk='/bin/awk';
my $prd='/sbin/poprelayd';
my $cat='/bin/cat';
my $dif='/usr/bin/diff';
#
# local settings - setup finished.
#
system(qq~$prd -p|$awk 'BEGIN{system("$cat $GLT");}{printf"addr \%s/32\\n",\$1;}'>$GLN~);
my ($doit,$newf)=(0,0);
if(-f $GLN) {
$newf=1;
if(-f $GLC) {
my $result=`$dif -q $GLN $GLC > /dev/null`;
my $ret=($? >> 8) & 127;
$doit=1 if $ret==1;
}
else { $doit=1; }
}
if($doit) {
rename($GLN,$GLC); # should probably spit out an error if it fails
$doit=$newf=0;
}
elsif($newf) {
unlink($GLN); # should probably spit out an error if it fails
$newf=0;
}
}
After all this is done, you can shutdown and start your poprelay daemon, and it will continuously create changed greylist.conf
files containing the most up-to-date data from the PopRelay authenticated pop3 recipient IP addresses database.
|