Setting up a black hole DNS server.

Let’s say you want to test out a mail server. I just happen to work for a company who’s product is an MTA. The QA group pulled me into a meeting to see how they could configure a system so that the following was true.

  1. There is an outbound MTA consisting of our product.
  2. There are multiple inbound MTAs running on another server.
  3. There is a DNS server that will direct ALL mail traffic to one of the inbound MTAs.
  4. Everything is easy to manage and has the ability to script (so that various scenarios can be scripted and re-executed many times).

Additionally, the inbound MTAs may have different configuration sets where the perform various actions like:

  • bounce mail.
  • accept all mail
  • accept mail and feed it to a script which crawls links in email body

All of this is to thoroughly test the outbound MTA system to see how it responds to bounces and user actions.

As the topic of this post implies, I am going to address the DNS setup tonight. My suggestion was to use MyDNS so that zones are easily managed via MySQL. This allows you to load/dump different states. It also allows you to build setup tools/scripts or whatnot to automate testing.

MyDNS is easy to set up. Let’s take a look at what I am working with.

  • ns.qa-net – 10.0.0.8
  • mta1.qa-net – 10.0.0.9
  • mta2.qa-net – 10.0.0.10

OK, so ns is the nameserver, mta1 is the outbound MTA, and mta2 is inbound. I setup up MyDNS with the default configuration, then I inserted the following into the soa table:

*************************** 1. row ***************************
id: 3
origin: non-existent.com.
ns: ns.qa-dns
mbox: hostmaster.non-existent.com
serial: 1
refresh: 28800
retry: 7200
expire: 604800
minimum: 86400
ttl: 86400
*************************** 2. row ***************************
id: 4
origin: .
ns: ns.qa-dns
mbox: hostmaster.non-existent.com
serial: 1
refresh: 28800
retry: 7200
expire: 604800
minimum: 86400
ttl: 86400

And the following into rr.

*************************** 1. row ***************************
id: 8
zone: 4
name: non-existent.com.
type: MX
data: mail.non-existent.com
aux: 0
ttl: 86400
*************************** 2. row ***************************
id: 9
zone: 3
name: mail.non-existent.com.
type: A
data: 10.0.0.10
aux: 0
ttl: 86400
*************************** 3. row ***************************
id: 10
zone: 4
name: *
type: MX
data: mail.non-existent.com
aux: 0
ttl: 86400

This results in any domain returning mail.non-existent.com which is 10.0.0.10. I can override this behavior by inserting any zones/rrs that I want.


About this entry