old-www/LDP/LG/issue29/tag_virtdom.html

252 lines
9.7 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.1pre6">
<TITLE>The Answer Guy 29: 'sendmail' FEATURE creatures for virtual
domain and generic re-write tables</TITLE>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ========================================================= -->
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <hr> <P>
<!-- =============================================================== -->
<H1 align="center"><A NAME="answer">
<img src="../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
<a href="./index.html">The Answer Guy</a>
<img src="../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
</A></H1> <BR>
<H4 align="center">By James T. Dennis,
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A> </H4>
<p><hr><p>
<H3><img src="../gx/dennis/qbub.gif" alt="(?)" width="50" height="28"
align="left" border="0">'<tt>sendmail</tt>' FEATURE creatures
for virtual domain and generic re-write tables</h3>
<p><strong>From Benjamin Peikes on 18 May 1998
<br><br>
Jim,
<br><br>
I have a quick <tt>sendmail</tt> question for you. I have set up virtual
hosting where I add an account for each user and then map the incoming and
outgoing address for each account. The problem is that I add an account, i.e.
<tt>bendtg</tt> and then map outgoing mail to be ben@dtgroup.com
and mail incoming mail for ben@dtgroup.com to go to the <tt>bendtg</tt>
account. The problem is that I will also get mail going to
bendtg@<em>anyotherhostI.receive.mail.for</em>. I was wondering if you
knew what I need to set so that it only accepts mail for a particular list
of addresses that I specify. Thanks alot.
<br><br>
Ben
</strong></p>
<blockquote><img src="../gx/dennis/bbub.gif" width="50" height="28" alt="(!)"
align="left" border="0">
I thought I answered this for you earlier this month.
Is this a resend --- or a refinement to an earlier
question?
<br><br>
<em>[Nope, he's only got the one, but we <strong>do</strong> have a
lot of <tt>sendmail</tt> questions this month. -- Heather]</em>
<br><br>
In any event the <tt>FEATURE</tt>'s that you might want to enable
and use in your '<tt>sendmail</tt>'
&quot;<tt>mc</tt>&quot; (M4 configuration file) are
the "<tt>virtusertable</tt>", and the "<tt>genericstable</tt>"
<br><br>
These can allow you to support the re-writing of addresses
in outgoing mail, and to support things like matching a
whole domain to a single mbox (mailbox folder) file. You can
also creating entries in the virtusertable that look just
like aliases --- except that they include host/domain portions
of addresses (parts to the right of the "<tt>@</tt>" (at) sign).
<br><br>
Unfortunately I don't have working samples of these files
but the M4/mc file would look something like:
</blockquote>
<pre>
OSTYPE(`linux')
VERSIONID(`@(#)YOURDOMAINHERE.mc .1 (BP) 8/11/95')
FEATURE(`genericstable')dnl
FEATURE(`mailertable')dnl
FEATURE(`virtusertable')dnl
FEATURE(`domaintable')dnl
</pre>
<blockquote>
And you'll have to create these tables (usually as dbm files)
You can read more about these advanced sendmail features in the
famous "<a href=http://www.ora.com/catalog/sendmail2/">Bat Book</a>"
(<em>Sendmail</em> 2nd edition by Bryan Costales, from
<a href="http://www.oreilly.com/">O'Reilly &amp; Associates</a>).
<br><br>
After you've merged some of these features into your <tt>mc</tt> file
you'll build a <tt>sendmail.cf</tt> file by running <tt>m4</tt> on
it (I'd usually do an RCS check ('<tt>ci -l</tt>') of my old
<tt>/etc/sendmail.cf</tt> file before overwriting it with the new
one -- and I keep my <tt>mc</tt> files under version control as well).
<br><br>
Once you've created the <tt>sendmail.cf</tt> file (and tested that
it hasn't broken any of the feature you were already using)
you need to create one or more tables (depending on which
combination of '<tt>genericstable</tt>', '<tt>virtusertable</tt>',
and '<tt>domaintable</tt>'
(and other features/tables you choose to use). These are
created with a text editor and must be "compiled" or "made"
into a suitable format (usually some dbm variant) using the
'<tt>makemap</tt>' command.
<br><br>
The Costales book goes into that in some detail -- but the
thing is 800 pages long and it's easy to get lost in that
tome. So you might want to just read the '<tt>makemap</tt>' man
page.
<br><br>
Basically all this '<tt>makemap</tt>' stuff is just like running
'<tt>newaliases</tt>' after you change the <tt>/etc/aliases</tt>
file. It's even possible to force <tt>sendmail</tt> to use a
straight text file for a table if you want to (but that's hackish
and definitely more trouble than its worth.
<br><br>
I have another problem with this whole approach. If you
are mapping all of the mail to a given domain or for a given
host into a single "drop file" (mbox folder) which some
user is getting (say, via POP or IMAP --- perhaps using
Eric Raymond's '<tt><a href="http://earthspace.net/~esr/fetchmail/fetchmail-FAQ.html">fetchmail</a></tt>' package) your customers still
have a problem if they then need to split the mail into
multiple addresses at their site.
<br><br>
I've been told by one of <a href="http://www.netcom.com">Netcom</a>'s
senior techs that they resolve this with a custom re-writing rule
that take the envelope addressee(s) (the address or list of addresses
as it was passed to the receiving sendmail daemon) and add those as
Bcc: header lines before putting the message in the drop file.
<br><br>
(The effect of this is that if a piece of mail was addressed
to you, and copied to some partner at your site --- the
receiving 'fetchmail' process should process those Bcc: lines
--- as appropriate to your domain).
<br><br>
I haven't confirmed this, nor have a concocted a custom
<tt>FEATURE</tt> macro (m4) or rewriting ruleset to do this ---
though I'd like to see one and play with it.
<br><br>
My personal opinion is that all this virtual mail domain to
"drop file" stuff is ugly and hackish --- so I still use
a <tt>uucp</tt> feed to get mail from my ISP to my domain and back
(and I use it to get my netnews, too).
<br><br>
As always the best sources of <tt>sendmail</tt> support on the
'net are:
<br><dl>
<dt>NetNews:
<a href="news:comp.mail.sendmail">comp.mail.sendmail</a>
<dt>The FAQ (web version):
<dd><a href="http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/sendmail-faq/part1/faq.html">comp.mail.sendmail Frequently Asked Questions
(Part 1 of 2)</a>
<br>http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/sendmail-faq/part1/faq.html -- You want Q3.7: How do I manage several (virtual) domains?
<dt>Other Web Resources:
<dd><a href="http://www.sendmail.org/"
>http://www.sendmail.org/</a>
<dd><a href="http://www.sendmail.com/"
>http://www.sendmail.com/</a>
<dt>Harker Systems:
<dd><a href="http://www.harker.com/"
>http://www.harker.com/</a>
<br>
(Offers wonderful and very detailed seminars on 'sendmail' and
DNS. I've taken it --- and only wish that I'd had the time
to apply even a fraction of that in my consulting over the last
several months. I've Bcc'd him on this message as a courtesy).
</dl>
</blockquote>
<!--================================================================-->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 1998, James T. Dennis <BR>
Published in <I>Linux Gazette</I> Issue 29 June 1998</H5>
<P> <hr>
<!--================================================================-->
<p align="center"><table width="95%"><tr align="center">
<td rowspan="4"><A HREF="lg_answer29.html"><IMG
SRC="../gx/dennis/answernew.gif"
ALT="[&nbsp;Answer&nbsp;Guy&nbsp;Index&nbsp;]"i
align="left"></A></td>
</tr><tr align="center">
<!-- begins -->
<td><A HREF="tag_versions.html">versions</A></td>
<td><A HREF="tag_lilo.html">lilo</A></td>
<td><A HREF="tag_virtdom.html">virtdom</a></td>
<td><A HREF="tag_kernel.html">kernel</A></td>
<td><A HREF="tag_winmodem.html">winmodem</a></td>
<td><A HREF="tag_basicmail.html">basicmail</a></td>
<td><A HREF="tag_betterbak.html">betterbak</a></td>
</tr><tr align="center">
<td><A HREF="tag_shadow.html">shadow</a></td>
<td><A HREF="tag_dell.html">dell</a></td>
<td><A HREF="tag_dumbterm.html">dumbterm</a></td>
<td><A HREF="tag_whylinux.html">whylinux</a></td>
<td><A HREF="tag_redhat.html">redhat</a></td>
<td><A HREF="tag_netcard.html">netcard</a></td>
<td><A HREF="tag_macrovir.html">macrovir</a></td>
</tr><tr align="center">
<td><A HREF="tag_newlook.html">newlook</a></td>
<td><A HREF="tag_tacacs.html">tacacs</a></td>
<td><A HREF="tag_sendmail.html">sendmail</a></td>
<td><A HREF="tag_dialdppp.html">dialdppp</a></td>
<td><A HREF="tag_ppp233.html">ppp233</a></td>
<td><A HREF="tag_msmail.html">msmail</a></td>
<td><A HREF="tag_procmail.html">procmail</a></td>
<!-- ends -->
</tr></table>
</P> <hr> <P>
<!--================================================================-->
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif"
ALT="[&nbsp;Table&nbsp;Of&nbsp;Contents&nbsp;]"></A>
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[&nbsp;Front&nbsp;Page&nbsp;]"></A>
<A HREF="lg_bytes29.html"><IMG SRC="../gx/back2.gif"
ALT="[&nbsp;Previous&nbsp;Section&nbsp;]"></A>
<A HREF="./hamilton.html"><IMG SRC="../gx/fwd.gif"
ALT="[&nbsp;Next&nbsp;Section&nbsp;]"></A>
<!--startcut ======================================================= -->
</body>
</html>
<!--endcut ========================================================= -->