Plesk: spamdyke POP-Before-SMTP qmail (english)

Deutsche Version dieses Artikels

After installing spamdyke in Plesk POP-before-SMTP wasn’t properly working anymore. I googled for help, but all I could find simply stated this is not possible anymore and it’s bad anyhow, which isn’t much of a help when you have to find a solution. So we kept looking…

Plesk (or rather relaylock) saves IPs which are supposed to be authentificated by POP-before-SMTP in the table smtp_poplocks of the psa database. The following Perl script reads from this table and creates a list, which then can be used as an ip-white-list for spamdyke.

I decided to use a cronjob instead of a perl deamon since it’s very unlikely that a user is trying to send an email without SMTP auth in less than 59 seconds after establishing the POP3 connection.

Installation details:

# Download and check the script
wget "URL from end of this post"
chmod 700 spamdyke-pop-before-smtp*
nano spamdyke-pop-before-smtp*
 
# for debian users
apt-get install liblog-log4perl-perl
 
# for user of any other distribution
perl -MCPAN -e shell
install Log::Log4perl
 
# open /your/path/to/spamdyke.conf and add the following lines
ip-whitelist-file=/var/qmail/spamdyke/pop-before-smtp
 
# prepare the cronjob via "crontab -e"
*       *       *       *       *       /your/path/to/the-script.pl

Every sixty seconds the script is started. It then reads the database, writes the whitelist /var/qmail/spamdyke/pop-before-smtp and afterwards POP-before-SMTP is working like a charm again.

In case of an error the output will be logged in a file named /var/log/pop-before-smtp.log. If you want to receive an additional email as root, simply comment out the line
open STDERR, ‘>/dev/null’; (provided that your cron deamon was set up accordingly).

Download Link for Plesk x to Plesk 8:
spamdyke-pop-before-smtp-plesk-x-8.pl

Download Link for Plesk 9 to Plesk x:
spamdyke-pop-before-smtp-plesk-9-x.pl

KategorienMailserver