Helgrim.com

Chicken Little only has to be right once. 

Software » Sendmail » Stress testing

Using a live feed to test a new server

Until this sentence is removed, this is still a work in progress.

I recently had to deploy a new mail system which does full spam and virus scanning. Prior to deployment though, I needed to fully test the system with a realistic sample of traffic. The obvious thing to do was to take our existing mail traffic and copy it to the new server. However, it was important that none of this traffic resulted in no duplicated error messages or, worse still, duplicated delivery. I had to figure out the following:

  1. How to ensure that the test server does not generate any error messages that could find their way back to real life senders;
  2. How to ensure that the test server does not queue or send any messages that could find their way back to real life recipients;
  3. How to copy the live traffic to the test server during testing while ensuring no errors are reported by the live server.

Initial setup

The test server, which we shall refer to as blackhole.example, consists of a FreeBSD 4.11 server with the default Sendmail 8.13.1 installation, with the following blackhole.example.mc file:
VERSIONID(`$FreeBSD: src/etc/sendmail/freebsd.mc,v 1.10.2.19 2003/12/31 17:42:16 gshapiro Exp $')
OSTYPE(freebsd4)
DOMAIN(generic)

FEATURE(access_db, `hash -o -T /etc/mail/access')
FEATURE(blacklist_recipients)
FEATURE(local_lmtp)
FEATURE(mailertable, `hash -o /etc/mail/mailertable')
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')

DAEMON_OPTIONS(`Name=IPv4, Family=inet')
DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O')

MAILER(local)
MAILER(smtp)
The live server, live.example is also running FreeBSD and sendmail.

1. Stop blackhole.example from delivering emails.

We add the following local rulesets to blackhole.example.mc file after the MAILER(local) line:

LOCAL_RULE_0
R $*		$: blackhole<@localhost.>
LOCAL_RULESETS
SLocal_check_rcpt
R $*	$#discard $:discard

This forces sendmail to select the local delivery agent for all email it receives, and then forces the local delivery agent to discard everything.

Blackhole.example is now incapable of delivering email anywhere.

2. Make blackhole.example accept all email without errors

It is vital that when live.example hands an email over to blackhole.example, blackhole does not give any errors to live.example. We add the following rules to blackhole.example.mc:

define(`confREFUSE_LA, 1000')
define(`confQUEUE_LA, 1000')
There are more options to set here, I'll come back to this.

3. Copy messages from live.example to test.example

This is the fun bit. live.example is quite a stressed machine, so I didn't want to hurt it further with tools like MIMEDefang. Instead, I just make sendmail think that it received an extra recipient address for each message, and have that address delivered to test.example.

3.1 Insert an extra recipient into all received messages

Sources

    Sources used figuring this out I found include:
  • "Sendmail", 3rd Edition, O'Reilly: §6.3.3 An Email Blackhole
  • "Email Archiving", Shane B. Milburn, http://www.geocities.com/sbmilbur/sendmail/email_archiving.html
© Feargal Reilly 2003-2012 | feargal@helgrim.com | Valid HTML 4.01 | Valid CSS