greylistd
So, this has helped reduce load of CPU from 30-50% to 5-8%. It has stopped 97% of email with non retries so is probably all spam
== Get greylistd ==
cd /tmp
wget
http://ftp.debian.org/debian/pool/main/g/greylistd/greylistd_0.8.3.2.tar.gz
tar -zxvf greylistd_0.8.3.2.tar.gz
cd greylistd-0.8.3.2/
== Make the folders ==
mkdir /etc/greylistd/
mkdir /var/run/greylistd/
mkdir /var/lib/greylistd/
Provided you are still in the greylistd-0.8.3.2 folder, copy the files:
cp config/* /etc/greylistd/
cp program/greylist* /usr/sbin/
Edit the config at /etc/greylistd/config
== Change permissions ==
chown -R mail:mail /etc/greylistd/
chown -R mail:mail /var/run/greylistd/
chown -R mail:mail /var/lib/greylistd/
chown -R mail:mail /usr/sbin/greylist*
== Run greylistd in the background ==
su mail
/usr/sbin/greylistd &
exit
or /usr/sbin/greylistd
== Edit the exim.conf ==
Now (as root) open /etc/exim.conf and search for the following section:
# accept mail to
[email protected], regardless of source
# accept local_parts = errors
# domains = example.com
Add the following below it:
#GREYLIST
defer message = $sender_host_address is greylisted
log_message = greylisted.
hosts = !+relay_hosts
domains = +relay_domains
!senders = : postmaster@*
set acl_m6 = $sender_host_address $sender_address $local_part@$domain
set acl_m6 = ${readsocket{/var/run/greylistd/socket}{$acl_m6}{5s}{}{}}
condition = ${if eq {$acl_m6}{grey}{true}{false}}
# authenticated = *
Restart exim
/usr/local/etc/rc.d/exim restart
== Check everything works ==
root@sophia:~# greylist stats
Statistics since Mon Nov 27 11:45:38 2006 (2 hours and 46 minutes ago)
----------------------------------------------------------------------
186 items, matching 198 requests, are currently whitelisted
0 items, matching 0 requests, are currently blacklisted
2237 items, matching 2319 requests, are currently greylisted
Of 186 items that were initially greylisted:
- 186 (100.0%) became whitelisted
- 0 ( 0.0%) expired from the greylist
Check the log:
root@sophia:~# tail -f /var/log/maillog | grep greylist
Nov 27 14:32:17 sophia exim: 2006-11-27 14:32:17 H=xx.ct.comcast.net [24.2.xx.xx] F=<
[email protected]> temporarily rejected RCPT <
[email protected]>: greylisted.
Nov 27 14:32:20 sophia exim: 2006-11-27 14:32:20 H=smtp3.clear.net.nz [203.97.33.64] F=<
[email protected]> temporarily rejected RCPT <
[email protected]>: greylisted.
Nov 27 14:32:20 sophia exim: 2006-11-27 14:32:20 H=smtp3.clear.net.nz [203.97.33.64] F=<
[email protected]> temporarily rejected RCPT <
[email protected]>: greylisted.
== Add to startup ==
Provided everything is working, add the following to your startup:
pico /etc/rc.local
/usr/bin/su mail -c /usr/sbin/greylistd &