Open relay test with mrt

An excellent free stand-alone tool to test your mail relays for open/promiscuous relaying is the Mail Relay Tester (mrt). Although various Web sites offer a similar test, they are generally not as thorough as the Mail Relay Tester. Also, certain sites (e.g. http://www.ordb.org) will place your relays in their open relay database after testing, if applicable.

To see if your mail relays are currently listed in one or more DNS blacklists, visit openrbl.org.

1. Download mrt:
wget ftp://ftp.monkeys.com/pub/mail-tools/perl/mrt/mrt

2. Download an mrt test patterns file:
wget ftp://ftp.monkeys.com/pub/mail-tools/perl/mrt/test.patterns

3. Download an mrt test message file:
wget ftp://ftp.monkeys.com/pub/mail-tools/perl/mrt/test.message

4. Install the Piece.pm Perl module:
perl -MCPAN -e 'install Time::Piece'


Example usage:
./mrt test.patterns test.message mail_relay

If the mail relay is not an open/promiscuous relay, you should see a series of error messages such as:

mrt: mail_relay_IP: SMTP error (550) reading RCPT response
mrt: mail_relay_IP: SMTP error (550) reading RCPT response
mrt: mail_relay_IP: SMTP error (550) reading RCPT response
mrt: mail_relay_IP SMTP error (553) reading MAIL response
mrt: mail_relay_IP: SMTP error (550) reading RCPT response
...

If you see "Message accepted," you may have an open/promiscuous relay:
mrt: mail_relay_IP: Message accepted

Run mrt in verbose mode to identify how your email servers are susceptible to open relaying:
./mrt -v test.patterns test.message mail_relay

Sendmail's "LOOSE_RELAY_CHECK" FEATURE appears to be vulnerable to the following three types of source-addressing:
user%arbitrary_host@your_mail_relay
user@arbitrary_host@your_mail_relay
arbitrary_host!user@your_mail_relay


I recommend disabling this FEATURE on any Internet-facing mail relay.

Back to brandonhutchinson.com.
Last modified: 05/14/2004