Spamdyke installation is quick and easy. It seamlessly installs between Plesk and Qmail. Below we will show you how to install this application and then how to maintain it with Plesk Event Manager.
The Install
1 download the latest Tarball from http://www.spamdyke.org/download.html
2 Upload the Tarball to your server of choice via FTP or SCP or use wget directly from the site.
3 Unpack the spamdyke tarball somewhere convenient, like /tmp:
cd /tmp tar -xzvf spamdyke-x.y.z.tgz
4 Change to the “spamdyke” folder, run “configure” and “make”:
cd spamdyke-x.y.z/spamdyke ./configure make
You shouldn't see any errors or warnings.
If the “configure” script finds the OpenSSL libraries, spamdyke compiles with TLS support. If TLS is not desired (why?), run the “configure” script with the “disable-tls” flag.
cd spamdyke-x.y.z/spamdyke ./configure --disable-tls make
You shouldn't see any errors or warnings.
5 Copy the spamdyke executable to /usr/local/bin:
su cp spamdyke /usr/local/bin
6 Find the script that runs qmail when an incoming connection is established.
If your qmail installation is part of Plesk, look for:
cp /etc/xinetd.d/smtp_psa /etc/xinetd.d/smtp_psa.orig cp /etc/xinetd.d/smtps_psa /etc/xinetd.d/smtps_psa.orig nano /etc/xinetd.d/smtp_psa
Insert the spamdyke command before the ”/var/qmail/bin/qmail-smtpd” command. Something like this:
/usr/local/bin/spamdyke -f /etc/spamdyke.conf /var/qmail/bin/qmail-smtpd 2>&1
Sometimes, the spamdyke command should be placed within a variable that is substituted into the command line. If the script includes the rblsmtpd command, it can be replaced with the spamdyke command.
Run the spamdyke command with the ”-h” flag to see the available options and read the README.html file for full details. Please don't enable a feature if you don't understand what it does!
7 Restart qmail after you create the configureation file and appropriate folders shown below.
If your qmail installation is part of Plesk:
killall -HUP xinetd
or
/etc/init.d/xinetd condrestart
8 That's it. Watch syslog for any errors
tail -f /usr/local/psa/var/log/maillog
System Files and Folders
Now we must create the directories for our greylists:
mkdir -p /var/qmail/spamdyke/greylist touch /var/qmail/spamdyke/blacklist_ip \ /var/qmail/spamdyke/blacklist_recipients \ /var/qmail/spamdyke/whitelist_ip \ /var/qmail/spamdyke/blacklist_keywords \ /var/qmail/spamdyke/blacklist_senders \ /var/qmail/spamdyke/whitelist_senders \ /var/qmail/spamdyke/whitelist_rdns
next we create the proper permissions for the files:
chown -R qmaild:nofiles /var/qmail/spamdyke
Now we need to create folders of all domains(which should be protected) in the greylist directory
cd /var/qmail/spamdyke/greylist/ for i in `ls -1 /var/qmail/mailnames`; do mkdir $i; done chown -R qmaild:nofiles /var/qmail/spamdyke
The Configuration File
This is one that we have used. it is very aggrssive but works! Please do not use anything you do not understand. You can find more information about all FLAGS at http://www.spamdyke.org/documentation/README.html
example Configuration file: spamdyke.conf
log-level=2 local-domains-file=/var/qmail/control/rcpthosts max-recipients=20 idle-timeout-secs=60 graylist-dir=/var/qmail/spamdyke/greylist graylist-min-secs=300 graylist-max-secs=1814400 sender-blacklist-file=/var/qmail/spamdyke/blacklist_senders sender-whitelist-file=/var/qmail/spamdyke/whitelist_senders recipient-blacklist-file=/var/qmail/spamdyke/blacklist_recipients ip-in-rdns-keyword-file=/var/qmail/spamdyke/blacklist_keywords ip-blacklist-file=/var/qmail/spamdyke/blacklist_ip rdns-whitelist-file=/var/qmail/spamdyke/whitelist_rdns ip-whitelist-file=/var/qmail/spamdyke/whitelist_ip reject-empty-rdns reject-unresolvable-rdns greeting-delay-secs=5 never-greylist-ip-file=/var/qmail/spamdyke/never_greylist check-dnsrbl=zen.spamhaus.org check-dnsrbl=dnsbl.ahbl.org check-dnsrbl=dnsbl.njabl.org check-dnsrbl=dnsbl.sorbs.net check-dnsrbl=bogons.cymru.com check-dnsrbl=bl.spamcop.net check-dnsrbl=list.dsbl.org reject-missing-sender-mx tls-certificate-file=/var/qmail/control/servercert.pem local-domains-file=/var/qmail/control/rcpthosts policy-url=http://www.your-domain-here.com/spam_policy
Plesk Event Manager
Now we need to tell plesk to create a directory in the greylists folder everytime we create a new account/domain. After hours of research, searching, and trial and error we, Blue Oryx, Finally have the answer and are sharing it with the world!!!
cd /usr/local/psa/bin touch create_greylist_folder.sh chown root:root create_greylist_folder.sh chmod 755 create_greylist_folder.sh su nano create_greylist_folder.sh
now copy and paste the below. change the greylist_path if necessary. however, if you followed our instructions, nothing should change.
#!/bin/bash # ------------------------------------------------------------------------- # create_greylist_folder.sh - This script creates a folder for spamdyke # greylists # # Usage : Use with Plesk Event Manager - Domain Created/root # qmail server and spamdyke required # # Notes : Servers must be running Plesk 8.3 or higher (only tested so far) # Plesk Command: /usr/local/psa/bin/create_greylist_folder.sh# # Copyright (C) 2008 Blue Oryx Internet Solutions, LLC # Email/Contact : http://www.blueoryx.com/ # Author : Vincenzo S Barranca # Date : Jan-2008 # Last updated : Jan-2008 # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # Blue Oryx has provided this script bug free and working as is. # If file is changed by any party not certified by Blue Oryx, all # warranties shall be voided and support will be billed. This File is # provided without any warranties. Use this script at your own risk # Blue Oryx cannot be held responsible for the use of this file. It works for us # But maybe not for you. # ------------------------------------------------------------------------- # EDIT Here If Needed # ------------------------------------------------------------------------- # greylist folder greylist_path="/var/qmail/spamdyke/greylist/" #------------------------------------------------------------------------- # DO NOT EDIT BELOW HERE #------------------------------------------------------------------------- #go to greylist folder cd $greylist_path # add new folder mkdir $1 # create proper permissions chown qmaild:nofiles $greylist_path$1 exit
now you need to go to Plesk and login. Go to Server >Event Manager > Add New Event Handler
- For Event choose “Domain Created”
- For Priority we chose “Normal(50)
- For User, you must choose root
- and now for the grand finally!!! copy and paste this code into the Command textarea if you followed the steps above
/usr/local/psa/bin/create_greylist_folder.sh
and pres OK
Now you can go to your SSH terminal and go to
cd /var/qmail/spamdyke/greylist ls
Now go to Plesk and create a new Domain (this can be a fake one you can throw away when done).
After the domain has been created go back to the SSH Terminal and run the list command again. You should see a matching folder to the domain you just created!
All Done!
Watch logs in Plesk
Logs found here: /usr/local/psa/var/log/maillog
References
http://forum.swsoft.com/showthread.php?p=197122#post197122
http://www.spamdyke.org/documentation/INSTALL.txt
http://www.spamdyke.org/documentation/README.html
(http://www.blueoryx.info/linux_administration/spamdyke)