[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

SOLVED Smart_Host vs FALLBACK_MX Was [Re: More on Masquerading]

On Tue, 2004-08-17 at 03:03, Alexander Dalloz wrote:
> >Am So, den 15.08.2004 schrieb Ow Mun Heng um 12:19:
> > My Problem.
> > @work = mails must be sent out using the corp exhange server (smart host
> > feature _must_ be implemented via sendmail.mc)
> > 
> > @home = mails are sent out w/o using smart host. Meaning, I have to
> > actively re-compile sendmail.mc each time between office and home to
> > send out emails. Cause @home, mails gets relayed directly to the
> > receipient's MX. 
> > What I want to know is, is there a way to say that I want mails to be
> > sent out 1st using the Direct approach, if it fails then fall back to
> > the smart host.
> > 
> > 
> > pseudo code :
> > if [check if it's a local address ]; then
> > 	pass to local sendmail
> > elif [check if we can send direct to MX ]
> > 	pass to sendmail for direct MX
> > else # when all else fails
> >        pass to smart host for relay
> If I remember correctly there is no such fallback order.

Actually I found out there IS!

> Do you use different mail addresses at work and at home? Then you could
> use smarttable. Else I would suggest not using the smart_host definition
> in the sendmail.mc file, but to use the mailertable instead. That makes
> switching a bit easier: you don't need to restart the Sendmail daemon
> because you don't change the sendmail.mc/.cf file but the mailtertable
> hashed map file: edit the mailertable file and run "make -C /etc/mail"
> and your change takes place immediately. See

2 Months after going the manual method of doing the above pseudo code
(implemented as per code below), which works by the way, just a bit
manual. I found out that the pseudo code which I wanted actually exists.
It's actually marked as /usr/share/sendmail-cf/README

	confFALLBACK_MX         FallbackMXhost  [undefined] Fallback MX host.

Note the !!undefined!! Finally today, I came to know how it's used. As the name
states, it's a Fallback mechanism in case things don't work out with the 
send direct to MX approach.

It Works. Doing an ethereal trace, I noted that it first tried to lookup the MX of the 
domain which mail is to be sent to, and then it tries to send it via that path, since
mail can't go that path, due to errors, it will re-try, this time
with the fallback MX Host. Mail then gets through.

==========MY Original Script - REdundant Now=============

# This is to automatically change from using MX and to using 
# Sept 24 2004
# 4pm

#if [ id != 0 ]; then
#       echo "Got Root?"
#       exit 1

case "$1" in
           echo "Altering Sendmail Config to use MX"
           mv /etc/mail/sendmail.mc /etc/mail/sendmail.mc.office
           mv /etc/mail/sendmail.mc.MX /etc/mail/sendmail.mc
           touch /etc/mail/sendmail.mc
           sleep 1
           m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf  
           /etc/init.d/sendmail restart
           echo "Altering Sendmail Config to use Smart Host"
           mv /etc/mail/sendmail.mc /etc/mail/sendmail.mc.MX
           mv /etc/mail/sendmail.mc.office /etc/mail/sendmail.mc
           touch /etc/mail/sendmail.mc
           sleep 1
           m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf  
           /etc/init.d/sendmail restart
          if [ "`cat /etc/mail/sendmail.cf | grep wdc | cut -d\( -f1`" ==  "DSsmart-host.entry.com" ] ;
                echo "Sendmail currently configured with SMART_HOST"
                echo "Sendmail currently configured to use MX"
          echo "Usage: $0 {MX | office | status}"

exit 0

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]