1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
|
<!--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="./lg_toc29.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:answerguy@ssc.com">answerguy@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>'
"<tt>mc</tt>" (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 & 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/ssc.copying.html"
>Copyright ©</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="[ Answer Guy Index ]"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="./lg_toc29.html"><IMG SRC="../gx/indexnew.gif"
ALT="[ Table Of Contents ]"></A>
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[ Front Page ]"></A>
<A HREF="lg_bytes29.html"><IMG SRC="../gx/back2.gif"
ALT="[ Previous Section ]"></A>
<A HREF="./hamilton.html"><IMG SRC="../gx/fwd.gif"
ALT="[ Next Section ]"></A>
<!--startcut ======================================================= -->
</body>
</html>
<!--endcut ========================================================= -->
|