Various improvements to the mail chapter:
- Use <hostid> for domain names. - Wrap sendmail in <application> where appropriate. - Expand on /usr/local/etc/rc.d script start/stop functionality. - Explain how mailer.conf works in a bit more detail. - Add to the description of MX records and backup MX servers. - Reword and improve various parts, fixing grammar and typos. PR: docs/38318 Submitted by: Chris Pepper <pepper@reppep.com>
This commit is contained in:
parent
002e04c79e
commit
2e86ad20cd
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=13186
1 changed files with 79 additions and 67 deletions
|
@ -397,7 +397,7 @@ procmail: "|/usr/local/bin/procmail"</programlisting>
|
|||
the local host name. Place any domains or hosts that
|
||||
<application>sendmail</application> is to be receiving mail for.
|
||||
For example, if this mail server was to accept mail for the
|
||||
domain example.com and the host
|
||||
domain <hostid role="domainname">example.com</hostid> and the host
|
||||
<hostid>mail.example.com</hostid>, its
|
||||
<filename>local-host-names</filename> might look something like
|
||||
this:</para>
|
||||
|
@ -406,7 +406,7 @@ procmail: "|/usr/local/bin/procmail"</programlisting>
|
|||
mail.example.com</programlisting>
|
||||
|
||||
<para>When this file is updated, &man.sendmail.8; needs to be
|
||||
restarted for it to read the changes.</para>
|
||||
restarted to read the changes.</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -416,15 +416,15 @@ mail.example.com</programlisting>
|
|||
<para><application>sendmail</application>'s master configuration
|
||||
file, <filename>sendmail.cf</filename> controls the overall
|
||||
behavior of <application>sendmail</application>, including everything
|
||||
from rewriting e-mail addresses to printing reject messages for
|
||||
from rewriting e-mail addresses to printing rejection messages to
|
||||
remote mail servers. Naturally, with such a diverse role, this
|
||||
configuration file is quite complex and its details are a bit
|
||||
out of the scope of this section. Fortunately, this file rarely
|
||||
needs to be changed for standard mail servers.</para>
|
||||
|
||||
<para>The master <application>sendmail</application> configuration
|
||||
file can be built from &man.m4.1; macros that define features
|
||||
and behavior of sendmail. Please see
|
||||
file can be built from &man.m4.1; macros that define the features
|
||||
and behavior of <application>sendmail</application>. Please see
|
||||
<filename>/usr/src/contrib/sendmail/cf/README</filename> for
|
||||
some of the details.</para>
|
||||
|
||||
|
@ -436,11 +436,11 @@ mail.example.com</programlisting>
|
|||
<sect2>
|
||||
<title><filename>/etc/mail/virtusertable</filename></title>
|
||||
|
||||
<para>The <filename>virtualusertable</filename> maps mail for
|
||||
<para>The <filename>virtusertable</filename> maps mail addresses for
|
||||
virtual domains and
|
||||
mailboxes to real mailboxes. These mailboxes can be local,
|
||||
remote, an alias defined in
|
||||
<filename>/etc/mail/aliases</filename> or a file.</para>
|
||||
remote, aliases defined in
|
||||
<filename>/etc/mail/aliases</filename> or files.</para>
|
||||
|
||||
<example>
|
||||
<title>Example Virtual Domain Mail Map</title>
|
||||
|
@ -570,8 +570,8 @@ postmaster@example.com postmaster@noc.example.net
|
|||
<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>
|
||||
e-mail after you have disabled them, mail could go into an
|
||||
inactive <application>sendmail</application> queue, and never be delivered.</para>
|
||||
</warning>
|
||||
|
||||
<para>If you only want to disable
|
||||
|
@ -599,12 +599,20 @@ postmaster@example.com postmaster@noc.example.net
|
|||
<para>Add a script to
|
||||
<filename>/usr/local/etc/rc.d/</filename> that
|
||||
ends in <filename>.sh</filename> and is executable by
|
||||
<username>root</username>. The script should also accept the
|
||||
parameters 'start' and '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>
|
||||
<username>root</username>. The script should accept <literal>start</literal> and
|
||||
<literal>stop</literal> parameters. At startup time the
|
||||
system scripts will execute the command</para>
|
||||
|
||||
<programlisting>/usr/local/etc/rc.d/supermailer.sh start</programlisting>
|
||||
|
||||
<para>which you can also use to manually start the server. At
|
||||
shutdown time, the system scripts will use the
|
||||
<literal>stop</literal> option, running the command</para>
|
||||
|
||||
<programlisting>/usr/local/etc/rc.d/supermailer.sh start</programlisting>
|
||||
|
||||
<para>which you can also use to manually stop the server
|
||||
while the system is running.</para>
|
||||
|
||||
</sect3>
|
||||
|
||||
|
@ -613,13 +621,13 @@ postmaster@example.com postmaster@noc.example.net
|
|||
(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>
|
||||
above method or you can 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
|
||||
script that you want executed at boot to start your
|
||||
MTA.</para>
|
||||
</sect3>
|
||||
|
||||
|
@ -630,11 +638,12 @@ postmaster@example.com postmaster@noc.example.net
|
|||
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>
|
||||
as standard software on Unix systems that some software
|
||||
just assumes it is already installed and configured.
|
||||
For this reason, many alternative MTA's provide their own compatible
|
||||
implementations of the <application>sendmail</application>
|
||||
command-line interface; this facilitates using them as
|
||||
<quote>drop-in</quote> replacements for sendmail.</para>
|
||||
|
||||
<para>Therefore, if you are using an alternative mailer,
|
||||
you will need to make sure that software trying to execute
|
||||
|
@ -656,17 +665,17 @@ 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
|
||||
(such as <filename>sendmail</filename> itself) are run,
|
||||
the system actually invokes a copy of mailwrapper named <filename>sendmail</filename>, which
|
||||
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>
|
||||
are actually executed when these default <filename>sendmail</filename> functions
|
||||
are invoked.</para>
|
||||
|
||||
<para>Therefore if you wanted
|
||||
<filename>/usr/local/supermailer/bin/sendmail-compat</filename>
|
||||
to be run instead of sendmail, you would change
|
||||
to be run instead of <application>sendmail</application>, you could change
|
||||
<filename>/etc/mail/mailer.conf</filename> to read:</para>
|
||||
|
||||
<programlisting>sendmail /usr/local/supermailer/bin/sendmail-compat
|
||||
|
@ -681,12 +690,12 @@ purgestat /usr/local/supermailer/bin/purgestat-compat</programlisting>
|
|||
<sect2>
|
||||
<title>Finishing</title>
|
||||
|
||||
<para>Once you have everything configured how you want it, you should
|
||||
<para>Once you have everything configured the way 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
|
||||
software, or simply reboot. Rebooting will also
|
||||
give you the opportunity to ensure that you have correctly
|
||||
configured your machine to start your new MTA on boot.</para>
|
||||
configured your system to start your new MTA automatically on boot.</para>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
@ -801,13 +810,13 @@ to /etc/mail/sendmail.cf.</programlisting>
|
|||
|
||||
<para>Only one host should be specified as the final recipient
|
||||
(add <literal>Cw bigco.com</literal> in
|
||||
<filename>/etc/mail/sendmail.cf</filename> on bigco.com).</para>
|
||||
<filename>/etc/mail/sendmail.cf</filename> on <hostid role="domainname">bigco.com</hostid>).</para>
|
||||
|
||||
<para>When the senders' <command>sendmail</command> is trying to
|
||||
<para>When the sending <command>sendmail</command> is trying to
|
||||
deliver the mail it will try to connect to you over the modem
|
||||
link. It will most likely time out because you are not online.
|
||||
<command>sendmail</command> will automatically deliver it to the
|
||||
secondary MX site, i.e., your Internet provider. The secondary MX
|
||||
secondary MX site, i.e. your Internet provider. The secondary MX
|
||||
site will try every
|
||||
(<literal>sendmail_flags = -bd -q15m</literal> in
|
||||
<filename>/etc/rc.conf</filename>) 15 minutes to connect to
|
||||
|
@ -869,7 +878,7 @@ the DNS for <quote>customer.com</quote>.</programlisting>
|
|||
|
||||
<answer>
|
||||
<para>In default FreeBSD installations,
|
||||
<application>Sendmail</application> is configured to only
|
||||
<application>sendmail</application> is configured to only
|
||||
send mail from the host it is running on. For example, if
|
||||
a POP3 server is installed, then users will be able to
|
||||
check mail from school, work, or other remote locations
|
||||
|
@ -888,15 +897,15 @@ the DNS for <quote>customer.com</quote>.</programlisting>
|
|||
|
||||
<screen>&prompt.root; <userinput>echo "your.isp.example.com" > /etc/mail/relay-domains</userinput></screen>
|
||||
|
||||
<para>After creating this file you must restart
|
||||
<para>After creating or editing this file you must restart
|
||||
<application>sendmail</application>. This works great if
|
||||
you are a server admin and don't wish to send mail
|
||||
locally, or would like to use a point and click
|
||||
client/system on another machine or even another ISP. It
|
||||
is also very useful if you only have one or two email
|
||||
accounts setup. If there are a large number of addresses
|
||||
accounts set up. If there is a large number of addresses
|
||||
to add, you can simply open this file in your favorite
|
||||
text editor and then add the domains one per line:</para>
|
||||
text editor and then add the domains, one per line:</para>
|
||||
|
||||
<programlisting>your.isp.example.com
|
||||
other.isp.example.net
|
||||
|
@ -904,8 +913,8 @@ users-isp.example.org
|
|||
www.example.org</programlisting>
|
||||
|
||||
<para>Now any mail sent through your system, by any host in
|
||||
this list, providing the user has an account on your
|
||||
system, will succeed. This is a very nice way to allow
|
||||
this list (provided the user has an account on your
|
||||
system), will succeed. This is a very nice way to allow
|
||||
users to send mail from your system remotely without
|
||||
allowing people to send SPAM through your system.</para>
|
||||
|
||||
|
@ -931,7 +940,7 @@ www.example.org</programlisting>
|
|||
hosts as long as you have set up
|
||||
<filename>/etc/resolv.conf</filename> or are running your own
|
||||
name server. If you would like to have mail for your host
|
||||
delivered to that specific host, there are two methods:</para>
|
||||
delivered to the MTA (e.g., <application>sendmail</application>) on your own FreeBSD host, there are two methods:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
|
@ -950,16 +959,16 @@ www.example.org</programlisting>
|
|||
|
||||
<indexterm><primary>SMTP</primary></indexterm>
|
||||
<para>Regardless of which of the above you choose, in order to have
|
||||
mail delivered directly to your host, you must have a permanent
|
||||
(static) IP address (no dynamic PPP dial-up). If you are behind a
|
||||
mail delivered directly to your host, it must have a permanent
|
||||
static IP address (not a dynamic address, as with most PPP dial-up configurations). If you are behind a
|
||||
firewall, it must pass SMTP traffic on to you. If you want to
|
||||
receive mail at your host itself, you need to be sure of one of two
|
||||
receive mail directly at your host, you need to be sure of either of two
|
||||
things:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<indexterm><primary>MX record</primary></indexterm>
|
||||
<listitem>
|
||||
<para>Make sure that the MX record in your DNS points to your
|
||||
<para>Make sure that the (lowest-numbered) MX record in your DNS points to your
|
||||
host's IP address.</para>
|
||||
</listitem>
|
||||
|
||||
|
@ -981,7 +990,8 @@ example.FreeBSD.org has address 204.216.27.XX</screen>
|
|||
|
||||
<para>If that is what you see, mail directly to
|
||||
<email>yourlogin@example.FreeBSD.org</email> should work without
|
||||
problems.</para>
|
||||
problems (assuming <application>sendmail</application> is
|
||||
running correctly on <hostid role="fqdn">example.FreeBSD.org</hostid>).</para>
|
||||
|
||||
<para>If instead you see something like this:</para>
|
||||
|
||||
|
@ -1010,12 +1020,14 @@ freefall MX 10 freefall.FreeBSD.org
|
|||
freefall MX 20 who.cdrom.com</programlisting>
|
||||
|
||||
<para>As you can see, <hostid>freefall</hostid> had many MX entries.
|
||||
The lowest MX number is the host that ends up receiving the mail in
|
||||
the end while the others will queue mail temporarily if
|
||||
<hostid>freefall</hostid> is busy or down.</para>
|
||||
The lowest MX number is the host that receives mail directly if
|
||||
available; if it's not accessible for some reason, the others
|
||||
(sometimes called <quote>backup MXes</quote>) accept messages
|
||||
temporarily, and pass it along when a lower-numbered host becomes
|
||||
available, eventually to the lowest-numbered host.</para>
|
||||
|
||||
<para>Alternate MX sites should have separate Internet connections
|
||||
from your own in order to be the most useful. Your ISP or other
|
||||
from your own in order to be most useful. Your ISP or another
|
||||
friendly site should have no problem providing this service for
|
||||
you.</para>
|
||||
</sect2>
|
||||
|
@ -1023,13 +1035,13 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
<sect2 id="mail-domain">
|
||||
<title>Mail for Your Domain</title>
|
||||
|
||||
<para>In order to set up a <quote>mailhost</quote> (a.k.a., mail
|
||||
<para>In order to set up a <quote>mailhost</quote> (a.k.a. mail
|
||||
server) you need to have any mail sent to various workstations
|
||||
directed to it. Basically, you want to <quote>hijack</quote> any
|
||||
mail for your domain (in this case <hostid
|
||||
directed to it. Basically, you want to <quote>claim</quote> any
|
||||
mail for any hostname in your domain (in this case <hostid
|
||||
role="fqdn">*.FreeBSD.org</hostid>) and divert it to your mail
|
||||
server so your users can check their mail via POP or directly on
|
||||
the server.</para>
|
||||
server so your users can receive their mail on
|
||||
the master mail server.</para>
|
||||
|
||||
<indexterm><primary>DNS</primary></indexterm>
|
||||
<para>To make life easiest, a user account with the same
|
||||
|
@ -1037,7 +1049,7 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
<command>adduser</command> to do this.</para>
|
||||
|
||||
<para>The mailhost you will be using must be the designated mail
|
||||
exchange for each workstation on the network. This is done in
|
||||
exchanger for each workstation on the network. This is done in
|
||||
your DNS configuration like so:</para>
|
||||
|
||||
<programlisting>example.FreeBSD.org A 204.216.27.XX ; Workstation
|
||||
|
@ -1048,25 +1060,25 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
host.</para>
|
||||
|
||||
<para>You cannot do this yourself unless you are running a DNS
|
||||
server. If you are not, or cannot, run your own DNS server, talk
|
||||
to your ISP or whoever does your DNS for you.</para>
|
||||
server. If you are not, or cannot run your own DNS server, talk
|
||||
to your ISP or whoever provides your DNS.</para>
|
||||
|
||||
<para>If you are doing virtual email hosting, the following
|
||||
information will come in handy. For the sake of an example, we
|
||||
information will come in handy. For this example, we
|
||||
will assume you have a customer with their own domain, in this
|
||||
case <hostid role="domainname">customer1.org</hostid> and you want
|
||||
case <hostid role="domainname">customer1.org</hostid>, and you want
|
||||
all the mail for <hostid role="domainname">customer1.org</hostid>
|
||||
sent to your mailhost, which is named <hostid
|
||||
sent to your mailhost, <hostid
|
||||
role="fqdn">mail.myhost.com</hostid>. The entry in your DNS
|
||||
should look like this:</para>
|
||||
|
||||
<programlisting>customer1.org MX 10 mail.myhost.com</programlisting>
|
||||
|
||||
<para>You do <emphasis>not</emphasis> need an A record if you only
|
||||
want to handle email for the domain.</para>
|
||||
<para>You do <emphasis>not</emphasis> need an A record for <hostid role="domainname">customer1.org</hostid> if you only
|
||||
want to handle email for that domain.</para>
|
||||
|
||||
<note>
|
||||
<para>Be aware that this means pinging <hostid
|
||||
<para>Be aware that pinging <hostid
|
||||
role="domainname">customer1.org</hostid> will not work unless
|
||||
an A record exists for it.</para>
|
||||
</note>
|
||||
|
@ -1082,7 +1094,7 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
<para>Add the hosts to your
|
||||
<filename>/etc/mail/local-host-names</filename> file if you are using the
|
||||
<literal>FEATURE(use_cw_file)</literal>. If you are using
|
||||
a version of sendmail earlier than 8.10, the file is
|
||||
a version of <application>sendmail</application> earlier than 8.10, the file is
|
||||
<filename>/etc/sendmail.cw</filename>.</para>
|
||||
</listitem>
|
||||
|
||||
|
@ -1090,7 +1102,7 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
<para>Add a <literal>Cwyour.host.com</literal> line to your
|
||||
<filename>/etc/mail/sendmail.cf</filename> or
|
||||
<filename>/etc/mail/sendmail.cf</filename> if you are using
|
||||
sendmail 8.10 or higher.</para>
|
||||
<application>sendmail</application> 8.10 or higher.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
|
Loading…
Reference in a new issue