Sendmail: Mr. X


        My first encounter with Mr. X was a six years ago when for some reasons mails were bouncing like Ping-Pong balls. After a frantic long distance call, the support staff told me about the solaris sendmail bug, it won't talk to a mail exchanger. He told me just to rename the file /usr/lib/sendmail.mx to /usr/lib/sendmail and restart the sendmail daemon. Well I thought, that is easy anyone can administer a solaris box. Not so fast, the root mailbox were growing like a malignant tumor.  I was just lucky, I kept an a copy of the old brain dead /usr/lib/sendmail. I reverted to the old system, at least most of my mails were flowing without problems.

    So the hunt goes on for the mysterious Mr. X, which brought me to eric allman's ftp server (ftp.cs.berkeley.edu). As if conjured by some great magician things were working in place again. Ever since then, I stopped using mx hack from solaris. Years have passed and megabytes of mails were routed and rerouted, rumors were spreading that my gossip portal had an open window. A visit to the new sendmail site (ftp.sendmail.org), a cure was waiting. Until one day I got this email from someone with a header XXX, my customary attitude to spammers (btw I like the real SPAM) was to ignore and delete. I decided to read it, because the sender was someone with an EDU as an address. It happens to be an email from another sysad telling me, that I was hit a relay spammer. WHAT?? I was so astonished, how could they do it without my syslog knowing it. So my reaction was to block the originating site, but it was not enough another pervert were using my machine again. It's high time to close this gaping hole.

    By this time sendmail (www.sendmail.com) was already a commercial outfit and already on the 8.9.1 incarnation. Mr. 4 from macroland has been enlisted in the battle for ever increasing complexity of the regular expression hordes. To my relief, I dont have to fiddle sendmail.cf  and have to cast some anarchic spell just for my mails to flow out unmolested.

    As every sysad would attest, your other feet is always on the edge of what you knew and what you don't. I was then trying to add some redundancy into our mail servers, trouble was always waiting in ambush for the unwary and naive. I went to the old veritable sendmail site (www.sendmail.org) the FAQ and links were aplently. But, I was just looking for a way to implement an MX or mail exchanger (a.k.a. Mail Hub, Relay or gateway, etc.). There was an inch long discussion of it, so I tried.

           internal.domain.com    IN    A     10.0.0.1        ; (Private IP network)
           internal.domain.com    IN    MX   10 external.domain.com

     What an elegant way of solving your problem, let others do it for you. This time sendmail relegated the problem to the name server (BIND). I think the FAQ was written on april 1, my email to  users@internal.domain.com was bouncing with a very big error "Loop Back Error". The FAQ said if you get a loop back error, you should define Cw, but wait a minute I'm not trying to masquerade another server. I just wanted external.domain.com so receive the mail from the outside world and have it relayed it to internal.domain.com for final delivery.  After the initial setback, I decided to use a linux server as my laboratory rat, the solaris box was just finicky. So after asking this question to sendmail@sendmail.org, the response was, external.domain.com has relay no idea what to do once it receives the email, it had to be told before hand by the way of a mailertable. So its clearer now, after all you still have to tinker with your sendmail.cf! Finally you have to create a mailertable with the following format:

            internal.domain.com    smtp:[internal.domain.com]

    Then create your mailertable database with makemap hash mailertable <mailertable. Restart your sendmail daemon and external.domain.com is now ready to relay any messages for internal.domain.com.
 

Attachments:

Configuration for solaris servers.

VERSIONID(`@(#)solaris2.mc    8.9.1  MSU-IIT 8/27/98')
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
define(`DATABASE_MAP_TYPE', `dbm')dnl
FEATURE(mailertable, dbm /etc/mail/mailertable)dnl
FEATURE(relay_based_on_MX)dnl
MAILER(local, /bin/mail)dnl
MAILER(smtp)dnl
 

Configuration for Linux Servers:

VERSIONID(`@(#)linux.mc 8.9.1 MSU-IIT 8/27/98 ')
OSTYPE(linux)dnl
DOMAIN(generic)dnl
FEATURE(relay_based_on_MX)dnl
FEATURE(local_procmail)dnl
FEATURE(mailertable)dnl
FEATURE(access_db)dnl
MAILER(procmail)dnl
MAILER(smtp)dnl

Caveat for REDHAT Linux servers:

    This configuration would produce a local mailer pointing to /usr/local/bin/procmail, yet your procmail is at /usr/bin/procmail so you have to create a link to it. (ln -s /usr/bin/procmail /usr/local/bin/procmail).