Subject: The check's in the mail and the mail is bouncing
To: port-mac <port-mac68k@NetBSD.ORG>
From: Steve Revilak <revilak@umbsky.cc.umb.edu>
List: port-mac68k
Date: 07/09/1998 19:13:13
I have NetBSD running as a standalone setup (ie--not networked),
and make use of an ISP dialup/dynamically assigned IP address.
While setting this up, one of the first snags I ran into was e-mail..
getting the correct address in the From/Reply-to Field...having it
point to "my.isp.name" as opposed to my.local.machine.name".  The
fix here is pretty easy... in /etc/sendmail.cf find the lines

# Who am I masquerading as 
DMfill.in.you.isp.name.here

This fills in the 'letter' portion of the 'From' field--when the
recipient hits 'reply' the mail goes to the right place.

However, I recently began running into a different problem when
sending mail to certain domains (AOL & rapfire.net in particular).
Before accepting the name, these domains do a DNS lookup of the
hostname in the <Return-Path: > field-- (some mailers label this
as 'From:' others as 'Return-Path:'...it's the first line of the
full header).  By default, sendmail does *not* masquerade this,
leaving your local machine/network name.  The DNS lookup fails and
the mail bounces back 'unaccepted: host unknow'. This address field
constitues the 'envelope' address of the message.

Sample headers to illlustrate--


**Envelope not masqueraded

>From revilak@parkdrive.home.net Thu Jul  9 18:21:43 1998
>Received: from parkdrive.home.net (svr02-p24.ppp.umb.edu) by taurus.cc.umb.edu
>          (MX V4.2 VAX) with SMTP; Thu, 09 Jul 1998 21:10:50 EDT
>Received: (from revilak@localhost) by parkdrive.home.net (8.8.8/8.8.8) id
>          SAA00259 for revilak@umbsky.cc.umb.edu; Thu, 9 Jul 1998 18:20:11
>          -0700 (PDT)
>Date: Thu, 9 Jul 1998 18:20:11 -0700 (PDT)
>From: Steve Revilak <revilak@parkdrive.home.net>
>Message-ID: <199807100120.SAA00259@parkdrive.home.net>
>To: revilak@umbsky.cc.umb.edu
>Subject: Not Envelope masquerading
>Status: RO


**Envelope masqueraded

>From revilak@umbsky.cc.umb.edu Thu Jul  9 18:59:48 1998
>Received: from parkdrive.home.net (svr02-p17.ppp.umb.edu) by gemini.cc.umb.edu
>          (MX V4.2 VAX) with SMTP; Thu, 09 Jul 1998 21:49:41 EDT
>Received: (from revilak@localhost) by parkdrive.home.net (8.8.8/8.8.5) id
>          SAA00514 for revilak@umbsky.cc.umb.edu; Thu, 9 Jul 1998 18:24:55
>          -0700 (PDT)
>Date: Thu, 9 Jul 1998 18:24:55 -0700 (PDT)
>From: Steve Revilak <revilak@umbsky.cc.umb.edu>
>Message-ID: <199807100124.SAA00514@parkdrive.home.net>
>To: revilak@umbsky.cc.umb.edu
>Subject: Envelope Masquerading On
>Status: RO


Fixing this turned out to be my head-scratcher for the past few
days.  Granted, you _could_ rename your machine with your ISP's
domain name (Filling in the j$ variable in sendmail.cf --> "What
is my official domain name?).  But that has a few significant
drawbacks.  1) Potential for confusion by having two machines with
the same name connected together and 2) mail sent to another-user@your.isp
will bounce back locally ('user unknown').  I also struck out wih
IPNAT...

Digging through the pages of http://www.sendmail.org, I found the
way to deeal with this is to turn on a feature called
'envelope-masquerading', which involves recompiling /etc/sendmail.cf.
You'll need sendmail sources for this (I believe they would be in
/usr/src/usr/sendmail..though I'm not sure.  I don't have the source
packages), if you have the source distributions, or you can download
them from sendmail's site.

If space is the issue, you only need to retain a portion of
these...you can remove the program sources, and just leave the
configuration file sources.  And you can further preen by blasting
the configuration source files for machines you don't plan on using.

In a nutshell, it boils down to --> copy a template configuration
file... edit.. and build using the m4 macro preprocessor.  (This
was my first experience using m4).  For the benefit of others who
might find themself in the same position I was in a few days ago,
I'll toss out an "Impromptu How-To"  (which could evolve into a
more formal How-To if others here think it would be apppropriate).

In the sendmail sources directory (I'll refer to this as /sendmail
from here on in..) you'll find subdirectory called /cp.  Find the
file sendmail/cf/cf/generic-bsd4.4.cm and copy it to /sendmail/cf/m4/,
renaming appropriately.   Open it up with your text editor dujour
and add the following line at the end--

FEATURE(masquerade_envelope)

This file, "yourconfig.cm" should reside in /sendmail/cf/m4/ along
with a file named cf.m4.  Double check that's indeed the case, then
at the command prompt--

m4 ./cf.m4 yourconfig.cm > yourconfig.cf

(Sendmail's M4 page mentions a number of particulars regarding M4
and directoruy names.  A single dot worked for me).  The build
should only take a few seconds.  Now we just need to make a few
small mods to the output file (yourconfig.cf).

After the .cf file's header, you'll see lines to the effect of:

# file containing the names of hosts we send mail to 
Fw/etc/sendmail.cw

Comment the second line out. (It appears that the .cw file is a
database file that also to be built with dbm (?).  Sendmail
refused to accept delivery until I commented it out).

Next find the line:

# Who am I masquerading as 
DMadd.your.isp.here

Finally, rename your existing /etc/sendmail.cf to 'sendmail.cf.bak',
and copy 'yourconfig.cf' to the /etc directory, renaming it as
sendmail.cf.  Then restart the network by bringing the system into
single user mode:

shutdown now

and then bring it back to multi-user:

exit

Now send yourself some mail to test the new configuration file out.

Again, I hope that there are a couple people out there who will
find this useful...and I apologize for the length this post has
grown to.  Feedback & comments are welcome.

Steve Revilak
revilak@umbsky.cc.umb.edu