Subject: Re: The check's in the mail and the mail is bouncing
To: Steve Revilak <revilak@umbsky.cc.umb.edu>
From: Skeelo <skeelo@white-dwarf.dyn.ml.org>
List: port-mac68k
Date: 07/10/1998 19:45:12
See below.

On Thu, 9 Jul 1998, Steve Revilak wrote:

[snip]

> 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.

They would be in two places, /usr/src/usr.sbin/sendmail and
/usr/share/sendmail (at least on my -current system).

> 
> 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).

I'd read much more about this before attempting a How-To if I were you.
IMHO. But if there is a high demand for this stuff I could put together
something. I recently trudged through the sendmail operations guide and
cf/README docs, before setting up two m4 configurations. (One for my box
and one for a friend's solaris box.)

> 
> In the sendmail sources directory (I'll refer to this as /sendmail
> from here on in..) you'll find subdirectory called /cp.  Find the
						    ^^^^
that's .../sendmail/cf

> file sendmail/cf/cf/generic-bsd4.4.cm and copy it to /sendmail/cf/m4/,

I'd try starting with .../sendmail/cf/cf/netbsd-proto.mc and just copying
it to your-config.mc in .../sendmail/cf/cf (working from the netbsd src
not the sendmail src package). There is a nice Makefile here that makes m4
"compilation" easy. (make your-config.cf)

> renaming appropriately.   Open it up with your text editor dujour
> and add the following line at the end--
> 

>From the cf/README file:
The general rules are that the order should be:

        VERSIONID
        OSTYPE
        DOMAIN
        FEATURE
        local macro definitions
        MAILER
        LOCAL_RULESET_*



> 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

As mentioned above there is a nice Makefile in
/usr/src/usr.sbin/sendmail/cf/cf so that all you have to do is type

make your-config.cf

at the prompt. If you keep your .mc file in the .../sendmail/cf/cf
directory.

> 
> (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).

/etc/sendmail.cw is a listing of hosts that your server should accept mail
for, it is not a dbm database (like /etc/aliases) but just a plain text
file. For most cases it should be fine to just comment this out. There are
also m4 macros to get rid of this in your .cf file. Sendmail should be
happy with an empty file also. (touch /etc/sendmail.cw)

> 
> 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 info snipped]

Woah!! You don't have to do anything like that just send a HUP signal to
sendmail it will re-read it's configuration file and all your changes will
take effect.

To do this just use the command below at the shell prompt.

kill -HUP `cat /var/run/sendmail.pid | head -n 1`

> 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.

I know it's a pain to trudge through boring documentation, but it really
would help you to read parts of .../sendmail/cf/README and the sendmail
operations guide (Far fewer parts of this =]).

> 
> Steve Revilak
> revilak@umbsky.cc.umb.edu
> 
>