Nullmailer

From LQWiki
(Redirected from NullMailer)
Jump to navigation Jump to search

nullmailer is, according to its own man page, "a simple and secure relay-only mail transport agent." It was written by Bruce Guenter.

Nullmailer may be found at http://www.untroubled.org/nullmailer/. At present, the current release is 1.04, dated 2007-10-09.

nullmailer is an appropriate choice of mail agent for machines that receive no local mail, and only need to generate messages for sending off the system, such as a web server with applications that occasionally send notifications. nullmailer is easy to install and requires little ongoing administration.

Installation

Obtain the source archive and unpack.

Create a user "nullmailer" and a group "nullmailer".

In the source tree:

./configure
make -j8
make install install-root

Configuration

nullmailer's config files may be found in /usr/local/etc/nullmailer/.

In the file "me", put your machine's hostname:

foo.example.org

In the file "remotes", list those servers through which all mail should be relayed, along with the protocol:

mailserv.example.org smtp
mailserv2.example.org smtp
mailserv3.foo.org smtp

On these remote machines, with their more traditional mail agents, don't forget to allow the nullmailer-using machine to relay. For example, in Postfix, you would list IP numbers of the machine(s) using nullmailer in "mynetworks" of "main.cf".

Running the daemon

Like any other MTA, nullmailer runs as a daemon, which manages the queue and sends mail on its way. Start the daemon from your RC files:

/etc/rc.local
/usr/local/sbin/nullmailer-send & ## ampersand required to force it to go background

Sending mail

"nullmailer-inject" receives a standard email message on STDIN which it then writes to the queue (a pipe, and several directories under /usr/local/var/nullmailer/).

To be effective, nullmailer-inject should masquerade as sendmail, for benefit of the many scripts that reference /usr/sbin/sendmail.

nullmailer-inject's command-line arguments are not compatible with sendmail; however, the author has provided a wrapper, installed as /usr/local/sbin/sendmail. ("strings /usr/local/bin/sendmail |grep nullmail" can be used to verify that this file is indeed part of nullmailer).

To invoke this, you'll need to link it from the standard location.

/usr/sbin/sendmail is usually a link to something like /etc/alternatives/mta. If this is the case:

cd /etc/alternatives
rm mta mta-sendmail
ln -s /usr/local/sbin/sendmail mta
ln -s /usr/local/sbin/sendmail mta-sendmail

See also