Using nullmailer instead of a full blown mail server

My mail server of choice is Postfix. I’ve been using it since 1992. It is what I install on all my servers. But that is going go change today.

I just installed nullmailer on my DHCP server.

When your machine just sends outgoing email, just as notices, you don’t need a full blown MTA. Something like nullmailer should suffice.

The system I’m working on is a FreeBSD jail running FreeBSD 9.1-RELEASE-p4.

I’m about to find out. It’s small. You can add SSL support, but I’m not. Maintaining it should be a breeze. With few dependencies, there’s less chance of an upgrade being required because of a vulnerability in something else.

After installing, I redefined redefine mailq and sendmail by having only this in /etc/mail/mailer.conf:

sendmail	/usr/local/libexec/nullmailer/sendmail
send-mail	/usr/local/libexec/nullmailer/sendmail
mailq		/usr/local/libexec/nullmailer/mailq

Next, I created /usr/local/etc/nullmailer/remotes to contain this:

cliff.example.org smtp --port=25

That points to my smart mail host, which will take care of the delivery.

The server hostname must appear in /usr/local/etc/nullmailer/me and /usr/local/etc/nullmailer/me.sample usually contains the right example. Mine contains:

toiler.example.org

You need to enable nullmailer with this entry in /etc/rc.conf:

nullmailer_enable="YES"

Then I started nullmailer:

# service nullmailer start
Starting nullmailer.
# ps auwx | grep nullmailer
nullmail 48374  0.0  0.0  14504  1864 ??  IsJ  12:09PM 0:00.00 /bin/sh -c /usr/local/sbin/nullmailer-send | /usr/bin/logger -i -p mail.info -t nullmailer
nullmail 48375  0.0  0.0  19616  2252 ??  IJ   12:09PM 0:00.00 /usr/local/sbin/nullmailer-send
nullmail 48376  0.0  0.0   9912  1372 ??  IJ   12:09PM 0:00.00 /usr/bin/logger -i -p mail.info -t nullmailer
root     49581  0.0  0.0  10228  1532  3  R+J  12:10PM 0:00.00 grep nullmailer

Let’s send a test message:

echo test | mail dan@example.org

Checking the mail logs:

Oct 16 12:14:16 toiler nullmailer[48376]: Trigger pulled.
Oct 16 12:14:16 toiler nullmailer[48376]: Rescanning queue.
Oct 16 12:14:16 toiler nullmailer[48376]: Starting delivery, 1 message(s) in queue.
Oct 16 12:14:16 toiler nullmailer[48376]: Starting delivery: protocol: smtp host: cliff.example.org file: 1381925656.51602
Oct 16 12:14:16 toiler nullmailer[48376]: Sent file.
Oct 16 12:14:16 toiler nullmailer[48376]: Delivery complete, 0 message(s) remain.

Based on the above, here is my newly created /usr/local/etc/logcheck/ignore.d.server/local-nullmailer file:

^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Trigger pulled.
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Rescanning queue.
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Starting delivery, [[:digit:]]+ message\(s\) in queue.
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Starting delivery: protocol: smtp host: cliff.example.org file: [[:digit:]]+.[[:digit:]]+
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Sent file.
^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ nullmailer\[[[:digit:]]+\]: Delivery complete, 0 message\(s\) remain.

You may want to use something other than cliff.example.org as shown in the 4th line.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top