1Prefix WhoIs Milter 2 3 4The Prefix WhoIs Milter is a mail filter for Postfix and Sendmail. It queries 5Prefix WhoIs (whois.pwhois.org by default) about the originating IP address 6found in the final Received or X-Originating-IP mail header. The information 7that it returns may be used for greylisting and can be displayed in modern 8e-mail clients to provide some background as to the origin of the message. 9 10The Prefix WhoIs milter appends e-mail headers of the form X-PWhois-Field-Name 11corresponding to a field in the response from Prefix WhoIs. Currently, it 12inserts information from the Origin-AS, AS-Org-Name, Org-Name, Net-Name, Region, 13Country and Country-Code Prefix WhoIs response fields. 14 15The PWhoIs Milter turns boring e-mail headers like this: 16 17To: "You" <you@example.com> 18From: "John Doe" <johndoe@example.com> 19 20... into useful message headers like this: 21 22To: "You" <you@example.com> 23From: "John Doe" <johndoe@example.com> 24X-PWhois-Origin: 4.2.2.1 25X-PWhois-Origin-AS: 3356 26X-PWhois-AS-Org-Name: Level 3 Communications 27X-PWhois-Org-Name: Level 3 Communications, Inc. 28X-PWhois-Net-Name: LVLT-ORG-4-8 29X-PWhois-City: BROOMFIELD 30X-PWhois-Region: COLORADO 31X-PWhois-Country: UNITED STATES 32X-PWhois-Country-Code: US 33 34The Prefix WhoIs milter implements a safety timeout in case of a network or 35Prefix WhoIs outage; if the timeout period elapses, the message passes through 36unaltered and without further delay, so it is safe to run even in high-volume 37e-mail environments. 38 39 40Installation Instructions 41 42Libmilter is required to build pwhois-milter. This is often available in 43package repositories, such as libmilter-dev for Debian, or you may wish to use 44libmilter from the Sendmail source distribution. Then, simply issue 45 46# make && make install 47 48and copy the init script corresponding to your system to the proper location. 49 50 51Usage Hints and Tips 52 53Add to your Postfix main.cf smtpd_milters chain: 54 55inet:localhost:8472 56 57If you have existing milters in your Postfix milter chain, separate them with a 58comma or space. Neither Postfix nor Sendmail will start pwhois-milter for you 59so you must run the appropriate init script for your system. Alternatively, you 60may wish to run the milter manually: 61 62pwhois-milter -i /path/to/pidfile.pid -l /path/to/logfile.log [ -u UID -g GID ] 63 64View further command line options by running pwhois-milter with no parameters. 65 66Although pwhois-milter has not been tested with Sendmail, it ought to work if 67you add the following to your sendmail.mc: 68 69INPUT_MAIL_FILTER(`PWhois Milter', `S=inet:8472@localhost, T=E:10s') 70 71Signal pwhois-milter with SIGUSR1 to reopen the log file for rotating logs. 72(SIGHUP will terminate the milter.) Preferably configure logrotate(8) or 73touch(1) the log file to create it before instructing pwhois-milter to use it. 74It may not be able to create the file on its own since it should be running with 75limited privileges. 76