Prefix WhoIs Milter

The Prefix WhoIs Milter is a mail filter for Postfix and Sendmail. It queries Prefix WhoIs ( by default) about the originating IP address found in the final Received or X-Originating-IP mail headers. The information that it returns may be used for greylisting and can be displayed in modern e-mail clients to provide some background as to the origin of the message.

As of version 1.5, the Prefix WhoIs Milter additionally enriches based on the IP actually delivering to your mail server. This gives you more options to use when making filtering decisions. Origination headers are sometimes faked and legitimate mass-mailers are frequently performing delivery for illegitimate senders [hopefully unintentionally]. These additional headers have the same names as the other enriched headers, except they have the word "Deliverer" in the header name, e.g., "X-Pwhois-Deliverer-Origin-As: 15169"

The Prefix WhoIs milter appends e-mail headers of the form X-PWhois-Field-Name corresponding to a field in the response from Prefix WhoIs. Currently, it inserts information from the Origin-AS, AS-Org-Name, Org-Name, Net-Name, Region, Country and Country-Code Prefix WhoIs response fields.

The PWhoIs Milter turns boring e-mail headers like this:

To: "You" <>
From: "John Doe" <>

... into useful message headers like this:

To: "You" <>
From: "John Doe" <>
X-PWhois-Region: COLORADO
X-PWhois-Org-Name: Level 3 Communications, Inc. 
X-PWhois-AS-Org-Name: Level 3 Communications
X-PWhois-Deliverer-Origin-AS: 15169
X-PWhois-Deliverer-AS-Org-Name: Google

The Prefix WhoIs milter implements a safety timeout in case of a network or Prefix WhoIs outage; if the timeout period elapses, the message passes through unaltered and without further delay, so it is safe to run even in high-volume e-mail environments.

Installation Instructions

Libmilter is required to build pwhois-milter. This is often available in package repositories, such as libmilter-dev for Debian, or you may wish to use libmilter from the Sendmail source distribution. Then, simply issue

# make && make install
and copy the init script corresponding to your system to the proper location.

Usage Hints and Tips

Add to your Postfix smtpd_milters chain:

If you have existing milters in your Postfix milter chain, separate them with a comma or space. Neither Postfix nor Sendmail will start pwhois-milter for you so you must run the appropriate init script for your system. Alternatively, you may wish to run the milter manually:
pwhois-milter -i /path/to/ -l /path/to/logfile.log \
    [ -u UID -g GID ]
View further command line options by running pwhois-milter with no parameters.

Although pwhois-milter has not been tested with Sendmail, it ought to work if you add the following to your

INPUT_MAIL_FILTER(`PWhois Milter', `S=inet:8472@localhost, T=E:10s')

Signal pwhois-milter with SIGUSR1 to reopen the log file for rotating logs. (SIGHUP will terminate the milter.) Preferably configure logrotate(8) or touch(1) the log file to create it before instructing pwhois-milter to use it. It may not be able to create the file on its own since it should be running with limited privileges. Further, it will not reopen the logfile until it next logs a message.

Download PW Milter

Latest Stable Milter v1.5

Tar/GZip'd Source

Only enter your e-mail address here if you want release announcements (optional). Our mailing list is very low-volume. Privacy Policy.

pWhoIs Information

Bugs? Please report!

Helpful Tools

Currently Nov 26th 2020, 3:17am GMT