Start to modernize the Sendmail configuration file section.

More commits to come

Sponsored by:	iXsystems
This commit is contained in:
Dru Lavigne 2014-05-09 18:42:36 +00:00
parent 295258a90e
commit 367221a1bf
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44802

View file

@ -282,7 +282,8 @@ FreeBSD.org mail is handled by 10 mx1.FreeBSD.org</screen>
<sect1 xml:id="sendmail">
<info>
<title><application>Sendmail</application> Configuration</title>
<title><application>Sendmail</application> Configuration
Files</title>
<authorgroup>
<author><personname><firstname>Christopher</firstname><surname>Shumway</surname></personname><contrib>Contributed
@ -294,17 +295,18 @@ FreeBSD.org mail is handled by 10 mx1.FreeBSD.org</screen>
<primary><application>Sendmail</application></primary>
</indexterm>
<para>&man.sendmail.8; is the default <acronym>MTA</acronym>
which is installed with &os;.
<application>Sendmail</application> accepts mail from
<para><application>Sendmail</application> is the default
<acronym>MTA</acronym> installed with &os;.
It accepts mail from
<acronym>MUA</acronym>s and delivers it to the appropriate
mailer as defined by its configuration file.
mail host, as defined by its configuration.
<application>Sendmail</application> can also accept network
connections and deliver mail to local mailboxes or to another
program.</para>
<para><application>Sendmail</application> uses the following
configuration files. This section describes these files in more
<para>The configuration files for
<application>Sendmail</application> are located in
<filename>/etc/mail</filename>. This section describes these files in more
detail.</para>
<indexterm>
@ -328,117 +330,69 @@ FreeBSD.org mail is handled by 10 mx1.FreeBSD.org</screen>
<indexterm>
<primary><filename>/etc/mail/virtusertable</filename></primary>
</indexterm>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
<entry>Filename</entry>
<entry>Function</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<filename>/etc/mail/access</filename></entry>
<entry><application>Sendmail</application> access database
file.</entry>
</row>
<row>
<entry>
<filename>/etc/mail/aliases</filename></entry>
<entry>Mailbox aliases</entry>
</row>
<row>
<entry>
<filename>/etc/mail/local-host-names</filename></entry>
<entry>Lists of hosts <application>Sendmail</application>
accepts mail for.</entry>
</row>
<row>
<entry>
<filename>/etc/mail/mailer.conf</filename></entry>
<entry>Mailer program configuration.</entry>
</row>
<row>
<entry>
<filename>/etc/mail/mailertable</filename></entry>
<entry>Mailer delivery table.</entry>
</row>
<row>
<entry>
<filename>/etc/mail/sendmail.cf</filename></entry>
<entry><application>Sendmail</application> master
configuration file.</entry>
</row>
<row>
<entry>
<filename>/etc/mail/virtusertable</filename></entry>
<entry>Virtual users and domain tables.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<sect2>
<title><filename>/etc/mail/access</filename></title>
<para>This database defines which host(s) or IP addresses
<variablelist>
<varlistentry>
<term><filename>/etc/mail/access</filename></term>
<listitem>
<para>This access database file defines which hosts or <acronym>IP</acronym> addresses
have access to the local mail server and what kind of access
they have. Hosts can be listed as <option>OK</option>,
<option>REJECT</option>, or <option>RELAY</option>, or can be
passed to <application>Sendmail</application>'s error
handling routine with a given mailer error. Hosts that
are listed as <option>OK</option>, which is the default
option, are allowed to send mail to this host as long as the
mail's final destination is the local machine. Hosts that are
they have. Hosts listed as <option>OK</option>, which is the
default option, are allowed to send mail to this host as long
as the mail's final destination is the local machine. Hosts
listed as <option>REJECT</option> are rejected for all mail
connections. Hosts that are listed as <option>RELAY</option>
are allowed to send mail for any
destination using this mail server.</para>
connections. Hosts listed as <option>RELAY</option> are
allowed to send mail for any destination using this mail
server. Hosts listed as <option>ERROR</option> will have their mail returned with
the specified mail error. If a host is listed
as <option>SKIP</option>, <application>Sendmail</application>
will abort the current search for this entry without accepting
or rejecting the mail. Hosts listed
as <option>QUARANTINE</option> will have their messages held and will receive the
specified text as the reason for the hold.</para>
<example>
<title>Configuring the <application>Sendmail</application>
Access Database</title>
<para>Examples of using these options for both
<acronym>IPv4</acronym> and <acronym>IPv6</acronym>
addresses can be found in the &os; sample configuration,
<filename>/etc/mail/access.sample</filename>:</para>
<programlisting>cyberspammer.com 550 We do not accept mail from spammers
FREE.STEALTH.MAILER@ 550 We do not accept mail from spammers
another.source.of.spam REJECT
okay.cyberspammer.com OK
128.32 RELAY</programlisting>
</example>
<programlisting># $FreeBSD$
#
# Mail relay access control list. Default is to reject mail unless the
# destination is local, or listed in /etc/mail/local-host-names
#
## Examples (commented out for safety)
#From:cyberspammer.com ERROR:"550 We don't accept mail from spammers"
#From:okay.cyberspammer.com OK
#Connect:sendmail.org RELAY
#To:sendmail.org RELAY
#Connect:128.32 RELAY
#Connect:128.32.2 SKIP
#Connect:IPv6:1:2:3:4:5:6:7 RELAY
#Connect:suspicious.example.com QUARANTINE:Mail from suspicious host
#Connect:[127.0.0.3] OK
#Connect:[IPv6:1:2:3:4:5:6:7:8] OK</programlisting>
<para>This example shows five entries. Mail senders that match
<para>To configure the access database, use the format shown in
the sample to make entries in
<filename>/etc/mail/access</filename>, but do not put a
comment symbol (<literal>#</literal>) in front of the entries. Create
an entry for each host or network whose access should be
configured. Mail senders that match
the left side of the table are affected by the action on the
right side of the table. The first two examples give an error
code to <application>Sendmail</application>'s error handling
routine. The message is sent to the remote host when a mail
matches the left side of the table. The third entry rejects
mail from a specific host on the Internet,
<systemitem>another.source.of.spam</systemitem>. The fourth
entry accepts mail connections from <systemitem
class="fqdomainname">okay.cyberspammer.com</systemitem>,
which is more specific than the <systemitem
class="fqdomainname">cyberspammer.com</systemitem> line
above. More specific matches override less exact matches.
The last entry allows relaying of email from hosts with an IP
address that begins with <systemitem>128.32</systemitem>.
These hosts can send mail through this mail server that is
destined for other mail servers.</para>
right side of the table.</para>
<para>Whenever this file is updated, run <command>make</command>
in <filename>/etc/mail/</filename> to update the
database.</para>
<para>Whenever this file is updated, update its database and
restart <application>Sendmail</application>:</para>
</sect2>
<sect2>
<title><filename>/etc/mail/aliases</filename></title>
<screen>&prompt.root; <userinput>makemap hash /etc/mail/access &lt; /etc/mail/access</userinput>
&prompt.root; <userinput>service sendmail restart</userinput></screen>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/mail/aliases</filename></term>
<listitem>
<para>This database contains a list of virtual mailboxes that
are expanded to other user(s), files, programs, or other
aliases. Here are a few examples to illustrate the
@ -477,11 +431,13 @@ procmail: "|/usr/local/bin/procmail"</programlisting>
<para>Whenever this file is updated, run <command>make</command>
in <filename>/etc/mail/</filename> to update the
database.</para>
</sect2>
<sect2>
<title><filename>/etc/mail/local-host-names</filename></title>
</listitem>
</varlistentry>
<para>This is a list of hostnames &man.sendmail.8; is to accept
<varlistentry>
<term><filename>/etc/mail/local-host-names</filename></term>
<listitem>
<para>This is a list of hostnames <application>Sendmail</application> will accept
as the local host name. Place any domains or hosts that
<application>Sendmail</application> will receive mail for.
For example, to configure a mail server to accept mail for the
@ -497,11 +453,12 @@ mail.example.com</programlisting>
<para>Whenever this file is updated, &man.sendmail.8; needs to be
restarted so that it will read the changes.</para>
</sect2>
<sect2>
<title><filename>/etc/mail/sendmail.cf</filename></title>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/mail/sendmail.cf</filename></term>
<listitem>
<para>This is the master configuration file for
<application>Sendmail</application>. It controls the overall
behavior of <application>Sendmail</application>, including
@ -520,13 +477,14 @@ mail.example.com</programlisting>
<para>Whenever changes to this file are made,
<application>Sendmail</application> needs to be restarted for
the changes to take effect.</para>
</listitem>
</varlistentry>
</sect2>
<sect2>
<title><filename>/etc/mail/virtusertable</filename></title>
<varlistentry>
<term><filename>/etc/mail/virtusertable</filename></term>
<listitem>
<para>The <filename>virtusertable</filename> maps mail addresses
for virtual domains and mailboxes to real mailboxes. These
for virtual domains and users to real mailboxes. These
mailboxes can be local, remote, aliases defined in
<filename>/etc/mail/aliases</filename>, or files.</para>
@ -553,8 +511,9 @@ postmaster@example.com postmaster@noc.example.net
mail message addressed to someone at <systemitem
class="fqdomainname">example.com</systemitem> to the local
mailbox <systemitem class="username">joe</systemitem>.</para>
</sect2>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 xml:id="mail-changingmta">