Miss any of our Open RFC calls?Watch the recordings here! »


1.0.12 • Public • Published

Build Status Windows Build status Code Climate Greenkeeper badge NPM


provide geographic information about mail senders.


Use MaxMind's GeoIP databases to report geographic information about senders.

This plugin supports several geoip modules:

* [maxmind](https://github.com/runk/node-maxmind) 0.6 (maxmind v1)
* [maxmind](https://github.com/runk/node-maxmind) 1.0+ (maxmind v2)
* [geoip-lite](https://github.com/bluesmoon/node-geoip)

Support for geoip-lite is published to npm separately as haraka-plugin-geoip-lite.


The maxmind module requires the manual download of the GeoIP databases. The npm module maxmind-geolite-mirror will download the files for you and also keep them up-to-date if you run it periodically.

mkdir -p /usr/local/share/GeoIP
npm install -g maxmind-geolite-mirror


GeoIP results are stored in connection.notes.geoip and the haraka-results object at connection.results.geoip. The following information is typically available:

continent: NA,
country:   US,

If the GeoIP city database is available, the following may also be available:

region:   CA,
city:     San Francisco,
ll:       [37.7484, -122.4156],
distance: 1539    // in kilometers
range:    [ 3479299040, 3479299071 ],

geoip also adds entries like this to your logs:

[geoip] US
[geoip] US, WA
[geoip] US, WA, Seattle
[geoip] US, WA, Seattle, 1319km

Calculating the distance requires the public IP of this mail server. This may be the IP that Haraka is bound to. If not, make sure that utils.get_public_ip can figure it out (automatically via STUN or manually specified in smtp.ini).


  • distance

Performs geodesic distance calculations. Calculates the distance "as the crow flies" from the remote mail server.

This calculation requires a 'from' IP address. This will typically be the public IP of your mail server. If Haraka is bound to a private IP, net_utils will attempt to determine your public IP. If that doesn't work, edit config/smtp.ini and set public_ip.

Set a connection result to true if the distance exceeds this many kilometers.

  • too_far=4000

  • show.city

show city data in logs and headers. City data is less accurate than country.

  • show.region in logs and headers. Regional data are US states, Canadian provinces and such.


Spatio-temporal Network-level Automatic Reputation Engine

"For ham, 90% of the messages travel about 4,000 km or less. On the
other hand, for spam, only 28% of messages stay within this range."

Observations in 2014-2016 suggest that geodesic distance continues to be highly correlated with spam.


The distance calculations are more concerned with being fast than accurate. The MaxMind location data is collected from whois and is of limited accuracy. MaxMind offers more accurate data for a fee.

For distance calculations, the earth is considered a perfect sphere. In reality, it is not. Accuracy should be within 1%.


MaxMind: http://www.maxmind.com/

Databases: http://geolite.maxmind.com/download/geoip/database


npm i haraka-plugin-geoip

DownloadsWeekly Downloads






Unpacked Size

22.8 kB

Total Files


Last publish


  • avatar
  • avatar
  • avatar