How to Enable Greylisting to Prevent Spam

Share this post...Tweet about this on TwitterShare on Google+0Share on Facebook0
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: http://www.interworx.com/support/faq/enable-tarpitting-reduce-spam/

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

6. Restart smtp using the following:

service smtp restart

Feb 9, 2018, 2:48 pmBy: InterWorx
How to Enable Greylisting to Prevent Spam
9 votes, 2.78 avg. rating (55% score)
(0) Comments

Leave a Reply
Surround code blocks with <pre>code</pre>

Your email address will not be published.

Comments

Broken Link