|
Lines 49-54
Link Here
|
| 49 |
<listitem><para>How to block spammers from illegally using your |
49 |
<listitem><para>How to block spammers from illegally using your |
| 50 |
mail server as a relay.</para> |
50 |
mail server as a relay.</para> |
| 51 |
</listitem> |
51 |
</listitem> |
|
|
52 |
<listitem><para>How to replace <application>sendmail</application> |
| 53 |
as your system's default mailer.</para> |
| 54 |
</listitem> |
| 52 |
<listitem><para>How to troubleshoot common mail server |
55 |
<listitem><para>How to troubleshoot common mail server |
| 53 |
problems.</para></listitem> |
56 |
problems.</para></listitem> |
| 54 |
</itemizedlist> |
57 |
</itemizedlist> |
|
Lines 406-427
Link Here
|
| 406 |
restarted for it to read the changes.</para> |
409 |
restarted for it to read the changes.</para> |
| 407 |
|
410 |
|
| 408 |
</sect2> |
411 |
</sect2> |
| 409 |
<sect2> |
|
|
| 410 |
<title><filename>/etc/mail/mailer.conf</filename></title> |
| 411 |
|
412 |
|
| 412 |
<para>The <filename>mailer.conf</filename> configuration file |
|
|
| 413 |
holds a table containing the real mailer that is used for the |
| 414 |
given action. Very old software programs would hard-code in the |
| 415 |
name and path to the mailer, |
| 416 |
<filename>/usr/sbin/sendmail</filename>, which meant they where |
| 417 |
incompatible with other mailers such as postfix. Today, |
| 418 |
<filename>/usr/sbin/sendmail</filename> is a wrapper that looks |
| 419 |
at <filename>/etc/mail/mailer.conf</filename> and executes the |
| 420 |
correct binary. When another mail transfer agent is installed |
| 421 |
on the system, <filename>mailer.conf</filename> should be |
| 422 |
updated to reflect the correct programs to execute.</para> |
| 423 |
|
| 424 |
</sect2> |
| 425 |
<sect2> |
413 |
<sect2> |
| 426 |
<title><filename>/etc/mail/sendmail.cf</filename></title> |
414 |
<title><filename>/etc/mail/sendmail.cf</filename></title> |
| 427 |
|
415 |
|
|
Lines 475-480
Link Here
|
| 475 |
|
463 |
|
| 476 |
</sect2> |
464 |
</sect2> |
| 477 |
</sect1> |
465 |
</sect1> |
|
|
466 |
|
| 467 |
<sect1 id="mail-changingmta"> |
| 468 |
<sect1info> |
| 469 |
<authorgroup> |
| 470 |
<author> |
| 471 |
<firstname>Andrew</firstname> |
| 472 |
<surname>Boothman</surname> |
| 473 |
<contrib>Written by </contrib> |
| 474 |
</author> |
| 475 |
</authorgroup> |
| 476 |
<authorgroup> |
| 477 |
<author> |
| 478 |
<firstname>Gregory</firstname> |
| 479 |
<surname>Neil Shapiro</surname> |
| 480 |
<contrib>Information taken from e-mails written by </contrib> |
| 481 |
</author> |
| 482 |
</authorgroup> |
| 483 |
</sect1info> |
| 484 |
<title>Changing your MTA</title> |
| 485 |
<indexterm> |
| 486 |
<primary>email</primary> |
| 487 |
<secondary>change mta</secondary> |
| 488 |
</indexterm> |
| 489 |
|
| 490 |
<para>As already mentioned, FreeBSD comes with |
| 491 |
<application>sendmail</application> already installed as your |
| 492 |
MTA (Mail Transfer Agent). Therefore by default it is |
| 493 |
in charge of your outgoing and incoming mail.</para> |
| 494 |
|
| 495 |
<para>However, for a variety of reasons, some system |
| 496 |
administrators want to change their system's MTA. These |
| 497 |
reasons range from simply wanting to try out another MTA to |
| 498 |
needing a specific feature or package which relies on another |
| 499 |
mailer. Fortunately, whatever the reason, FreeBSD makes it |
| 500 |
easy to make the change.</para> |
| 501 |
|
| 502 |
<sect2> |
| 503 |
<title>Install new MTA</title> |
| 504 |
|
| 505 |
<para>You have a wide choice of MTAs available to you. A good |
| 506 |
starting point is the |
| 507 |
<link linkend="ports">FreeBSD Ports Collection</link> where |
| 508 |
you will be able to find many. Of course you are free to use |
| 509 |
any MTA you want from any location, as long as you can make |
| 510 |
it run under FreeBSD.</para> |
| 511 |
|
| 512 |
<para>Start by installing your new MTA. Once it is installed |
| 513 |
it gives you a chance to decide if it really fulfills your |
| 514 |
needs, and also gives you the opportunity to configure your |
| 515 |
new software before getting it to take over from |
| 516 |
<application>sendmail</application>. When doing this, you |
| 517 |
should insure that installing the new software won't attempt |
| 518 |
to overwrite system binaries such as |
| 519 |
<filename>/usr/bin/sendmail</filename>. Otherwise, your new |
| 520 |
mail software has essentially been put into service before |
| 521 |
you have configured it.</para> |
| 522 |
|
| 523 |
<para>Please refer to your chosen MTA's documentation for |
| 524 |
information on how to configure the software you have |
| 525 |
chosen.</para> |
| 526 |
</sect2> |
| 527 |
|
| 528 |
<sect2> |
| 529 |
<title>Disable <application>sendmail</application></title> |
| 530 |
|
| 531 |
<para>The procedure used to start |
| 532 |
<application>sendmail</application> changed significantly |
| 533 |
between 4.5-RELEASE and 4.6-RELEASE. Therefore, the procedure |
| 534 |
used to disable it is subtly different.</para> |
| 535 |
<sect3> |
| 536 |
<title>FreeBSD 4.5-STABLE before 2002/4/4 and earlier |
| 537 |
(including 4.5-RELEASE and earlier)</title> |
| 538 |
|
| 539 |
<para>Enter |
| 540 |
<programlisting>sendmail_enable="NO"</programlisting> into |
| 541 |
<filename>/etc/rc.conf</filename>. This will disable |
| 542 |
<application>sendmail</application>'s incoming mail service, |
| 543 |
but if <filename>/etc/mail/mailer.conf</filename> (see below) |
| 544 |
is not changed, <application>sendmail</application> will |
| 545 |
still be used to send e-mail.</para> |
| 546 |
</sect3> |
| 547 |
|
| 548 |
<sect3> |
| 549 |
<title>FreeBSD 4.5-STABLE after 2002/4/4 |
| 550 |
(including 4.6-RELEASE and later)</title> |
| 551 |
|
| 552 |
<para>In order to completely disable |
| 553 |
<application>sendmail</application> you must use |
| 554 |
<programlisting>sendmail_enable="NONE"</programlisting> in |
| 555 |
<filename>/etc/rc.conf</filename></para> |
| 556 |
|
| 557 |
<warning> |
| 558 |
<para>If you disable <application>sendmail</application>'s |
| 559 |
outgoing mail service in this way, it is important that you |
| 560 |
replace it with a fully working alternative mail delivery |
| 561 |
system. If you choose not to, system functions such as |
| 562 |
&man.periodic.8 will be unable to deliver their results by |
| 563 |
e-mail as they would normally expect to. Many parts of your |
| 564 |
system may expect to have a functional |
| 565 |
<application>sendmail</application>-compatible system. If |
| 566 |
applications continue to use |
| 567 |
<application>sendmail</application>'s binaries to try and send |
| 568 |
e-mail after you have disabled it, the mail may transparently |
| 569 |
queue forever.</para> |
| 570 |
</warning> |
| 571 |
|
| 572 |
<para>If you only want to disable |
| 573 |
<application>sendmail</application>'s incoming mail service, |
| 574 |
you should set |
| 575 |
<programlisting>sendmail_enable="NO"</programlisting> in |
| 576 |
<filename>/etc/rc.conf</filename>. More information on |
| 577 |
<application>sendmail</application>'s startup options is |
| 578 |
available from the &man.rc.sendmail.8 manual page.</para> |
| 579 |
</sect3> |
| 580 |
|
| 581 |
<sect2> |
| 582 |
<title>Running your new MTA on boot</title> |
| 583 |
|
| 584 |
<para>You may have a choice of two methods for running your |
| 585 |
new MTA on boot, again depending on what version of FreeBSD |
| 586 |
you are running.</para> |
| 587 |
|
| 588 |
<sect3> |
| 589 |
<title>FreeBSD 4.5-STABLE before 2002/4/11 |
| 590 |
(including 4.5-RELEASE and earlier)</title> |
| 591 |
|
| 592 |
<para>Add a script into |
| 593 |
<filename>/usr/local/etc/rc.d/</filename> that |
| 594 |
ends in <filename>.sh</filename> and is executable by |
| 595 |
root. The script should also accept the parameters 'start' |
| 596 |
or 'stop'. So that you could, for example, execute |
| 597 |
<filename>/usr/local/etc/rc.d/supermailer.sh start</filename> |
| 598 |
or <filename>/usr/local/etc/rc.d/supermailer.sh stop</filename>. |
| 599 |
The system will call your script using 'start' when the it |
| 600 |
boots and using 'stop' when the it shuts down.</para> |
| 601 |
|
| 602 |
</sect3> |
| 603 |
|
| 604 |
<sect3> |
| 605 |
<title>FreeBSD 4.5-STABLE after 2002/4/11 |
| 606 |
(including 4.6-RELEASE and later)</title> |
| 607 |
|
| 608 |
<para>With later versions of FreeBSD, you can use the |
| 609 |
above method or you can also set |
| 610 |
<programlisting>mta_start_script="<replaceable>filename</replaceable>"</programlisting> |
| 611 |
in <filename>/etc/rc.conf</filename>, where |
| 612 |
<replaceable>filename</replaceable> is the name of some |
| 613 |
script that you want executed on boot to start your |
| 614 |
MTA.</para> |
| 615 |
</sect3> |
| 616 |
|
| 617 |
</sect2> |
| 618 |
|
| 619 |
<sect2> |
| 620 |
<title>Replacing <application>sendmail</application> as |
| 621 |
the system's default mailer</title> |
| 622 |
|
| 623 |
<para><application>Sendmail</application> is so ubiquitous |
| 624 |
as standard software on Unix systems, that some software |
| 625 |
just presumes that it is already installed and configured. |
| 626 |
For this reason, many alternative MTA's provide utilities |
| 627 |
that implement exactly the same command-line interface |
| 628 |
that <application>sendmail</application> provides.</para> |
| 629 |
|
| 630 |
<para>Therefore, if you are using an alternative mailer, |
| 631 |
you will need to make sure that software trying to execute |
| 632 |
standard <application>sendmail</application> binaries such as |
| 633 |
<filename>/usr/bin/sendmail</filename> actually executes |
| 634 |
your chosen mailer instead. Fortunately, FreeBSD provides |
| 635 |
a system called &man.mailwrapper.8 that does this job for |
| 636 |
you.</para> |
| 637 |
|
| 638 |
<para>When <application>sendmail</application> is operating as installed, you will |
| 639 |
find something like the following |
| 640 |
in <filename>/etc/mail/mailer.conf</filename> : <programlisting> |
| 641 |
sendmail /usr/libexec/sendmail/sendmail |
| 642 |
send-mail /usr/libexec/sendmail/sendmail |
| 643 |
mailq /usr/libexec/sendmail/sendmail |
| 644 |
newaliases /usr/libexec/sendmail/sendmail |
| 645 |
hoststat /usr/libexec/sendmail/sendmail |
| 646 |
purgestat /usr/libexec/sendmail/sendmail</programlisting></para> |
| 647 |
|
| 648 |
<para>This means that when any of these common command |
| 649 |
are run, such as <filename>/usr/bin/sendmail</filename> |
| 650 |
the program that is actually sitting in that location |
| 651 |
checks <filename>mailer.conf</filename> and actually |
| 652 |
executes <filename>/usr/libexec/sendmail/sendmail</filename> |
| 653 |
instead. This system makes it easy to change what binaries |
| 654 |
are actually executed when these default system utilites |
| 655 |
are run.</para> |
| 656 |
|
| 657 |
<para>Therefore if you wanted |
| 658 |
<filename>/usr/local/supermailer/bin/sendmail-compat</filename> |
| 659 |
to be run instead of sendmail, you would change |
| 660 |
<filename>/etc/mail/mailer.conf</filename> to read : <programlisting> |
| 661 |
sendmail /usr/local/supermailer/bin/sendmail-compat |
| 662 |
send-mail /usr/local/supermailer/bin/sendmail-compat |
| 663 |
mailq /usr/local/supermailer/bin/mailq-compat |
| 664 |
newaliases /usr/local/supermailer/bin/newaliases-compat |
| 665 |
hoststat /usr/local/supermailer/bin/hoststat-compat |
| 666 |
purgestat /usr/local/supermailer/bin/purgestat-compat</programlisting> |
| 667 |
</para> |
| 668 |
|
| 669 |
</sect2> |
| 670 |
|
| 671 |
<sect2> |
| 672 |
<title>Finishing</title> |
| 673 |
|
| 674 |
<para>Once you have everything configured how you want it, you should |
| 675 |
either kill the <application>sendmail</application> processes that |
| 676 |
you no longer need and start the processes belonging to your new |
| 677 |
software. Or you should reboot your machine. Rebooting will also |
| 678 |
give you the opportunity to ensure that you have correctly |
| 679 |
configured your machine to start your new MTA on boot.</para> |
| 680 |
|
| 681 |
</sect2> |
| 682 |
|
| 683 |
</sect1> |
| 684 |
|
| 478 |
<sect1 id="mail-trouble"> |
685 |
<sect1 id="mail-trouble"> |
| 479 |
<title>Troubleshooting</title> |
686 |
<title>Troubleshooting</title> |
| 480 |
<indexterm> |
687 |
<indexterm> |