Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 27th June 2007, 16:58
Henrique Dias Henrique Dias is offline
Junior Member
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 2 Times in 1 Post
Default Installing Milter-Greylist with GeoIP to control the spam

The Milter-Greylist is a milter to sendmail written in C that implements the greylist filtering system, as proposed by Evan Harris.
The page of project have a full explanation who the Greylisting work.

1 System requirements

- Sendmail that supports the milter interface
- Berkeley DB Library
- GeoIP C Library

2 Installing

To install milter-greylist, we need download the most recent stable release from ftp://ftp.espci.fr/pub/milter-greylist/
$ wget ftp://ftp.espci.fr/pub/milter-greylist/milter-greylist-3.1.8.tgz
But, first install the GeoIP C Library. Follow the instructions to install from this page.

If your system not have Berkeley DB library, please install.

Now, unpack and compile.

$ tar xvfz milter-greylist-3.1.8.tgz
$ cd milter-greylist-3.1.8
Check the documantation and the optional packages

$ more README
$ ./configure --help
$ ./configure --with-libGeoIP
$ make
$ sudo make install
3 Configuring

Edit the greylist.conf and take a look.
$ sudo nano -w /etc/mail/greylist.conf
pidfile "/var/run/milter-greylist.pid"
socket "/var/run/milter-greylist.sock"
dumpfile "/var/milter-greylist/greylist.db"
user "smmsp"

# Be verbose (or use -v flag)

# Do not tell spammer how long they have to wait

# The geoipdb statement is used to specify the location of GeoIP database
geoipdb "/usr/share/GeoIP/GeoIP.dat"

# Your own network, which should not suffer greylisting
list "my network" addr { \ \ \ \

list "yellow countries" geoip { \
        "BR" "CR" "DE" "FI" \
        "FR" "GB" "HU" "IL" \

list "red countries" geoip { \
        "CN" "HK" "KR" "RU" "TR" "TW" "UA" \

# And here is the access list
acl whitelist list "my network"

# Followed by an operator and a recipient count, this is used to select
# the amount of recipients
acl blacklist rcptcount >= 25 msg "No more than 25 recipients, please"

acl greylist list "yellow countries" delay 15m autowhite 3d
acl greylist list "red countries" delay 30m autowhite 3d

# During office hours from 9:00 to 18:00 from monday to friday (like crontab)
acl greylist time "* 9-18 * * 1-5" delay 5m autowhite 7d

acl greylist default delay 10m autowhite 7d
Test if the configuration is ok
$ sudo /usr/local/bin/milter-greylist -c
Start the milter
$ sudo /usr/local/bin/milter-greylist
Edit the /etc/mail/sendmail.mc file and add the lines below.

dnl Greylist
INPUT_MAIL_FILTER(`greylist',`S=local:/var/run/milter-greylist.sock, F=T, T=S:4m;R:4m')dnl
define(`confMILTER_MACROS_CONNECT', `j, {if_addr}')dnl
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_authen}')dnl
define(`confMILTER_MACROS_ENVRCPT', `{greylist}')dnl
Rebuild the sendmail.cf file
$ sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Restart the sendmail
$ sudo /etc/init.d/sendmail restart
Finally check the logs to verify if everything is fine.
$ sudo tail -f /var/log/mail.log
4 Links


Last edited by Henrique Dias; 27th June 2007 at 18:07.
Reply With Quote
The Following 2 Users Say Thank You to Henrique Dias For This Useful Post:
bjehzttsa9827 (21st November 2014), falko (28th June 2007)
Sponsored Links
Old 28th June 2007, 22:31
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts

Thanks a lot! Maybe you can contribute this to the main site ( http://www.howtoforge.com/add_howto ) so that I can publish it on the front page? If you don't have the time, I can do it for you. Just let me know.
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
bjehzttsa9827 (13th November 2014)


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmin docs missing namit Server Operation 11 5th January 2006 10:51

All times are GMT +2. The time now is 09:26.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.