Add information on changing the default MTA.

PR:		37121
Submitted by:	Andrew Boothman <andrew@cream.org>
This commit is contained in:
Tom Rhodes 2002-04-25 22:34:48 +00:00
parent b442f1bf18
commit c75629a55f
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=12878

View file

@ -49,6 +49,9 @@
<listitem><para>How to block spammers from illegally using your
mail server as a relay.</para>
</listitem>
<listitem><para>How to replace <application>sendmail</application>
as your system's default mailer.</para>
</listitem>
<listitem><para>How to troubleshoot common mail server
problems.</para></listitem>
</itemizedlist>
@ -406,22 +409,7 @@ mail.example.com</programlisting>
restarted for it to read the changes.</para>
</sect2>
<sect2>
<title><filename>/etc/mail/mailer.conf</filename></title>
<para>The <filename>mailer.conf</filename> configuration file
holds a table containing the real mailer that is used for the
given action. Very old software programs would hard-code in the
name and path to the mailer,
<filename>/usr/sbin/sendmail</filename>, which meant they where
incompatible with other mailers such as postfix. Today,
<filename>/usr/sbin/sendmail</filename> is a wrapper that looks
at <filename>/etc/mail/mailer.conf</filename> and executes the
correct binary. When another mail transfer agent is installed
on the system, <filename>mailer.conf</filename> should be
updated to reflect the correct programs to execute.</para>
</sect2>
<sect2>
<title><filename>/etc/mail/sendmail.cf</filename></title>
@ -475,6 +463,234 @@ postmaster@example.com postmaster@noc.example.net
</sect2>
</sect1>
<sect1 id="mail-changingmta">
<sect1info>
<authorgroup>
<author>
<firstname>Andrew</firstname>
<surname>Boothman</surname>
<contrib>Written by </contrib>
</author>
</authorgroup>
<authorgroup>
<author>
<firstname>Gregory</firstname>
<surname>Neil Shapiro</surname>
<contrib>Information taken from e-mails written by </contrib>
</author>
</authorgroup>
</sect1info>
<title>Changing your Mail Transfer Agent</title>
<indexterm>
<primary>email</primary>
<secondary>change mta</secondary>
</indexterm>
<para>As already mentioned, FreeBSD comes with
<application>sendmail</application> already installed as your
MTA (Mail Transfer Agent). Therefore by default it is
in charge of your outgoing and incoming mail.</para>
<para>However, for a variety of reasons, some system
administrators want to change their system's MTA. These
reasons range from simply wanting to try out another MTA to
needing a specific feature or package which relies on another
mailer. Fortunately, whatever the reason, FreeBSD makes it
easy to make the change.</para>
<sect2>
<title>Install a new MTA</title>
<para>You have a wide choice of MTAs available. A good
starting point is the
<link linkend="ports">FreeBSD Ports Collection</link> where
you will be able to find many. Of course you are free to use
any MTA you want from any location, as long as you can make
it run under FreeBSD.</para>
<para>Start by installing your new MTA. Once it is installed
it gives you a chance to decide if it really fulfills your
needs, and also gives you the opportunity to configure your
new software before getting it to take over from
<application>sendmail</application>. When doing this, you
should be sure that installing the new software won't attempt
to overwrite system binaries such as
<filename>/usr/bin/sendmail</filename>. Otherwise, your new
mail software has essentially been put into service before
you have configured it.</para>
<para>Please refer to your chosen MTA's documentation for
information on how to configure the software you have
chosen.</para>
</sect2>
<sect2>
<title>Disable <application>sendmail</application></title>
<para>The procedure used to start
<application>sendmail</application> changed significantly
between 4.5-RELEASE and 4.6-RELEASE. Therefore, the procedure
used to disable it is subtly different.</para>
<sect3>
<title>FreeBSD 4.5-STABLE before 2002/4/4 and earlier
(including 4.5-RELEASE and earlier)</title>
<para>Enter:</para>
<programlisting>sendmail_enable="NO"</programlisting>
<para>into <filename>/etc/rc.conf</filename>. This will disable
<application>sendmail</application>'s incoming mail service,
but if <filename>/etc/mail/mailer.conf</filename> (see below)
is not changed, <application>sendmail</application> will
still be used to send e-mail.</para>
</sect3>
<sect3>
<title>FreeBSD 4.5-STABLE after 2002/4/4
(including 4.6-RELEASE and later)</title>
<para>In order to completely disable
<application>sendmail</application> you must use</para>
<programlisting>sendmail_enable="NONE"</programlisting>
<para>in <filename>/etc/rc.conf.</filename></para>
<warning>
<para>If you disable <application>sendmail</application>'s
outgoing mail service in this way, it is important that you
replace it with a fully working alternative mail delivery
system. If you choose not to, system functions such as
&man.periodic.8; will be unable to deliver their results by
e-mail as they would normally expect to. Many parts of your
system may expect to have a functional
<application>sendmail</application>-compatible system. If
applications continue to use
<application>sendmail</application>'s binaries to try and send
e-mail after you have disabled it, the mail may transparently
queue forever.</para>
</warning>
<para>If you only want to disable
<application>sendmail</application>'s incoming mail service,
you should set</para>
<programlisting>sendmail_enable="NO"</programlisting>
<para>in <filename>/etc/rc.conf</filename>. More information on
<application>sendmail</application>'s startup options is
available from the &man.rc.sendmail.8; manual page.</para>
</sect3>
<sect2>
<title>Running your new MTA on boot</title>
<para>You may have a choice of two methods for running your
new MTA on boot, again depending on what version of FreeBSD
you are running.</para>
<sect3>
<title>FreeBSD 4.5-STABLE before 2002/4/11
(including 4.5-RELEASE and earlier)</title>
<para>Add a script to
<filename>/usr/local/etc/rc.d/</filename> that
ends in <filename>.sh</filename> and is executable by
root. The script should also accept the parameters 'start'
or 'stop'. So that you could, for example, execute
<filename>/usr/local/etc/rc.d/supermailer.sh start</filename>
or <filename>/usr/local/etc/rc.d/supermailer.sh stop</filename>.
The system will call your script using 'start' when the it
boots and using 'stop' when the it shuts down.</para>
</sect3>
<sect3>
<title>FreeBSD 4.5-STABLE after 2002/4/11
(including 4.6-RELEASE and later)</title>
<para>With later versions of FreeBSD, you can use the
above method or you can also set</para>
<programlisting>mta_start_script="filename"</programlisting>
<para>in <filename>/etc/rc.conf</filename>, where
<replaceable>filename</replaceable> is the name of some
script that you want executed on boot to start your
MTA.</para>
</sect3>
</sect2>
<sect2>
<title>Replacing <application>sendmail</application> as
the system's default mailer</title>
<para><application>Sendmail</application> is so ubiquitous
as standard software on Unix systems, that some software
just presumes that it is already installed and configured.
For this reason, many alternative MTA's provide utilities
that implement exactly the same command-line interface
that <application>sendmail</application> provides.</para>
<para>Therefore, if you are using an alternative mailer,
you will need to make sure that software trying to execute
standard <application>sendmail</application> binaries such as
<filename>/usr/bin/sendmail</filename> actually executes
your chosen mailer instead. Fortunately, FreeBSD provides
a system called &man.mailwrapper.8; that does this job for
you.</para>
<para>When <application>sendmail</application> is operating as installed, you will
find something like the following
in <filename>/etc/mail/mailer.conf</filename>:</para>
<programlisting>sendmail /usr/libexec/sendmail/sendmail
send-mail /usr/libexec/sendmail/sendmail
mailq /usr/libexec/sendmail/sendmail
newaliases /usr/libexec/sendmail/sendmail
hoststat /usr/libexec/sendmail/sendmail
purgestat /usr/libexec/sendmail/sendmail</programlisting>
<para>This means that when any of these common commands
are run, such as <filename>/usr/bin/sendmail</filename>
the program that is actually sitting in that location
checks <filename>mailer.conf</filename> and
executes <filename>/usr/libexec/sendmail/sendmail</filename>
instead. This system makes it easy to change what binaries
are actually executed when these default system utilities
are run.</para>
<para>Therefore if you wanted
<filename>/usr/local/supermailer/bin/sendmail-compat</filename>
to be run instead of sendmail, you would change
<filename>/etc/mail/mailer.conf</filename> to read:</para>
<programlisting>sendmail /usr/local/supermailer/bin/sendmail-compat
send-mail /usr/local/supermailer/bin/sendmail-compat
mailq /usr/local/supermailer/bin/mailq-compat
newaliases /usr/local/supermailer/bin/newaliases-compat
hoststat /usr/local/supermailer/bin/hoststat-compat
purgestat /usr/local/supermailer/bin/purgestat-compat</programlisting>
</sect2>
<sect2>
<title>Finishing</title>
<para>Once you have everything configured how you want it, you should
either kill the <application>sendmail</application> processes that
you no longer need and start the processes belonging to your new
software. Or you should reboot your machine. Rebooting will also
give you the opportunity to ensure that you have correctly
configured your machine to start your new MTA on boot.</para>
</sect2>
</sect1>
<sect1 id="mail-trouble">
<title>Troubleshooting</title>
<indexterm>