old-www/LDP/LG/issue58/okopnik2.html

184 lines
11 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Configuring Sendmail in RedHat 6.2 LG #58</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<CENTER>
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="okopnik.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/okopnik2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="sharma.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<P>
</CENTER>
<!--endcut ============================================================-->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Configuring Sendmail in RedHat 6.2</font><BR>
--or--<BR>My Adventure in the Heart of the Jungle</H1>
<H4>By <a href="mailto:ben-fuzzybear@yahoo.com">Ben Okopnik</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p><b>*** NOTE:</b> This may not necessarily be the best way to configure
Sendmail; I'm certain that it isn't the only way. It worked for me; if
you are in the same situation - home machine, intermittent Net connection,
possibly multiple users on one machine - it will probably work for you...
but there are no guarantees: if it breaks, you get to keep both pieces.
<b>***</b>
<br>&nbsp;
<p>This weekend, I installed RedHat 6.2 on my brother's PC - just to give
an idea of how far we've come, I didn't even have to convince him (well,
a few hints about "Oh, your machine crashed <u>again</u>? Gee, <b>mine</b>
doesn't..." over the years may have helped.) I'm a Debian guy, myself,
but he had a RedHat CD, and I wanted the experience of completely configuring
an RH system (Famous Last Words: "<font color="#CC0000">After all, how
different could it be?</font>")
<p>As a matter of fact, the RH install died a few times, until I figured
out that one of the non-critical files on the CD was damaged (my brother
was very impressed by the fact that I could customize the installation
to the extent of eliminating a single file). So, no desktop pictures for
the moment - I got them later from <a href="ftp://ftp.redhat.com">ftp.redhat.com</a>
- but everything else went well. In a couple of hours, I had his machine
up and working away.
<p>The first problem came from the fact that his ISP, AT&amp;T, uses CHAP
authentication; not the easiest thing in the world to handle (<font color="#000099">for
those of you who are curious: on the "Advanced" tab of the account properties,
select "Let PPP do all authentication" ; close the Configuration Tool;
in "/etc/ppp/chap-secrets", put the password in double quotes. That cost
me a couple of hours.</font>) Once that was done, everything went smoothly...
until I wanted to send mail without using Netscape (I far prefer Mutt).
Then, the circus pulled into town, clowns and jugglers and magicians and
all...
<blockquote><font face="Courier New,Courier"><font color="#CC0000">"He
who has never configured `sendmail.cf' has no courage. He who has configured</font></font>
<br><font face="Courier New,Courier"><font color="#CC0000">it more than
once has no brain."</font></font>
<br><font face="Courier New,Courier"><font color="#CC0000">&nbsp;-- Unknown</font></font></blockquote>
I've always considered hacking sendmail config files to be the province
of &Uuml;berHackers, the people who read raw binary code and laugh about it.
A "smail" installation - a one-line change in a simple file - MTA setup
the easy way! Well... I figured I'd at least give it a shot; I already
have lots of scars, what else could I lose? (I hear a chorus of voices:
"Your <u>sanity</u>!" Never had any; can't be a problem.)
<p>I'll lightly skip over the gnashing of teeth and the anguished screaming
at the total lack of <b>useful</b> info on the Net (every Sendmail expert,
everywhere and everywhen, thinks that you're configuring a 50,000-user
MTA. There are no exceptions.), and go on to the actual things that worked.
Here they are, step by step - note that you'll need to be `root' for all
of this:
<p>1. Install the "sendmail-cf" package. It's on the RedHat CD, but does
not get installed by default; you'll need it to make any configuration
changes.
<p>2. In `/etc/mail', create two files - "genericsdomain" and "genericstable"
(we'll be using them in just a minute); in `/etc/mail/Makefile', add "genericsdomain.db"
and "genericstable.db" to the "all:" line.
<p>3. Write your FQDN (Fully Qualified Domain Name - run "hostname -f"
to see what it is) in "genericsdomain". Adding "localhost" doesn't hurt
anything either, and seems like a good idea - this is the file used by
Sendmail to determine if the mail it sees is
<br>coming from the local domain.
<p>4. Write (this is the good part) your mail aliases in "genericstable",
in a
<br>"<font face="Courier New,Courier">local_login_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
remote_account_name@mail_domain</font>" format, like so:
<p><font face="Courier New,Courier">joe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; big_time@yahoo.com</font>
<br><font face="Courier New,Courier">zelda&nbsp;&nbsp;&nbsp; gorgeous@cheerful.com</font>
<br><font face="Courier New,Courier">walter&nbsp;&nbsp; walter@worldnet.att.net</font>
<p>5. Run "make" in `/etc/mail'; this will create the ".db" versions of
what you've just created. Re-run it whenever you change those files.
<br>&nbsp;
<p>OK, we're done with the simple part. Now, before you do the stuff that
follows, dance naked widdershins around your computer three times while
chanting, "<font color="#CC0000">I shall not fear; fear is the mindkiller...</font>"
Oops - sorry, that part is optional for anyone but me...
<br>&nbsp;
<p>6. Edit `/etc/sendmail.mc'. Add the following lines (I prefer to put
them at the end of the other "FEATURE" statements, just for neatness' sake):
<p><font face="Courier New,Courier">FEATURE(masquerade_envelope)</font>
<br><font face="Courier New,Courier">FEATURE(genericstable, `hash -o /etc/mail/genericstable')</font>
<br><font face="Courier New,Courier">GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')</font>
<p>This tells Sendmail to use those files you've just created, and to modify
the&nbsp; "envelope" (The "<font face="Courier New,Courier">From </font>"
header, etc.) as well as the visible headers ("<font face="Courier New,Courier">From:</font>",
etc.)
<p>7. Run "<font face="Courier New,Courier">m4 /etc/sendmail.mc > /etc/sendmail.cf</font>".
This processes your newly modified "sendmail.mc" into a form that Sendmail
actually reads - the "sendmail.cf" file.
<p>Now, we're almost ready, except for one last thing -
<p>8. Type "<font face="Courier New,Courier">killall -HUP sendmail</font>"
or "<font face="Courier New,Courier">kill -HUP &lt;PID></font>", using
the Sendmail PID from "<font face="Courier New,Courier">ps -ax</font>".&nbsp;
This will restart Sendmail which forces it to re-read the new config file.
<br>&nbsp;
<p>Whew. Well, I'm still alive, and &lt;patting pockets absentmindedly>
still have my mind. Somewhere.
<p>The system seems to work - I've sent mail to a number of people I know,
and their servers didn't choke; sending mail to myself and examining the
headers in "/var/spool/mail/ben" with a text editor confirmed that there
was nothing horrendously unusual about them. I've rebooted the system,
and everything still seems OK - now, a day later, I've stopped expecting
things to go "BOOM". Still,&nbsp; you never know...
<br>&nbsp;
<p>It's true that Netscape will handle both SMTP and POP services, one
user at a time; for most people, this is good enough. On the other hand,
if you're one of those folks (like me) who hates the idea of waiting several
minutes for a mail client complete with Web browser, news client, GUI,
point-and-click, and lots of confusing options - when all you need is to
send some mail - Sendmail may well provide a good answer.
<br>&nbsp;
<p>Happy Linuxing to all!
<p>
<hr WIDTH="100%">
<br>References:
<p>The incredibly confusing and unbelievably complex Sendmail man page
<br>Ditto the <font face="Courier New,Courier">/usr/doc/sendmail</font>
directory
<br>Double ditto most Net resources
<p>A&nbsp;slightly smaller ditto for RedHat's "<a href="http://www.redhat.com/support/docs/howto/RH-sendmail-HOWTO/x95.html">Where's
Everything?</a>" page,
<p>...and <b>one</b> semi-decent resource from RedHat-Europe, the <a href="http://www.europe.redhat.com/documentation/mini-HOWTO/Sendmail-Address-Rewrite-3.php3#ss3.1">Sendmail-Address-Rewrite
mini-HOWTO</a>.
<br>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright &copy; 2000, Ben Okopnik<BR>
Published in Issue 58 of <i>Linux Gazette</i>, October 2000</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<HR><P>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="okopnik.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/okopnik2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="sharma.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->