debian/rules
   
Wed, 10 Mar 2004

A response to SMTP proxying...

In response to Steve Kemp's post about SMTP proxying, I'd like to mention that we do a very similar thing here at work. Albeit, the difference being that the relays in question are not in the DMZ.

How we approached this problem, was to make the domains local to the 'mailhub', and have 'alias tables' for said domains. Given, the hubs here run RH, so we battle with sendmail (Yech, Ick, and all that... don't get me started). Where there is purely routing to be done, we just use the mailertable, with smtp:[<host>] to get around the MX being elsewhere.. Sendmail actually makes the inital problem easy, using a virtusertable file. It ends up containing something like this:

user1@domain1.com   otheruser@internalmachine1
user2@domain1.com   otheruser@internalmachine2
@domain1.com        %1@internalmachine1

Where the final line is a fall through for any other local part, if it's wanted.

Of course, this can also be really easily done with exim. First, set your domains up as local (since we need to do local part routing, we wont use relay_domains):

local_domains = /etc/exim/local_domains : /etc/exim/relay_domains

Then have a director to do the work:

relay_aliases:
  domains = /etc/exim/relay_domains
  driver = aliasfile
  file_transport = address_file
  pipe_transport = address_pipe
  file = /etc/exim/aliases_${domain}
  modemask = 002
  owngroups = mail
  owners = root
  qualify_preserve_domain = true
  search_type = lsearch

Where /etc/exim/aliases_${domain} contains:

user1:  otheruser@internalmachine1
user2:  otheruser@internalmachine2

Fall throughs can be done with another director:

unknown_aliases:
  domains = /etc/exim/relay_domains
  driver = smartuser
  new_address = ${quote:$local_part}@internalmachine1

Easy! Of course, all that is Exim3 speak... I haven't bothered to upgrade and learn Exim4 speak yet... one day, just not today.

Writing a perl smtp proxy seems somewhat overkill-ish, where you suddenly have a piece of code you must maintain for eternity... But, each to their own I guess.

[21:43] [/Random] [permanent link]