Note

You are viewing the documentation for an older release of Interworx (6.x). To see documentation for the current generally available release of Interworx, click here: 7.13.

How to Enable Greylisting to Prevent Spam

Greylisting means that the server will initially reject mail from unknown senders and then accepts the message up on the second attempt. This involves a greet delay, so messages will have to wait a few seconds before being accepted. Legitimate mail will wait, but spam will generally not. Further information: https://www.greylisting.org/

Enabling this along with tarpitting can even more effective in reducing spam. For documentation on how to enable tarpitting, click here.

Set Up:

To enable greylisting, follow these steps:

  1. At the command line, use the text editor to view /etc/tcprules.d/tcp.smtp. It will look similar to the following:

    127.:allow,RELAYCLIENT="",JGREYLIST=""
    ::1:allow,RELAYCLIENT="",JGREYLIST=""
    :allow,LANG="en_US",QMAILQUEUE="/var/qmail/bin/simscan",CHKUSER_MBXQUOTA="99",JGREYLIST_DIR="/var/qmail/jgreylist",JGREYLIST=""
    
  2. On the line that begins with :allow, if JGREYLIST="" exists, delete JGREYLIST=""

  3. On the line that begins with :allow, if JGREYLIST_DIR="/var/qmail/jgreylist" does not already exist, add the following: JGREYLIST_DIR="/var/qmail/jgreylist". Example:

    127.:allow,RELAYCLIENT="",JGREYLIST=""
    ::1:allow,RELAYCLIENT="",JGREYLIST=""
    :allow,LANG="en_US",QMAILQUEUE="/var/qmail/bin/simscan",CHKUSER_MBXQUOTA="99",JGREYLIST_DIR="/var/qmail/jgreylist"
    
  4. Using the text editor, open service/smtp/run

  5. Make sure that the GREYLIST variable is listed and is also not commented out. It should point to /var/qmail/bin/jgreylist Example:

    #!/bin/sh
    QMAILDUID=`id -u vpopmail\`
    NOFILESGID=`id -g vpopmail\`
    MAXSMTPD=`cat /var/qmail/control/concurrencyincoming\`
    BLACKLIST=`cat /var/qmail/control/blacklists\`
    SMTPD="/var/qmail/bin/qmail-smtpd"
    TCP_CDB="/etc/tcprules.d/tcp.smtp.cdb"
    RBLSMTPD="/usr/bin/rblsmtpd"
    HOSTNAME=`hostname\`
    VCHKPW="/home/vpopmail/bin/vchkpw"
    GREYLIST="/var/qmail/bin/jgreylist"
    ARCH=`uname -i`
    
  6. Set permissions on /var/qmail/jgreylist so that it is owned by vpopmail:

    [root@localhost tcprules.d]# ls -ld /var/qmail/jgreylist
    drwx------. 2 root root 6 Apr 11 2016 /var/qmail/jgreylist
    [root@localhost tcprules.d]# chown vpopmail:vchkpw /var/qmail/jgreylist
    
  7. Restart smtp using the following command:

    service smtp restart