On Wed, Aug 09, 2006 at 11:58:45AM +1000, Peter Miller ([EMAIL PROTECTED])
wrote:
> On Wed, 2006-08-09 at 11:22 +1000, Jobst Schmalenbach wrote:
> > On Wed, Aug 09, 2006 at 08:14:40AM +1000, Peter Miller ([EMAIL PROTECTED])
> > wrote:
> > > Is there any elegant way to have a laptop DHCP client have its sendmail
> > > configured properly? In all the cases I have to deal with, my laptop is
> > > a DHCP client is behind a NAT firewall.
> >
> > in sendmail.mc:
> >
> > define(`SMART_HOST',`YOUR_ISP_UPSTREAM_MAILSERVER')
> >
> > then do a make in /etc/mail and restart sendmail
>
> I'm not getting it, this morning.
>
> In my case, the value of YOUR_ISP_UPSTREAM_MAILSERVER depends on which
> firewall I'm behind, since all the ISPs in question gate client
> connections as being from their own customers' IP addresses, not the
> whole Internet. So one size definitely doesn't fit all.
>
> Are you suggesting I need to edit sendmail.mc every time I boot the
> machine? Is there a way to automagically have the DHCP client daemon
> run a script to do it, instead? Has this already been done, in a Debian
> package? How does the script get the right value for
> YOUR_ISP_UPSTREAM_MAILSERVER from the DHCP server?
Well, because sendmail starts AFTER the network is up and
by then you know your IP address you could write a little
script that changes (sed and awk) the sendmail.mc
file and issues a "make" in /etc/mail, and when
sendmail starts it knows the smarthost.
Alternatively you can re-write the /etc/rc.d/init/sendmail
in a way that when starting you have
after
prog="sendmail"
but before
"start() {"
something like this:
cd /etc/mail
echo "1. mail1.domain1.com"
echo "2. mail1.domain2.com"
echo "3. mail1.domain3.com"
echo "4. mail1.domain4.com"
read -p "what smarthost do you want?" -n 1 key
if [[ $key = 1 ]]; then
echo "copying sendmail.mc file for smarthost 1
cp sendmail.mc.1 sendmail.mc
elif [[ $key = 2 ]]; then
echo "copying sendmail.mc file for smarthost 2
cp sendmail.mc.2 sendmail.mc
fi
make clean
make
newaliases
cd /etc/rc.d/init
sendmail.mc.X have to have different smarthosts of course.
done!
>
>
> --
> Regards
> Peter Miller <[EMAIL PROTECTED]>
> /\/\* http://www.canb.auug.org.au/~millerp/
>
> PGP public key ID: 1024D/D0EDB64D
> fingerprint = AD0A C5DF C426 4F03 5D53 2BDB 18D8 A4E2 D0ED B64D
> See http://www.keyserver.net or any PGP keyserver for public key.
--
"XP: If you are nine years old you are just going to love it. If you're a few
years older you'll resent the choking paternalistic atmosphere of vapid
gee-whiz kiddie entertainment (babysitting), euphemism and fake-friendly
bullying."
__, Jobst Schmalenbach, Technical Director
_ _.--'-n_/ Barrett Consulting Group P/L & The Meditation Room P/L
-(_)------(_)= +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html