The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

20.4 Changing your Mail Transfer Agent

Written by Andrew Boothman. Information taken from e-mails written by Gregory Neil Shapiro.

As already mentioned, FreeBSD comes with sendmail already installed as your MTA (Mail Transfer Agent). Therefore by default it is in charge of your outgoing and incoming mail.

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.

20.4.1 Install a new MTA

You have a wide choice of MTAs available. A good starting point is the FreeBSD Ports Collection 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.

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 sendmail. When doing this, you should be sure that installing the new software won't attempt to overwrite system binaries such as /usr/bin/sendmail. Otherwise, your new mail software has essentially been put into service before you have configured it.

Please refer to your chosen MTA's documentation for information on how to configure the software you have chosen.

20.4.2 Disable sendmail

The procedure used to start sendmail changed significantly between 4.5-RELEASE and 4.6-RELEASE. Therefore, the procedure used to disable it is subtly different.

20.4.2.1 FreeBSD 4.5-STABLE before 2002/4/4 and earlier (including 4.5-RELEASE and earlier)

Enter:

    sendmail_enable="NO"

into /etc/rc.conf. This will disable sendmail's incoming mail service, but if /etc/mail/mailer.conf (see below) is not changed, sendmail will still be used to send e-mail.

20.4.2.2 FreeBSD 4.5-STABLE after 2002/4/4 (including 4.6-RELEASE and later)

In order to completely disable sendmail you must use

    sendmail_enable="NONE"

in /etc/rc.conf.

Warning: If you disable sendmail'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 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 sendmail-compatible system. If applications continue to use sendmail's binaries to try and send e-mail after you have disabled them, mail could go into an inactive sendmail queue, and never be delivered.

If you only want to disable sendmail's incoming mail service, you should set

    sendmail_enable="NO"

in /etc/rc.conf. More information on sendmail's startup options is available from the rc.sendmail(8) manual page.

20.4.3 Running your new MTA on boot

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.

20.4.3.1 FreeBSD 4.5-STABLE before 2002/4/11 (including 4.5-RELEASE and earlier)

Add a script to /usr/local/etc/rc.d/ that ends in .sh and is executable by root. The script should accept start and stop parameters. At startup time the system scripts will execute the command

    /usr/local/etc/rc.d/supermailer.sh start

which you can also use to manually start the server. At shutdown time, the system scripts will use the stop option, running the command

    /usr/local/etc/rc.d/supermailer.sh stop

which you can also use to manually stop the server while the system is running.

20.4.3.2 FreeBSD 4.5-STABLE after 2002/4/11 (including 4.6-RELEASE and later)

With later versions of FreeBSD, you can use the above method or you can set

    mta_start_script="filename"

in /etc/rc.conf, where filename is the name of some script that you want executed at boot to start your MTA.

20.4.4 Replacing sendmail as the system's default mailer

Sendmail is so ubiquitous 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 sendmail command-line interface; this facilitates using them as ``drop-in'' replacements for sendmail.

Therefore, if you are using an alternative mailer, you will need to make sure that software trying to execute standard sendmail binaries such as /usr/bin/sendmail actually executes your chosen mailer instead. Fortunately, FreeBSD provides a system called mailwrapper(8) that does this job for you.

When sendmail is operating as installed, you will find something like the following in /etc/mail/mailer.conf:

    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

This means that when any of these common commands (such as sendmail itself) are run, the system actually invokes a copy of mailwrapper named sendmail, which checks mailer.conf and executes /usr/libexec/sendmail/sendmail instead. This system makes it easy to change what binaries are actually executed when these default sendmail functions are invoked.

Therefore if you wanted /usr/local/supermailer/bin/sendmail-compat to be run instead of sendmail, you could change /etc/mail/mailer.conf to read:

    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

20.4.5 Finishing

Once you have everything configured the way you want it, you should either kill the sendmail processes that you no longer need and start the processes belonging to your new software, or simply reboot. Rebooting will also give you the opportunity to ensure that you have correctly configured your system to start your new MTA automatically on boot.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру