Guide updated on 29th of February 2016

Implement greylisting feature


Greylisting (or graylisting) is a method of defending e-mail users against spam.

With this feature, qmail will "temporarily reject" any email from a sender it does not recognize. If the mail is legitimate the originating server will, after a delay, try again and, if sufficient time has elapsed, the email will be accepted. If the mail is from a spam sender, sending to many thousands of email addresses, it will probably not be retried.

We 'll make use of Perl scripts jgreylist and jgreylist-clean written by John Simpson

Edit /var/qmail/supervise/qmail-smtpd/run and change the following

GREYLIST="/var/qmail/bin/jgreylist"
JGREYLIST_DIR="$VQ/jgreylist"

cp /downloads/scripts/jgreylist /var/qmail/bin
cp /downloads/scripts/jgreylist-clean /usr/local/sbin
chown root:vchkpw /var/qmail/bin/jgreylist
chmod 0750 /var/qmail/bin/jgreylist
chown root:root /usr/local/sbin/jgreylist-clean
chmod 0755 /usr/local/sbin/jgreylist-clean

mkdir -m 0700 /var/qmail/jgreylist
chown vpopmail:vchkpw /var/qmail/jgreylist
echo '/usr/local/sbin/jgreylist-clean 2>&1 > /dev/null' > /etc/cron.daily/jgreylist-clean
qmailctl restart

OPTIONAL : If you need more performance you can use a compiled version of jgreylist

cd /downloads/scripts/
mv /downloads/scripts/jgreylist /downloads/scripts/jgreylist.pl
make jgreylist
cp /downloads/scripts/jgreylist /var/qmail/bin
chown root:vchkpw /var/qmail/bin/jgreylist
chmod 0750 /var/qmail/bin/jgreylist

List of optional features


Users comments
Thibs - 02/04/2013 21:44

It's just temporary rejected.

Take a look on http://qmailrocks.thibs.com/greylisting.php for more explanation (in this case it's how to implement it)

Matt - 02/04/2013 17:13

Any ideas why I get this for some domains?

------------------------------------------

var/qmail/bin/qmail-remote: 25: [[: not found

sxxx.xxx.xxx.xxx does not like recipient.

Remote host said: 450 4.2.0 : Recipient address rejected: Greylisted, see

http://postgrey.schweikert.ch/help/xxx.com.html

Giving up on xxx.xxx.xxx.xxx.

------------------------------------------

 

Thibs - 22/11/2012 12:44

Hello,

You probably missed the installation of daemontools as described on package-install.php.

aptitude install ucspi-tcp daemontools daemontools-run

Simon - 17/11/2012 18:18

Hei Guys,

 

i crefully followed steps for the qmail installation ... i double check but i'm blocked right now ... 

qmailctl restart

Restarting qmail:

* Stopping qmail-smtpdssl.

/usr/bin/qmailctl: 126: svc: not found

* Stopping qmail-smtpd.

/usr/bin/qmailctl: 126: svc: not found

* Sending qmail-send SIGTERM and restarting.

/usr/bin/qmailctl: 126: svc: not found

* Restarting qmail-smtpd.

/usr/bin/qmailctl: 126: svc: not found

* Restarting qmail-smtpdssl.

/usr/bin/qmailctl: 126: svc: not found

 

i had problems with the final step in qmail installation when i have to :

 

Create symlinks in /etc/service directory

ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /var/qmail/supervise/qmail-smtpdssl /etc/service

 

Because /etc/service in squeeze is not a dir. i created manually the dir, created the sym links and then ln -s /etc/service /service

 

the link is present ...

lrwxrwxrwx 1 root root 23 Nov 17 16:00 qmailctl -> /var/qmail/bin/qmailctl

Thibs - 01/04/2012 14:51

@Abel : I think so but I'm not 100% sure. Best is to ask to the scripts maker

Abel - 30/03/2012 20:11

 

If I use a compiled version of jgreylist, should I also install the script jgreylist-clean?

 

Thankyou

 


Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.